aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/common
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2023-10-16 09:21:19 +0200
committerOlivier De Cannière <olivier.decanniere@qt.io>2023-10-16 13:29:55 +0200
commit31f87452087194d017c9f303e2f5e1bdff219610 (patch)
treed046c8bd9839802df7c6bc1e4437acccd6cb5194 /src/qml/common
parent1ff2d96d863be027ebed333fb0b441fa051c7cba (diff)
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<int>::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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/common')
-rw-r--r--src/qml/common/qjsnumbercoercion.h8
1 files changed, 4 insertions, 4 deletions
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<int>::min()
- || d > std::numeric_limits<int>::max()) {
+ if (!equals(d, d) || d < (std::numeric_limits<int>::min)()
+ || d > (std::numeric_limits<int>::max)()) {
return false;
}
@@ -32,7 +32,7 @@ public:
static constexpr bool isArrayIndex(double d)
{
- if (d < 0 || !equals(d, d) || d > std::numeric_limits<int>::max()) {
+ if (d < 0 || !equals(d, d) || d > (std::numeric_limits<int>::max)()) {
return false;
}
@@ -44,7 +44,7 @@ public:
if (!equals(d, d))
return 0;
- if (d >= std::numeric_limits<int>::min() && d <= std::numeric_limits<int>::max()) {
+ if (d >= (std::numeric_limits<int>::min)() && d <= (std::numeric_limits<int>::max)()) {
const int i = static_cast<int>(d);
if (equals(i, d))
return i;