From 949da2db3e9357d8256863475a8c63409a8fc7b9 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 16 Sep 2022 15:58:21 -0700 Subject: Fix -Wsign-compare warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit atom.c: In function ‘MakeAtom’: atom.c:161:65: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (hashTable[h]->hash == hash && hashTable[h]->len == len && ^~ atom.c:172:69: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (hashTable[h]->hash == hash && hashTable[h]->len == len && ^~ atom.c:207:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (reverseMapSize <= a->atom) { ^~ bitmap.c: In function ‘bitmapGetMetrics’: bitmap.c:154:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < *glyphCount; i++) { ^ Signed-off-by: Alan Coopersmith --- atom.c | 12 ++++++------ bitmap.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom.c b/atom.c index 4d2de11..11b4ac1 100644 --- a/atom.c +++ b/atom.c @@ -37,10 +37,10 @@ in this Software without prior written authorization from The Open Group. #include "stubs.h" typedef struct _AtomList { - char *name; - int len; - int hash; - Atom atom; + char *name; + unsigned int len; + int hash; + Atom atom; } AtomListRec, *AtomListPtr; static AtomListPtr *hashTable; @@ -50,7 +50,7 @@ static int hashMask; static int rehash; static AtomListPtr *reverseMap; -static int reverseMapSize; +static size_t reverseMapSize; static Atom lastAtom; static int @@ -113,7 +113,7 @@ static int ResizeReverseMap(void) { AtomListPtr *newMap; - int newMapSize; + size_t newMapSize; if (reverseMapSize == 0) newMapSize = 1000; diff --git a/bitmap.c b/bitmap.c index 5073782..bd2f0a2 100644 --- a/bitmap.c +++ b/bitmap.c @@ -151,7 +151,7 @@ bitmapGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars, CharInfoPtr metrics = bitmapFont->metrics; xCharInfo *ink_metrics = bitmapFont->ink_metrics; - for (int i = 0; i < *glyphCount; i++) { + for (unsigned long i = 0; i < *glyphCount; i++) { if (glyphs[i] != (xCharInfo *) & nonExistantChar) glyphs[i] = ink_metrics + (((CharInfoPtr) glyphs[i]) - metrics); -- cgit v1.2.3