From dad54e794f8e5ebf19883399a2481098b2043639 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 13 Apr 2015 15:50:45 +0200 Subject: [PATCH] MSVC: Silence compiler warning about INFINITY Contrary to the comment, MSVC does support INFINITY, but always prints a warning when it's used: qpainterpath.cpp(3066) : warning C4756: overflow in constant arithmetic Avoid this by using numeric_limits::infinity. Change-Id: Ie925b036b807378da5298a275fa108347c24519e Reviewed-by: Friedemann Kleint --- src/gui/painting/qpainterpath.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 88cf05c6464..e2f267d7eee 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -3057,20 +3057,19 @@ qreal QPainterPath::slopeAtPercent(qreal t) const //tangent line qreal slope = 0; -#define SIGN(x) ((x < 0)?-1:1) if (m1) slope = m2/m1; else { - //windows doesn't define INFINITY :( -#ifdef INFINITY - slope = INFINITY*SIGN(m2); -#else - if (sizeof(qreal) == sizeof(double)) { - return 1.79769313486231570e+308; + if (std::numeric_limits::has_infinity) { + slope = (m2 < 0) ? -std::numeric_limits::infinity() + : std::numeric_limits::infinity(); } else { - return ((qreal)3.40282346638528860e+38); + if (sizeof(qreal) == sizeof(double)) { + return 1.79769313486231570e+308; + } else { + return ((qreal)3.40282346638528860e+38); + } } -#endif } return slope;