From 31f87452087194d017c9f303e2f5e1bdff219610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Mon, 16 Oct 2023 09:21:19 +0200 Subject: Qml: Prevent MSVC 2019 min()/max() macros from triggering windows.h defines the min() and max() macros. These get applied when trying to call std::numeric_limits::min(). Add parentheses around the function before its invocation to break the macro. Amends: 9df4293adf7d019b4d3ccaaa2f5d87ddfe0b041b Fixes: QTBUG-118132 Pick-to: 6.6 Change-Id: I96039cd714b042d880bcff6c9163cbeb76fe2f80 Reviewed-by: Fabian Kosmale --- src/qml/common/qjsnumbercoercion.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/qml/common') diff --git a/src/qml/common/qjsnumbercoercion.h b/src/qml/common/qjsnumbercoercion.h index bc04794d2f..53d587676d 100644 --- a/src/qml/common/qjsnumbercoercion.h +++ b/src/qml/common/qjsnumbercoercion.h @@ -20,8 +20,8 @@ public: { // Comparing d with itself checks for NaN and comparing d with the min and max values // for int also covers infinities. - if (!equals(d, d) || d < std::numeric_limits::min() - || d > std::numeric_limits::max()) { + if (!equals(d, d) || d < (std::numeric_limits::min)() + || d > (std::numeric_limits::max)()) { return false; } @@ -32,7 +32,7 @@ public: static constexpr bool isArrayIndex(double d) { - if (d < 0 || !equals(d, d) || d > std::numeric_limits::max()) { + if (d < 0 || !equals(d, d) || d > (std::numeric_limits::max)()) { return false; } @@ -44,7 +44,7 @@ public: if (!equals(d, d)) return 0; - if (d >= std::numeric_limits::min() && d <= std::numeric_limits::max()) { + if (d >= (std::numeric_limits::min)() && d <= (std::numeric_limits::max)()) { const int i = static_cast(d); if (equals(i, d)) return i; -- cgit v1.2.3