From 6a64722fb391560d17f3065cfdc122ecb0b39ff1 Mon Sep 17 00:00:00 2001 From: Dennis Oberst Date: Thu, 13 Mar 2025 13:56:51 +0100 Subject: [PATCH] Fix mixed-type usage for modf When building Qt with a non-double qreal type, i.e. QT_COORD_TYPE=float, the C function modf rejects the float type since it is declared as: float modff(float, float*) double modf(double, double*) Fix this by porting to std::modf, which provides overloads for both FP types. Amends 91f502a7d65d76f4a376903c4058385a62dad277. Change-Id: Ic1de2f3d8e75a9594dbbd0fa92e63505dae6f1b4 Reviewed-by: Marc Mutz --- src/gui/painting/qpainterpath.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 4e1726c3832..b13b1bcad34 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -22,6 +22,8 @@ #include #include +#include + #include #if 0 @@ -3228,7 +3230,7 @@ QPainterPath QPainterPath::trimmed(qreal f1, qreal f2, qreal offset) const if (offset) { qreal dummy; - offset = modf(offset, &dummy); // Use only the fractional part of offset, range <-1, 1> + offset = std::modf(offset, &dummy); // Use only the fractional part of offset, range <-1, 1> qreal of1 = f1 + offset; qreal of2 = f2 + offset;