Fix sign-compare warnings

This commit is contained in:
Behdad Esfahbod 2012-12-29 22:47:49 -05:00
parent 4ad3a73691
commit dd69d96e06
7 changed files with 17 additions and 17 deletions

View File

@ -527,7 +527,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
FcCache *cache; FcCache *cache;
FcBool allocated = FcFalse; FcBool allocated = FcFalse;
if (fd_stat->st_size < sizeof (FcCache)) if (fd_stat->st_size < (int) sizeof (FcCache))
return NULL; return NULL;
cache = FcCacheFindByStat (fd_stat); cache = FcCacheFindByStat (fd_stat);
if (cache) if (cache)
@ -582,7 +582,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
} }
if (cache->magic != FC_CACHE_MAGIC_MMAP || if (cache->magic != FC_CACHE_MAGIC_MMAP ||
cache->version < FC_CACHE_CONTENT_VERSION || cache->version < FC_CACHE_CONTENT_VERSION ||
cache->size != fd_stat->st_size || cache->size != (intptr_t) fd_stat->st_size ||
!FcCacheTimeValid (cache, dir_stat) || !FcCacheTimeValid (cache, dir_stat) ||
!FcCacheInsert (cache, fd_stat)) !FcCacheInsert (cache, fd_stat))
{ {
@ -842,7 +842,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
FcChar8 *test_dir; FcChar8 *test_dir;
FcCacheSkip *skip; FcCacheSkip *skip;
struct stat cache_stat; struct stat cache_stat;
int magic; unsigned int magic;
int written; int written;
/* /*

View File

@ -1117,8 +1117,8 @@ FcFreeTypeQueryFace (const FT_Face face,
int nstyle_lang = 0; int nstyle_lang = 0;
int nfullname = 0; int nfullname = 0;
int nfullname_lang = 0; int nfullname_lang = 0;
int p, platform; unsigned int p, n;
int n, nameid; int platform, nameid;
FcChar8 *style = 0; FcChar8 *style = 0;
int st; int st;
@ -1199,7 +1199,7 @@ FcFreeTypeQueryFace (const FT_Face face,
} }
else else
{ {
int sp; unsigned int sp;
for (sp = 0; sp < NUM_PLATFORM_ORDER; sp++) for (sp = 0; sp < NUM_PLATFORM_ORDER; sp++)
if (sname.platform_id == platform_order[sp]) if (sname.platform_id == platform_order[sp])

View File

@ -358,7 +358,7 @@ typedef struct _FcStrBuf {
} FcStrBuf; } FcStrBuf;
struct _FcCache { 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 */ int version; /* FC_CACHE_CONTENT_VERSION */
intptr_t size; /* size of file */ intptr_t size; /* size of file */
intptr_t dir; /* offset to dir name */ intptr_t dir; /* offset to dir name */
@ -451,7 +451,7 @@ typedef struct _FcCaseFold {
#define FC_CACHE_MAGIC_MMAP 0xFC02FC04 #define FC_CACHE_MAGIC_MMAP 0xFC02FC04
#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 #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 { struct _FcAtomic {
FcChar8 *file; /* original file name */ FcChar8 *file; /* original file name */

View File

@ -51,7 +51,7 @@ static void
FcLangSetBitSet (FcLangSet *ls, FcLangSetBitSet (FcLangSet *ls,
unsigned int id) unsigned int id)
{ {
int bucket; unsigned int bucket;
id = fcLangCharSetIndices[id]; id = fcLangCharSetIndices[id];
bucket = id >> 5; bucket = id >> 5;
@ -65,7 +65,7 @@ static FcBool
FcLangSetBitGet (const FcLangSet *ls, FcLangSetBitGet (const FcLangSet *ls,
unsigned int id) unsigned int id)
{ {
int bucket; unsigned int bucket;
id = fcLangCharSetIndices[id]; id = fcLangCharSetIndices[id];
bucket = id >> 5; bucket = id >> 5;
@ -79,7 +79,7 @@ static void
FcLangSetBitReset (FcLangSet *ls, FcLangSetBitReset (FcLangSet *ls,
unsigned int id) unsigned int id)
{ {
int bucket; unsigned int bucket;
id = fcLangCharSetIndices[id]; id = fcLangCharSetIndices[id];
bucket = id >> 5; bucket = id >> 5;

View File

@ -307,7 +307,7 @@ FcObjectValidType (FcObject object, FcType type)
return FcTrue; return FcTrue;
break; break;
default: default:
if (t->type == -1 || type == t->type) if (t->type == (unsigned int) -1 || type == t->type)
return FcTrue; return FcTrue;
break; break;
} }
@ -343,7 +343,7 @@ FcObjectGetSet (void)
FcBool FcBool
FcObjectInit (void) FcObjectInit (void)
{ {
int i; unsigned int i;
if (FcObjectsInited) if (FcObjectsInited)
return FcTrue; return FcTrue;
@ -371,7 +371,7 @@ FcObjectFini (void)
FcObjectBuckets[i] = 0; FcObjectBuckets[i] = 0;
} }
for (i = 0; i < FcObjectsNumber; i++) for (i = 0; i < FcObjectsNumber; i++)
if (FcObjects[i].type == -1) if (FcObjects[i].type == (unsigned int) -1)
free ((void*) FcObjects[i].object); free ((void*) FcObjects[i].object);
if (FcObjects != _FcBaseObjectTypes) if (FcObjects != _FcBaseObjectTypes)
free (FcObjects); free (FcObjects);

View File

@ -508,9 +508,9 @@ typedef struct _FcConfigParse {
const FcChar8 *name; const FcChar8 *name;
FcConfig *config; FcConfig *config;
XML_Parser parser; XML_Parser parser;
int pstack_static_used; unsigned int pstack_static_used;
FcPStack pstack_static[8]; FcPStack pstack_static[8];
int vstack_static_used; unsigned int vstack_static_used;
FcVStack vstack_static[64]; FcVStack vstack_static[64];
} FcConfigParse; } FcConfigParse;

View File

@ -87,7 +87,7 @@ ftglue_stream_seek( FT_Stream stream,
if ( stream->read( stream, pos, 0, 0 ) ) if ( stream->read( stream, pos, 0, 0 ) )
error = FT_Err_Invalid_Stream_Operation; 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; error = FT_Err_Invalid_Stream_Operation;
if ( !error ) if ( !error )