diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-12 12:18:34 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-13 14:19:11 -0800 |
commit | 281ebaaaf43139f7876033af54d088d8e93264b7 (patch) | |
tree | e24657a81d1722aa854bb2e44bfc04b8ec63adbe | |
parent | a5340b685b0ffc19793956a97a03d47e6f9076f4 (diff) |
Resolve -Wsign-conversion warnings from clang
xcursorgen.c:169:62: warning: implicit conversion changes signedness:
'int' to 'XcursorPixel' (aka 'unsigned int') [-Wsign-conversion]
p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
xcursorgen.c:269:39: warning: implicit conversion changes signedness:
'png_uint_32' (aka 'unsigned int') to 'int' [-Wsign-conversion]
image = XcursorImageCreate(width, height);
~~~~~~~~~~~~~~~~~~ ^~~~~~
xcursorgen.c:269:32: warning: implicit conversion changes signedness:
'png_uint_32' (aka 'unsigned int') to 'int' [-Wsign-conversion]
image = XcursorImageCreate(width, height);
~~~~~~~~~~~~~~~~~~ ^~~~~
xcursorgen.c:280:25: warning: implicit conversion changes signedness:
'int' to 'XcursorDim' (aka 'unsigned int') [-Wsign-conversion]
image->size = list->size;
~ ~~~~~~^~~~
xcursorgen.c:281:25: warning: implicit conversion changes signedness:
'int' to 'XcursorDim' (aka 'unsigned int') [-Wsign-conversion]
image->xhot = list->xhot;
~ ~~~~~~^~~~
xcursorgen.c:282:25: warning: implicit conversion changes signedness:
'int' to 'XcursorDim' (aka 'unsigned int') [-Wsign-conversion]
image->yhot = list->yhot;
~ ~~~~~~^~~~
xcursorgen.c:283:26: warning: implicit conversion changes signedness:
'int' to 'XcursorUInt' (aka 'unsigned int') [-Wsign-conversion]
image->delay = list->delay;
~ ~~~~~~^~~~~
xcursorgen.c:364:35: warning: implicit conversion changes signedness:
'unsigned int' to 'int' [-Wsign-conversion]
.height = height,
^~~~~~
xcursorgen.c:363:24: warning: implicit conversion changes signedness:
'unsigned int' to 'int' [-Wsign-conversion]
.width = width,
^~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xcursorgen.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/xcursorgen.c b/xcursorgen.c index b42aa22..f6d4cd0 100644 --- a/xcursorgen.c +++ b/xcursorgen.c @@ -166,7 +166,8 @@ premultiply_data(png_structp png _X_UNUSED, png_row_infop row_info, 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); + p = ((unsigned int) alpha << 24) | ((unsigned int) red << 16) | + ((unsigned int) green << 8) | ((unsigned int) blue << 0); memcpy(base, &p, sizeof(XcursorPixel)); } } @@ -266,7 +267,7 @@ load_image(struct flist *list, const char *prefix) png_read_update_info(png, info); - image = XcursorImageCreate(width, height); + image = XcursorImageCreate((int) width, (int) height); if (image == NULL) { fprintf (stderr, "%s: XcursorImageCreate() failed to create %u x %u image\n" @@ -277,10 +278,10 @@ load_image(struct flist *list, const char *prefix) return NULL; } - image->size = list->size; - image->xhot = list->xhot; - image->yhot = list->yhot; - image->delay = list->delay; + image->size = (XcursorDim) list->size; + image->xhot = (XcursorDim) list->xhot; + image->yhot = (XcursorDim) list->yhot; + image->delay = (XcursorUInt) list->delay; rows = malloc(sizeof(png_bytep) * height); if (rows == NULL) { @@ -360,8 +361,8 @@ check_image(char *image) } else { XImage ximage = { - .width = width, - .height = height, + .width = (int) width, + .height = (int) height, .depth = 1, .bits_per_pixel = 1, .xoffset = 0, |