diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-04 13:49:27 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-04 13:49:27 -0800 |
commit | 5b966c72c422d2129435de7876f1681b2d710549 (patch) | |
tree | 091e79faec7b61eb553ab76aad31bcdc7ed22776 | |
parent | 50c931740b424e959b765aaf719278f5f025b329 (diff) | |
download | xcb-util-5b966c72c422d2129435de7876f1681b2d710549.tar.gz |
xcb_aux: handle -Wimplicit-int-conversion warnings from clang
xcb_aux.c:61:10: warning: implicit conversion loses integer precision:
'int' to 'uint8_t' (aka 'unsigned char') [-Wimplicit-int-conversion]
return depth;
~~~~~~ ^~~~~
xcb_aux.c:343:14: warning: implicit conversion loses integer precision:
'int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
*red = r << n;
~ ~~^~~~
xcb_aux.c:344:16: warning: implicit conversion loses integer precision:
'int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
*green = g << n;
~ ~~^~~~
xcb_aux.c:345:15: warning: implicit conversion loses integer precision:
'int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
*blue = b << n;
~ ~~^~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/xcb_aux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xcb_aux.c b/src/xcb_aux.c index b6f64f8..c56ad61 100644 --- a/src/xcb_aux.c +++ b/src/xcb_aux.c @@ -48,7 +48,7 @@ xcb_aux_get_depth (xcb_connection_t *c, { xcb_drawable_t drawable; xcb_get_geometry_reply_t *geom; - int depth = 0; + uint8_t depth = 0; drawable = screen->root; geom = xcb_get_geometry_reply (c, xcb_get_geometry(c, drawable), 0); @@ -340,9 +340,9 @@ xcb_aux_parse_color(const char *color_name, } while (*color_name != '\0'); n <<= 2; n = 16 - n; - *red = r << n; - *green = g << n; - *blue = b << n; + *red = (uint16_t) (r << n); + *green = (uint16_t) (g << n); + *blue = (uint16_t) (b << n); return 1; } |