1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-10 18:45:47 +01:00

Fixed floating point constants defined as double but expected as float

To preserve the accuracy of the operation, the C standard request that the
mathematical operation is performed using double precision, but in many
case this is not necessary so this patch fixes a few constants to avoid
that conversion.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-24 15:49:06 +02:00
committed by Carlos R. Mafra
parent 1df08cc492
commit 79a95d7173
8 changed files with 31 additions and 31 deletions

View File

@@ -211,7 +211,7 @@ static void willResizeColorWell(W_ViewDelegate * self, WMView * view, unsigned i
if (*height < MIN_HEIGHT)
*height = MIN_HEIGHT;
bw = (int)((float)WMIN(*width, *height) * 0.24);
bw = (int)((float)WMIN(*width, *height) * 0.24F);
W_ResizeView(cPtr->colorView, *width - 2 * bw, *height - 2 * bw);

View File

@@ -168,10 +168,10 @@ void WMSetScrollerParameters(WMScroller * sPtr, float floatValue, float knobProp
assert(!isnan(floatValue));
if (floatValue < 0.0)
sPtr->floatValue = 0.0;
else if (floatValue > 1.0)
sPtr->floatValue = 1.0;
if (floatValue < 0.0F)
sPtr->floatValue = 0.0F;
else if (floatValue > 1.0F)
sPtr->floatValue = 1.0F;
else
sPtr->floatValue = floatValue;
@@ -180,9 +180,9 @@ void WMSetScrollerParameters(WMScroller * sPtr, float floatValue, float knobProp
sPtr->knobProportion = min_knob_proportion;
sPtr->flags.documentFullyVisible = 0;
} else if (knobProportion >= 1.0) {
} else if (knobProportion >= 1.0F) {
sPtr->knobProportion = 1.0;
sPtr->knobProportion = 1.0F;
sPtr->flags.documentFullyVisible = 1;
} else {
@@ -344,7 +344,7 @@ static int knobLength(Scroller * sPtr)
length -= 2 * (BUTTON_SIZE + 1);
}
tmp = (int)((float)length * sPtr->knobProportion + 0.5);
tmp = (int)((float)length * sPtr->knobProportion + 0.5F);
/* keep minimum size */
if (tmp < BUTTON_SIZE)
tmp = BUTTON_SIZE;
@@ -418,7 +418,7 @@ static void paintScroller(Scroller * sPtr)
length - (int)(knobP + knobL), view->size.height - 4);
} else {
/* before */
if (knobP > 0.0)
if (knobP > 0.0F)
XFillRectangle(scr->display, d, scr->stippleGC,
2, ofs, view->size.width - 4, (int)knobP);

View File

@@ -506,7 +506,7 @@ static void updateScrollerProportion(ScrollView * sPtr)
prop = (float)sPtr->viewport->size.width / (float)sPtr->contentView->size.width;
if (oldP < 1.0)
if (oldP < 1.0F)
value = (prop * oldV) / oldP;
else
value = 0;
@@ -518,7 +518,7 @@ static void updateScrollerProportion(ScrollView * sPtr)
prop = (float)sPtr->viewport->size.height / (float)sPtr->contentView->size.height;
if (oldP < 1.0)
if (oldP < 1.0F)
value = (prop * oldV) / oldP;
else
value = 0;