1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-15 02:54:15 +01:00

WINGs: Changed equality comparison on floating point number

The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. This patch changes
all the cases which try to do this to a safer check.
This commit is contained in:
Christophe CURIS
2013-05-11 00:07:18 +02:00
committed by Carlos R. Mafra
parent dcfd7a4b5e
commit 0e41122680

View File

@@ -503,10 +503,10 @@ static void updateScrollerProportion(ScrollView * sPtr)
prop = (float)sPtr->viewport->size.width / (float)sPtr->contentView->size.width;
if (oldP == 1.0)
value = 0;
else
if (oldP < 1.0)
value = (prop * oldV) / oldP;
else
value = 0;
WMSetScrollerParameters(sPtr->hScroller, value, prop);
}
if (sPtr->flags.hasVScroller) {
@@ -515,10 +515,10 @@ static void updateScrollerProportion(ScrollView * sPtr)
prop = (float)sPtr->viewport->size.height / (float)sPtr->contentView->size.height;
if (oldP == 1.0)
value = 0;
else
if (oldP < 1.0)
value = (prop * oldV) / oldP;
else
value = 0;
WMSetScrollerParameters(sPtr->vScroller, value, prop);
}
applyScrollerValues(sPtr);