mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-01 14:15:51 +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:
committed by
Carlos R. Mafra
parent
dcfd7a4b5e
commit
0e41122680
@@ -503,10 +503,10 @@ static void updateScrollerProportion(ScrollView * sPtr)
|
|||||||
|
|
||||||
prop = (float)sPtr->viewport->size.width / (float)sPtr->contentView->size.width;
|
prop = (float)sPtr->viewport->size.width / (float)sPtr->contentView->size.width;
|
||||||
|
|
||||||
if (oldP == 1.0)
|
if (oldP < 1.0)
|
||||||
value = 0;
|
|
||||||
else
|
|
||||||
value = (prop * oldV) / oldP;
|
value = (prop * oldV) / oldP;
|
||||||
|
else
|
||||||
|
value = 0;
|
||||||
WMSetScrollerParameters(sPtr->hScroller, value, prop);
|
WMSetScrollerParameters(sPtr->hScroller, value, prop);
|
||||||
}
|
}
|
||||||
if (sPtr->flags.hasVScroller) {
|
if (sPtr->flags.hasVScroller) {
|
||||||
@@ -515,10 +515,10 @@ static void updateScrollerProportion(ScrollView * sPtr)
|
|||||||
|
|
||||||
prop = (float)sPtr->viewport->size.height / (float)sPtr->contentView->size.height;
|
prop = (float)sPtr->viewport->size.height / (float)sPtr->contentView->size.height;
|
||||||
|
|
||||||
if (oldP == 1.0)
|
if (oldP < 1.0)
|
||||||
value = 0;
|
|
||||||
else
|
|
||||||
value = (prop * oldV) / oldP;
|
value = (prop * oldV) / oldP;
|
||||||
|
else
|
||||||
|
value = 0;
|
||||||
WMSetScrollerParameters(sPtr->vScroller, value, prop);
|
WMSetScrollerParameters(sPtr->vScroller, value, prop);
|
||||||
}
|
}
|
||||||
applyScrollerValues(sPtr);
|
applyScrollerValues(sPtr);
|
||||||
|
|||||||
Reference in New Issue
Block a user