summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-24 18:11:31 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-24 18:15:31 -0700
commit0cf445b33e15df1c194f2a8e2683ba5b1b2e4254 (patch)
tree3bb1f1f980cbd81355d51b86de4e1ac3e91c3ab7
parent70b32490063a227e48fe06ec2e0e2c976b6eff12 (diff)
Resolve implicit conversion warnings from clang
xlsclients.c:303:47: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] qt_reply = malloc(sizeof(*qt_reply) * cs->list_length); ~ ~~~~^~~~~~~~~~~ xlsclients.c:323:31: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] cs = malloc(sizeof(*cs) + child_count * (sizeof(*cs->prop_cookie) + sizeof(*cs->tree_cookie) + sizeof(*cs->win))); ^~~~~~~~~~~ ~ xlsclients.c:515:38: warning: implicit conversion changes signedness: 'unsigned int' to 'int' [-Wsign-conversion] class_len = wm_class->value_len - name_len; ~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ xlsclients.c:515:40: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion] class_len = wm_class->value_len - name_len; ~ ^~~~~~~~ xlsclients.c:514:56: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] name_len = strnlen(res_name, wm_class->value_len) + 1; ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ xlsclients.c:520:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] class_len = strlen(res_class); ~ ^~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xlsclients.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/xlsclients.c b/xlsclients.c
index 94ee214..f0adbdc 100644
--- a/xlsclients.c
+++ b/xlsclients.c
@@ -253,7 +253,7 @@ typedef struct {
xcb_query_tree_cookie_t *tree_cookie;
xcb_window_t *win;
xcb_window_t orig_win;
- int list_length;
+ unsigned int list_length;
int verbose;
int maxcmdlen;
} child_wm_state;
@@ -265,9 +265,9 @@ static void child_info(void *closure)
xcb_connection_t *c = cs->c;
int verbose = cs->verbose;
int maxcmdlen = cs->maxcmdlen;
- int i, j;
+ unsigned int i, j;
- int child_count, num_rep;
+ unsigned int child_count, num_rep;
xcb_query_tree_reply_t **qt_reply;
for (i = 0; i < cs->list_length; i++) {
@@ -509,15 +509,15 @@ show_client_properties(void *closure)
if (cs->verbose) {
if (wm_class && wm_class->type) {
const char *res_name, *res_class;
- int name_len, class_len;
+ int name_len, class_len; /* Must be int for use with %.*s */
res_name = xcb_get_property_value(wm_class);
- name_len = strnlen(res_name, wm_class->value_len) + 1;
- class_len = wm_class->value_len - name_len;
+ name_len = (int) strnlen(res_name, wm_class->value_len) + 1;
+ class_len = (int) wm_class->value_len - name_len;
if (class_len > 0) {
res_class = res_name + name_len;
} else {
res_class = Nil;
- class_len = strlen(res_class);
+ class_len = (int) strlen(res_class);
}
printf (" Instance/Class: %.*s/%.*s",