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;
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;
/*

View File

@ -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])

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 )