From 3bc4d05ff753c1b8357455a614bc5d11fffcfc0e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 4 Nov 2023 12:21:16 -0700 Subject: Resolve some -Wsign-conversion warnings from clang Signed-off-by: Alan Coopersmith --- hash.c | 6 +++--- ident.c | 4 ++-- mkfontscale.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hash.c b/hash.c index 5877dc6..6a60896 100644 --- a/hash.c +++ b/hash.c @@ -174,14 +174,14 @@ value_first_cmp(const void *v1, const void *v2) HashBucketPtr * hashArray(HashTablePtr table, int value_first) { - int j; + unsigned int j; int n = hashElements(table); HashBucketPtr *dst = malloc((n + 1) * sizeof(HashBucketPtr)); if (dst == NULL) return NULL; j = 0; - for (int i = 0; i < NUMBUCKETS; i++) { + for (unsigned int i = 0; i < NUMBUCKETS; i++) { while (table[i]) { dst[j++] = table[i]; table[i] = table[i]->next; @@ -198,7 +198,7 @@ hashArray(HashTablePtr table, int value_first) void destroyHashArray(HashBucketPtr *array) { - int i = 0; + unsigned int i = 0; while (array[i]) { free(array[i]->key); diff --git a/ident.c b/ident.c index 4a1d1eb..37cc1e1 100644 --- a/ident.c +++ b/ident.c @@ -392,8 +392,8 @@ bdfend(fontFile *f) { int c; char *buf = NULL; - int bufsize = 0; - int i = 0; + size_t bufsize = 0; + unsigned int i = 0; do { c = fontFileGetc(f); diff --git a/mkfontscale.c b/mkfontscale.c index 79d41bc..f9333ce 100644 --- a/mkfontscale.c +++ b/mkfontscale.c @@ -500,7 +500,7 @@ unsafe(char c) static const char * safe(const char *s) { - int i, len, safe_flag = 1; + unsigned int i, len, safe_flag = 1; char *t; i = 0; @@ -1181,7 +1181,7 @@ checkEncoding(FT_Face face, const char *encoding_name) else koi8 = 0; for (int i = encoding->first; i < encoding->size; i++) { - int c = FontEncRecode(i, mapping); + unsigned int c = FontEncRecode(i, mapping); if (CODE_IGNORED(c) || (koi8 && ((c >= 0x2200 && c < 0x2600) || c == 0x00b2))) { @@ -1270,7 +1270,7 @@ checkExtraEncoding(FT_Face face, const char *encoding_name, int found) /* Export as Unicode if there are at least 15 BMP characters that are not a space or ignored. */ - for (int c = 0x21; c < 0x10000; c++) { + for (unsigned int c = 0x21; c < 0x10000; c++) { if (CODE_IGNORED(c)) continue; if (FT_Get_Char_Index(face, c) > 0) -- cgit v1.2.3