summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2017-09-13 03:27:03 -0400
committerBehdad Esfahbod <behdad@behdad.org>2017-09-20 13:13:35 -0700
commita4bd5b7c7a06fe39d1461f9be098af37d364dcc2 (patch)
treeb26e8809c2df9d80806942781b2492ab922785db
parent819d3a5541b3903bda5d1299d48a6760379cac72 (diff)
[varfonts] Change id argument in FcFreeTypeQuery* to unsigned int
Going to use the top bit to query varfonts.
-rw-r--r--fc-query/fc-query.c6
-rw-r--r--fontconfig/fcfreetype.h2
-rw-r--r--fontconfig/fontconfig.h4
-rw-r--r--src/fcfreetype.c20
4 files changed, 16 insertions, 16 deletions
diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c
index a5b2cda7..2d2825a6 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 753fdf9d..20b11286 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 c61c5020..56091ac6 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 66afdf51..caca5d99 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;