diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-01-06 14:26:00 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-01-06 14:26:00 -0800 |
commit | 0a20abea3ec9742f0982e043e725cdadf0fc493e (patch) | |
tree | 3d232a050e097fbd23db5ce065fd39767235db26 | |
parent | a311033403730db56bbbd0c56977e6c49a6b5519 (diff) |
Clear some -Wshorten-64-to-32 warnings from clang 6
ident.c:84:13: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
int n = strlen(filename);
~ ^~~~~~~~~~~~~~~~
ident.c:130:9: warning: implicit conversion loses integer precision:
'off64_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
return gzseek(ff->f.gz, offset, whence);
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ident.c:140:17: warning: implicit conversion loses integer precision:
'long' to 'int' [-Wshorten-64-to-32]
n = offset - ff->pos;
~ ~~~~~~~^~~~~~~~~
ident.c:143:10: warning: implicit conversion loses integer precision:
'off_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
n = offset;
~ ^~~~~~
ident.c:156:12: warning: implicit conversion loses integer precision:
'off_t' (aka 'long') to 'unsigned int' [-Wshorten-64-to-32]
ff->pos = offset;
~ ^~~~~~
ident.c:157:9: warning: implicit conversion loses integer precision:
'off_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
return offset;
~~~~~~ ^~~~~~
mkfontscale.c:704:13: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
int n = strlen(dirname);
~ ^~~~~~~~~~~~~~~
mkfontscale.c:748:13: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
int n = strlen(filename);
~ ^~~~~~~~~~~~~~~~
mkfontscale.c:794:14: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
xl = strlen (exclusionSuffix);
~ ^~~~~~~~~~~~~~~~~~~~~~~~
mkfontscale.c:796:9: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
i = strlen(dirname_given);
~ ^~~~~~~~~~~~~~~~~~~~~
mkfontscale.c:858:15: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
int dl = strlen (entry->d_name);
~~ ^~~~~~~~~~~~~~~~~~~~~~
mkfontscale.c:930:21: warning: implicit conversion loses integer precision:
'unsigned long' to 'int' [-Wshorten-64-to-32]
int l = strlen(xlfd_name);
~ ^~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | ident.c | 13 | ||||
-rw-r--r-- | mkfontscale.c | 17 |
2 files changed, 16 insertions, 14 deletions
@@ -76,12 +76,12 @@ typedef struct { gzFile gz; BZFILE *bz2; } f; - unsigned pos; + unsigned long pos; } fontFile; static inline void * fontFileOpen(fontFile *ff, const char *filename) { - int n = strlen(filename); + size_t n = strlen(filename); if (n > 4 && strcmp(filename + n - 4, ".bz2") == 0) { ff->type = bz2FontFile; @@ -123,7 +123,7 @@ fontFileGetc(fontFile *ff) } } -static int +static long fontFileSeek(fontFile *ff, z_off_t offset, int whence) { if (ff->type == gzFontFile) { @@ -132,7 +132,7 @@ fontFileSeek(fontFile *ff, z_off_t offset, int whence) /* bzlib has no easy equivalent so we have to fake it, * fortunately, we only have to handle a couple of cases */ - int n; + z_off_t n; char buf[BUFSIZ]; switch (whence) { @@ -151,7 +151,7 @@ fontFileSeek(fontFile *ff, z_off_t offset, int whence) return -1; n -= BUFSIZ; } - if (BZ2_bzread(ff->f.bz2, buf, n) != n) + if (BZ2_bzread(ff->f.bz2, buf, (int) n) != n) return -1; ff->pos = offset; return offset; @@ -247,7 +247,8 @@ pcfIdentify(fontFile *f, char **name) { int prop_position; PropPtr props = NULL; - int format, count, nprops, i, string_size, rc; + int format, count, nprops, i, string_size; + long rc; char *strings = NULL, *s; count = getLSB32(f); diff --git a/mkfontscale.c b/mkfontscale.c index 6423867..4083e28 100644 --- a/mkfontscale.c +++ b/mkfontscale.c @@ -701,7 +701,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) static int readFontScale(HashTablePtr entries, char *dirname) { - int n = strlen(dirname); + size_t n = strlen(dirname); char *filename; FILE *in; int rc, count, i; @@ -745,7 +745,7 @@ readFontScale(HashTablePtr entries, char *dirname) static int filePrio(char *filename) { - int n = strlen(filename); + size_t n = strlen(filename); if(n < 4) return 0; if(strcmp(filename + n - 4, ".otf") == 0) @@ -788,15 +788,16 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo) HashTablePtr entries; HashBucketPtr *array; int i, n, dirn, diri, found, rc; - int isBitmap=0,xl=0; + int isBitmap=0; + size_t d, xl=0; if (exclusionSuffix) xl = strlen (exclusionSuffix); - i = strlen(dirname_given); - if(i == 0) + d = strlen(dirname_given); + if(d == 0) dirname = dsprintf("./"); - else if(dirname_given[i - 1] != '/') + else if(dirname_given[d - 1] != '/') dirname = dsprintf("%s/", dirname_given); else dirname = strdup(dirname_given); @@ -855,7 +856,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo) xlfd = NULL; if (xl) { - int dl = strlen (entry->d_name); + size_t dl = strlen (entry->d_name); if (strcmp (entry->d_name + dl - xl, exclusionSuffix) == 0) continue; } @@ -927,7 +928,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo) if(xlfd_name) { /* We know it's a bitmap font, and we know its XLFD */ - int l = strlen(xlfd_name); + size_t l = strlen(xlfd_name); if(reencodeLegacy && l >= 12 && strcasecmp(xlfd_name + l - 11, "-iso10646-1") == 0) { char *s; |