From 5b966c72c422d2129435de7876f1681b2d710549 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 4 Dec 2022 13:49:27 -0800 Subject: 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 --- src/xcb_aux.c | 8 ++++---- 1 file 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; } -- cgit v1.2.1