From dd69d96e06b16c37bb87817edd40f6e4040f35ae Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 29 Dec 2012 22:47:49 -0500 Subject: [PATCH] Fix sign-compare warnings --- src/fccache.c | 6 +++--- src/fcfreetype.c | 6 +++--- src/fcint.h | 4 ++-- src/fclang.c | 6 +++--- src/fcname.c | 6 +++--- src/fcxml.c | 4 ++-- src/ftglue.c | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/fccache.c b/src/fccache.c index 3828b61..aace6b3 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -527,7 +527,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat) FcCache *cache; FcBool allocated = FcFalse; - if (fd_stat->st_size < sizeof (FcCache)) + if (fd_stat->st_size < (int) sizeof (FcCache)) return NULL; cache = FcCacheFindByStat (fd_stat); if (cache) @@ -582,7 +582,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat) } if (cache->magic != FC_CACHE_MAGIC_MMAP || cache->version < FC_CACHE_CONTENT_VERSION || - cache->size != fd_stat->st_size || + cache->size != (intptr_t) fd_stat->st_size || !FcCacheTimeValid (cache, dir_stat) || !FcCacheInsert (cache, fd_stat)) { @@ -842,7 +842,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) FcChar8 *test_dir; FcCacheSkip *skip; struct stat cache_stat; - int magic; + unsigned int magic; int written; /* diff --git a/src/fcfreetype.c b/src/fcfreetype.c index f4dfb80..9ac2fa9 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1117,8 +1117,8 @@ FcFreeTypeQueryFace (const FT_Face face, int nstyle_lang = 0; int nfullname = 0; int nfullname_lang = 0; - int p, platform; - int n, nameid; + unsigned int p, n; + int platform, nameid; FcChar8 *style = 0; int st; @@ -1199,7 +1199,7 @@ FcFreeTypeQueryFace (const FT_Face face, } else { - int sp; + unsigned int sp; for (sp = 0; sp < NUM_PLATFORM_ORDER; sp++) if (sname.platform_id == platform_order[sp]) diff --git a/src/fcint.h b/src/fcint.h index 2cb7805..8b5a104 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -358,7 +358,7 @@ typedef struct _FcStrBuf { } FcStrBuf; struct _FcCache { - int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */ + unsigned int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */ int version; /* FC_CACHE_CONTENT_VERSION */ intptr_t size; /* size of file */ intptr_t dir; /* offset to dir name */ @@ -451,7 +451,7 @@ typedef struct _FcCaseFold { #define FC_CACHE_MAGIC_MMAP 0xFC02FC04 #define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 -#define FC_CACHE_CONTENT_VERSION 3 /* also check FC_CACHE_VERSION */ +#define FC_CACHE_CONTENT_VERSION 3 struct _FcAtomic { FcChar8 *file; /* original file name */ diff --git a/src/fclang.c b/src/fclang.c index 65d22a9..57183fd 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -51,7 +51,7 @@ static void FcLangSetBitSet (FcLangSet *ls, unsigned int id) { - int bucket; + unsigned int bucket; id = fcLangCharSetIndices[id]; bucket = id >> 5; @@ -65,7 +65,7 @@ static FcBool FcLangSetBitGet (const FcLangSet *ls, unsigned int id) { - int bucket; + unsigned int bucket; id = fcLangCharSetIndices[id]; bucket = id >> 5; @@ -79,7 +79,7 @@ static void FcLangSetBitReset (FcLangSet *ls, unsigned int id) { - int bucket; + unsigned int bucket; id = fcLangCharSetIndices[id]; bucket = id >> 5; diff --git a/src/fcname.c b/src/fcname.c index 0ad508b..5540b6f 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -307,7 +307,7 @@ FcObjectValidType (FcObject object, FcType type) return FcTrue; break; default: - if (t->type == -1 || type == t->type) + if (t->type == (unsigned int) -1 || type == t->type) return FcTrue; break; } @@ -343,7 +343,7 @@ FcObjectGetSet (void) FcBool FcObjectInit (void) { - int i; + unsigned int i; if (FcObjectsInited) return FcTrue; @@ -371,7 +371,7 @@ FcObjectFini (void) FcObjectBuckets[i] = 0; } for (i = 0; i < FcObjectsNumber; i++) - if (FcObjects[i].type == -1) + if (FcObjects[i].type == (unsigned int) -1) free ((void*) FcObjects[i].object); if (FcObjects != _FcBaseObjectTypes) free (FcObjects); diff --git a/src/fcxml.c b/src/fcxml.c index 3e2a42b..3ae6b7a 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -508,9 +508,9 @@ typedef struct _FcConfigParse { const FcChar8 *name; FcConfig *config; XML_Parser parser; - int pstack_static_used; + unsigned int pstack_static_used; FcPStack pstack_static[8]; - int vstack_static_used; + unsigned int vstack_static_used; FcVStack vstack_static[64]; } FcConfigParse; diff --git a/src/ftglue.c b/src/ftglue.c index 7c643d0..ac5f121 100644 --- a/src/ftglue.c +++ b/src/ftglue.c @@ -87,7 +87,7 @@ ftglue_stream_seek( FT_Stream stream, if ( stream->read( stream, pos, 0, 0 ) ) error = FT_Err_Invalid_Stream_Operation; } - else if ( pos > stream->size ) + else if ( pos < 0 || (FT_ULong) pos > stream->size ) error = FT_Err_Invalid_Stream_Operation; if ( !error )