diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-09-09 16:51:01 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-09-09 20:34:19 -0400 |
commit | ea28ca1a2cce8e0d8e5a1f620a809384ed276c37 (patch) | |
tree | 9b0743cd1727eb5e6dbfc84f33dd08db49c5f9a9 /src/Color.c | |
parent | afc7f259668bbb25d5b06929d529add93fb39ebf (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.c | 14 |
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; } |