summaryrefslogtreecommitdiff
path: root/src/Color.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2022-09-09 16:51:01 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2022-09-09 20:34:19 -0400
commitea28ca1a2cce8e0d8e5a1f620a809384ed276c37 (patch)
tree9b0743cd1727eb5e6dbfc84f33dd08db49c5f9a9 /src/Color.c
parentafc7f259668bbb25d5b06929d529add93fb39ebf (diff)
use casts to reduce compiler warnings (no object change)
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/Color.c')
-rw-r--r--src/Color.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Color.c b/src/Color.c
index 671d60b..1c48136 100644
--- a/src/Color.c
+++ b/src/Color.c
@@ -52,21 +52,21 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def)
return 0;
}
c = *spec++;
- *pShort <<= 4;
+ *pShort = (unsigned short) (*pShort << 4);
if (c >= '0' && c <= '9')
- *pShort |= c - '0';
+ *pShort = (unsigned short) (*pShort | (c - '0'));
/* assume string in lowercase
else if (c >= 'A' && c <= 'F')
*pShort |= c - ('A' - 10);
*/
else if (c >= 'a' && c <= 'f')
- *pShort |= c - ('a' - 10);
+ *pShort = (unsigned short) (*pShort | (c - ('a' - 10)));
else return 0;
}
if (n == 0)
return 0;
if (n < 4) {
- *pShort = ((unsigned long)*pShort * 0xFFFF) / ((1 << n*4) - 1);
+ *pShort = (unsigned short) (((unsigned long)*pShort * 0xFFFF) / (unsigned long) ((1 << n*4) - 1));
}
}
def->red = elements[0];
@@ -87,8 +87,8 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def)
def->blue = coreColor.blue;
def->alpha = 0xffff;
}
- def->red = (def->red * def->alpha) / 0xffffU;
- def->green = (def->green * def->alpha) / 0xffffU;
- def->blue = (def->blue * def->alpha) / 0xffffU;
+ def->red = (unsigned short) ((unsigned) (def->red * def->alpha) / 0xffffU);
+ def->green = (unsigned short) ((unsigned) (def->green * def->alpha) / 0xffffU);
+ def->blue = (unsigned short) ((unsigned) (def->blue * def->alpha) / 0xffffU);
return 1;
}