diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-12 12:09:30 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-13 14:19:11 -0800 |
commit | a5340b685b0ffc19793956a97a03d47e6f9076f4 (patch) | |
tree | 8dbe8fc2b84cf21b08bc1cd8ebae839c6972cc89 | |
parent | b8058f42a84f4930c074860bec5854c4ff818463 (diff) |
Handle -Wimplicit-int-conversion warnings from clang
xcursorgen.c:166:19: warning: implicit conversion loses integer precision:
'unsigned int' to 'unsigned char' [-Wimplicit-int-conversion]
red = div_255((unsigned) red * (unsigned) alpha);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xcursorgen.c:167:19: warning: implicit conversion loses integer precision:
'unsigned int' to 'unsigned char' [-Wimplicit-int-conversion]
green = div_255((unsigned) green * (unsigned) alpha);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xcursorgen.c:168:19: warning: implicit conversion loses integer precision:
'unsigned int' to 'unsigned char' [-Wimplicit-int-conversion]
blue = div_255((unsigned) blue * (unsigned) alpha);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xcursorgen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xcursorgen.c b/xcursorgen.c index 4ed63d1..b42aa22 100644 --- a/xcursorgen.c +++ b/xcursorgen.c @@ -163,9 +163,9 @@ premultiply_data(png_structp png _X_UNUSED, png_row_infop row_info, unsigned char alpha = base[3]; XcursorPixel p; - red = div_255((unsigned) red * (unsigned) alpha); - green = div_255((unsigned) green * (unsigned) alpha); - blue = div_255((unsigned) blue * (unsigned) alpha); + red = (unsigned char) div_255((unsigned) red * (unsigned) alpha); + green = (unsigned char) div_255((unsigned) green * (unsigned) alpha); + blue = (unsigned char) div_255((unsigned) blue * (unsigned) alpha); p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0); memcpy(base, &p, sizeof(XcursorPixel)); } |