diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-12-16 15:27:33 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-12-16 15:29:34 -0800 |
commit | aba5a2f22ff6e0ada7d606cbf91c5974e3255d77 (patch) | |
tree | 9069fc4cdb9d9c05b97bf4ac97b3a201b8904628 | |
parent | dff77bb76ab2260877a37193df1d728d2f4a1d88 (diff) | |
download | xorg-font-util-aba5a2f22ff6e0ada7d606cbf91c5974e3255d77.tar.gz |
Fix a bunch of clang integer size conversion warnings in ucs2any
ucs2any.c:149:36: warning: implicit conversion changes signedness: 'int' to 'si
ze_t' (aka 'unsigned long') [-Wsign-conversion]
*dest = zrealloc(*dest, dest_size + source_size);
~~~~~~~~ ~~~~~~~~~~^~~~~~~~~~~~~
ucs2any.c:147:29: warning: implicit conversion loses integer precision: 'unsign
ed long' to 'int' [-Wshorten-64-to-32]
dest_size = strlen(*dest) + 1;
~ ~~~~~~~~~~~~~~^~~
ucs2any.c:148:16: warning: implicit conversion loses integer precision: 'size_t
' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
source_size = strlen(source);
~ ^~~~~~~~~~~~~~
ucs2any.c:159:8: warning: implicit conversion loses integer precision: 'int' to
'char' [-Wconversion]
*t = toupper(*t);
~ ^~~~~~~~~~~
ucs2any.c:305:27: warning: implicit conversion loses integer precision: 'int' t
o 'char' [-Wconversion]
(*buffer)[position++] = c;
~ ^
ucs2any.c:465:21: warning: comparison of integers of different signs: 'size_t'
(aka 'unsigned long') and 'int' [-Wsign-compare]
if (strlen(string) <= l) return NULL;
~~~~~~~~~~~~~~ ^ ~
ucs2any.c:466:31: warning: implicit conversion changes signedness: 'int' to 'si
ze_t' (aka 'unsigned long') [-Wsign-conversion]
if (strncmp(string, pattern, l) != 0) return NULL;
~~~~~~~ ^
ucs2any.c:463:10: warning: implicit conversion loses integer precision: 'size_t
' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
int l = strlen(pattern);
~ ^~~~~~~~~~~~~~~
ucs2any.c:730:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
target = strtol(p+2, &endp, 16);
~ ^~~~~~~~~~~~~~~~~~~~~~
ucs2any.c:738:11: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
ucs = strtol(p+2, &endp, 16);
~ ^~~~~~~~~~~~~~~~~~~~~~
ucs2any.c:843:19: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
bbx.cwidth = w;
~ ^
ucs2any.c:844:20: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
bbx.cheight = h;
~ ^
ucs2any.c:845:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
bbx.cxoff = x;
~ ^
ucs2any.c:846:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
bbx.cyoff = y;
~ ^
ucs2any.c:850:7: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
w, h, x, y, &bbx);
^
ucs2any.c:850:10: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
w, h, x, y, &bbx);
^
ucs2any.c:850:13: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
w, h, x, y, &bbx);
^
ucs2any.c:850:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
w, h, x, y, &bbx);
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | ucs2any.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -140,8 +140,8 @@ zquotedcpy(char **dest, const char *source) static void zstrcat(char **dest, const char *source) { - int dest_size = 1; - int source_size; + size_t dest_size = 1; + size_t source_size; if (*dest != NULL) dest_size = strlen(*dest) + 1; @@ -156,7 +156,7 @@ zstrtoupper(char *s) char *t; for (t = s; *t != '\000'; t++) - *t = toupper(*t); + *t = (char) toupper(*t); } #define zs_true(x) (x != NULL && strcmp(x, "0") != 0) @@ -302,7 +302,7 @@ read_line(FILE *fp, char **buffer) buffer_size = buffer_size * 2 + 1; *buffer = zrealloc(*buffer, buffer_size); } - (*buffer)[position++] = c; + (*buffer)[position++] = (char) c; (*buffer)[position] = '\0'; c = getc(fp); if (c == EOF) @@ -460,7 +460,7 @@ chars_compare(const void *aa, const void *bb) static const char * startswith(const char *string, const char *pattern) { - int l = strlen(pattern); + size_t l = strlen(pattern); if (strlen(string) <= l) return NULL; if (strncmp(string, pattern, l) != 0) return NULL; @@ -727,7 +727,7 @@ main(int argc, char *argv[]) if (p[0] == '\0' || p[0] == '#') continue; if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { - target = strtol(p+2, &endp, 16); + target = (int) strtol(p+2, &endp, 16); if (*endp == '\0') goto bad; p = endp; } else @@ -735,7 +735,7 @@ main(int argc, char *argv[]) for (; isspace(p[0]); p++) ; if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { - ucs = strtol(p+2, &endp, 16); + ucs = (int) strtol(p+2, &endp, 16); if (*endp == '\0') goto bad; } else goto bad; @@ -814,7 +814,7 @@ main(int argc, char *argv[]) || (nextc = strstr(t, "\nBBX")) != NULL) { char *endp; - long w, h, x, y; + int w, h, x, y; if (*nextc == '\n') { nextc += 4; @@ -823,22 +823,22 @@ main(int argc, char *argv[]) } for (;isspace(*nextc);) nextc++; - w = strtol(nextc, &endp, 10); + w = (int) strtol(nextc, &endp, 10); nextc = endp; if (*nextc == '\0') goto bbxbad; for (;isspace(*nextc);) nextc++; - h = strtol(nextc, &endp, 10); + h = (int) strtol(nextc, &endp, 10); nextc = endp; if (*nextc == '\0') goto bbxbad; for (;isspace(*nextc);) nextc++; - x = strtol(nextc, &endp, 10); + x = (int) strtol(nextc, &endp, 10); nextc = endp; if (*nextc == '\0') goto bbxbad; for (;isspace(*nextc);) nextc++; - y = strtol(nextc, &endp, 10); + y = (int) strtol(nextc, &endp, 10); if (bbx.cwidth == -1) { bbx.cwidth = w; bbx.cheight = h; |