diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-03-24 16:27:00 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-03-24 16:30:38 -0700 |
commit | 67a512759f0d8d4e16585b1f04c071f3ea08b8fa (patch) | |
tree | 9dd6f967df01adf5ab4490d635264473b38c0ee4 | |
parent | 4fc3902a090c8ed2aff11d6e8a2c0df600d69966 (diff) |
Add explicit casts to clear implicit conversion warnings
xdpyinfo.c:173:17: warning: implicit conversion changes signedness: 'int' to
'size_t' (aka 'unsigned long') [-Wsign-conversion]
qsort(extlist, n, sizeof(char *), StrCmp);
~~~~~ ^
xdpyinfo.c:183:26: warning: implicit conversion changes signedness: 'int' to
'unsigned long' [-Wsign-conversion]
qe_cookies = calloc(n, sizeof(xcb_query_extension_cookie_t));
~~~~~~ ^
xdpyinfo.c:195:12: warning: implicit conversion loses integer precision:
'unsigned long' to 'uint16_t' (aka 'unsigned short') [-Wconversion]
strlen(extlist[i]),
^~~~~~~~~~~~~~~~~~
xdpyinfo.c:1382:51: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
int extlen = strlen(known_extensions[i].extname) + 1;
~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xdpyinfo.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -170,7 +170,7 @@ print_extension_info(Display *dpy) if (extlist) { int i; - qsort(extlist, n, sizeof(char *), StrCmp); + qsort(extlist, (size_t)n, sizeof(char *), StrCmp); if (!queryExtensions) { for (i = 0; i < n; i++) { @@ -180,7 +180,7 @@ print_extension_info(Display *dpy) xcb_connection_t *xcb_conn = XGetXCBConnection (dpy); xcb_query_extension_cookie_t *qe_cookies; - qe_cookies = calloc(n, sizeof(xcb_query_extension_cookie_t)); + qe_cookies = calloc((size_t)n, sizeof(xcb_query_extension_cookie_t)); if (!qe_cookies) { perror ("calloc failed to allocate memory for extensions"); return; @@ -192,7 +192,7 @@ print_extension_info(Display *dpy) */ for (i = 0; i < n; i++) { qe_cookies[i] = xcb_query_extension (xcb_conn, - strlen(extlist[i]), + (uint16_t)strlen(extlist[i]), extlist[i]); } @@ -1379,7 +1379,7 @@ print_known_extensions(FILE *f) int i, col; for (i = 0, col = 6; i < num_known_extensions; i++) { - int extlen = strlen(known_extensions[i].extname) + 1; + int extlen = (int) strlen(known_extensions[i].extname) + 1; if ((col + extlen) > 79) { |