From 0a20abea3ec9742f0982e043e725cdadf0fc493e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 6 Jan 2019 14:26:00 -0800 Subject: 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 --- ident.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ident.c') diff --git a/ident.c b/ident.c index f7fe9e1..bbe1687 100644 --- a/ident.c +++ b/ident.c @@ -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); -- cgit v1.2.3