1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-08 06:44:11 +01:00

WRaster: Changed equality/inequality 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:16 +02:00
committed by Carlos R. Mafra
parent 80a59696e5
commit 8ef38e9910
3 changed files with 31 additions and 6 deletions

View File

@@ -140,7 +140,7 @@ RImage *RLoadPNG(RContext *context, const char *file)
sgamma = (context->attribs->rgamma + context->attribs->ggamma + context->attribs->bgamma) / 3;
} else if ((tmp = getenv("DISPLAY_GAMMA")) != NULL) {
sgamma = atof(tmp);
if (sgamma == 0)
if (sgamma < 1.0E-3)
sgamma = 1;
} else {
/* blah */