[Xcb-commit] xcb/util: 3 commits - src
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 8 22:53:21 UTC 2022
src/atoms.c | 12 ++++++++++--
src/xcb_aux.c | 8 ++++----
2 files changed, 14 insertions(+), 6 deletions(-)
New commits:
commit 5b966c72c422d2129435de7876f1681b2d710549
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Dec 4 13:49:27 2022 -0800
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 at oracle.com>
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;
}
commit 50c931740b424e959b765aaf719278f5f025b329
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Dec 4 13:43:02 2022 -0800
atoms: Fix type mismatch in xcb_atom_name_unique()
Clears clang warnings of:
atoms.c:84:36: warning: format specifies type 'unsigned long' but
the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
return makename("%s_U%lu", base, id);
~~~ ^~
%u
atoms.c:86:27: warning: format specifies type 'unsigned long' but
the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
return makename("U%lu", id);
~~~ ^~
%u
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
diff --git a/src/atoms.c b/src/atoms.c
index 559579f..fe7fe94 100644
--- a/src/atoms.c
+++ b/src/atoms.c
@@ -81,7 +81,7 @@ char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
char *xcb_atom_name_unique(const char *base, uint32_t id)
{
if(base)
- return makename("%s_U%lu", base, id);
+ return makename("%s_U%u", base, id);
else
- return makename("U%lu", id);
+ return makename("U%u", id);
}
commit 1f2e533010513cc99435e8781226abec5cc53f6f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Dec 4 13:39:22 2022 -0800
atoms: add format attribute to makenames() function
Quiets clang warning:
atoms.c:53:22: warning: format string is not a string literal [-Wformat-nonliteral]
n = vasprintf(&ret, fmt, ap);
^~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
diff --git a/src/atoms.c b/src/atoms.c
index e5c33e5..559579f 100644
--- a/src/atoms.c
+++ b/src/atoms.c
@@ -13,6 +13,14 @@
#include <stdarg.h>
#include "xcb_atom.h"
+#ifndef __has_attribute
+# define __has_attribute(x) 0 /* Compatibility with older compilers. */
+#endif
+
+#if __has_attribute(__format__) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+__attribute__((__format__(__printf__,1,2)))
+#endif
static char *makename(const char *fmt, ...)
{
char *ret;
More information about the xcb-commit
mailing list