diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c index a5b2cda..2d2825a 100644 --- a/fc-query/fc-query.c +++ b/fc-query/fc-query.c @@ -98,7 +98,7 @@ usage (char *program, int error) int main (int argc, char **argv) { - int id = -1; + unsigned int id = (unsigned int) -1; int ignore_blanks = 0; FcFontSet *fs; FcChar8 *format = NULL; @@ -119,7 +119,7 @@ main (int argc, char **argv) ignore_blanks = 1; break; case 'i': - id = atoi (optarg); + id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */ break; case 'f': format = (FcChar8 *) strdup (optarg); @@ -150,7 +150,7 @@ main (int argc, char **argv) { if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, blanks, NULL, fs)) { - fprintf (stderr, "Can't query face %d of font file %s\n", id, argv[i]); + fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]); err = 1; } } diff --git a/fontconfig/fcfreetype.h b/fontconfig/fcfreetype.h index 753fdf9..20b1128 100644 --- a/fontconfig/fcfreetype.h +++ b/fontconfig/fcfreetype.h @@ -51,7 +51,7 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f); FcPublic FcPattern * FcFreeTypeQueryFace (const FT_Face face, const FcChar8 *file, - int id, + unsigned int id, FcBlanks *blanks); _FCFUNCPROTOEND diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index c61c502..56091ac 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -577,10 +577,10 @@ FcDirCacheUnload (FcCache *cache); /* fcfreetype.c */ FcPublic FcPattern * -FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count); +FcFreeTypeQuery (const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count); FcPublic unsigned int -FcFreeTypeQueryAll(const FcChar8 *file, int id, FcBlanks *blanks, int *count, FcFontSet *set); +FcFreeTypeQueryAll(const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count, FcFontSet *set); /* fcfs.c */ diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 66afdf5..caca5d9 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1157,7 +1157,7 @@ static const FT_UShort nameid_order[] = { FcPattern * FcFreeTypeQueryFace (const FT_Face face, const FcChar8 *file, - int id, + unsigned int id, FcBlanks *blanks FC_UNUSED) { FcPattern *pat; @@ -1972,7 +1972,7 @@ bail0: FcPattern * FcFreeTypeQuery(const FcChar8 *file, - int id, + unsigned int id, FcBlanks *blanks, int *count) { @@ -1999,20 +1999,20 @@ bail: unsigned int FcFreeTypeQueryAll(const FcChar8 *file, - int id, + unsigned int id, FcBlanks *blanks, int *count, FcFontSet *set) { FT_Face face; FT_Library ftLibrary = NULL; - int index_set = id != -1; - int set_face_num = index_set ? id & 0xFFFF : 0; - int set_instance_num = index_set ? id >> 16 : 0; - int face_num = set_face_num; - int instance_num = set_instance_num; - int num_faces = 0; - int num_instances = 0; + FcBool index_set = id != (unsigned int) -1; + unsigned int set_face_num = index_set ? id & 0xFFFF : 0; + unsigned int set_instance_num = index_set ? id >> 16 : 0; + unsigned int face_num = set_face_num; + unsigned int instance_num = set_instance_num; + unsigned int num_faces = 0; + unsigned int num_instances = 0; unsigned int ret = 0; int err = 0;