aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig/src')
-rw-r--r--fontconfig/src/fccfg.c4
-rw-r--r--fontconfig/src/fcdbg.c7
-rw-r--r--fontconfig/src/fchash.c20
-rw-r--r--fontconfig/src/fcint.h6
-rw-r--r--fontconfig/src/fclist.c1
-rw-r--r--fontconfig/src/fcname.c5
-rw-r--r--fontconfig/src/fcobjs.c2
-rw-r--r--fontconfig/src/fcpat.c5
-rw-r--r--fontconfig/src/fcstat.c10
-rw-r--r--fontconfig/src/fcxml.c2
10 files changed, 45 insertions, 17 deletions
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index fcdf73efe..9c0be24a3 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -721,7 +721,7 @@ FcConfigPromote (FcValue v, FcValue u, FcValuePromotionBuffer *buf)
FcBool
FcConfigCompareValue (const FcValue *left_o,
- FcOp op_,
+ unsigned int op_,
const FcValue *right_o)
{
FcValue left = FcValueCanonicalize(left_o);
@@ -736,6 +736,8 @@ FcConfigCompareValue (const FcValue *left_o,
if (left.type == right.type)
{
switch (left.type) {
+ case FcTypeUnknown:
+ break; /* No way to guess how to compare for this object */
case FcTypeInteger:
break; /* FcConfigPromote prevents this from happening */
case FcTypeDouble:
diff --git a/fontconfig/src/fcdbg.c b/fontconfig/src/fcdbg.c
index 9d02f5ac7..ce642140c 100644
--- a/fontconfig/src/fcdbg.c
+++ b/fontconfig/src/fcdbg.c
@@ -30,6 +30,9 @@ static void
_FcValuePrintFile (FILE *f, const FcValue v)
{
switch (v.type) {
+ case FcTypeUnknown:
+ fprintf (f, "<unknown>");
+ break;
case FcTypeVoid:
fprintf (f, "<void>");
break;
@@ -98,6 +101,10 @@ FcValueBindingPrint (const FcValueListPtr l)
case FcValueBindingSame:
printf ("(=)");
break;
+ default:
+ /* shouldn't be reached */
+ printf ("(?)");
+ break;
}
}
diff --git a/fontconfig/src/fchash.c b/fontconfig/src/fchash.c
index 92585a632..7216beead 100644
--- a/fontconfig/src/fchash.c
+++ b/fontconfig/src/fchash.c
@@ -190,14 +190,14 @@ FcHashGetSHA256Digest (const FcChar8 *input_strings,
}
/* set input size at the end */
len *= 8;
- block[63 - 0] = len & 0xff;
- block[63 - 1] = (len >> 8) & 0xff;
- block[63 - 2] = (len >> 16) & 0xff;
- block[63 - 3] = (len >> 24) & 0xff;
- block[63 - 4] = (len >> 32) & 0xff;
- block[63 - 5] = (len >> 40) & 0xff;
- block[63 - 6] = (len >> 48) & 0xff;
- block[63 - 7] = (len >> 56) & 0xff;
+ block[63 - 0] = (uint64_t)len & 0xff;
+ block[63 - 1] = ((uint64_t)len >> 8) & 0xff;
+ block[63 - 2] = ((uint64_t)len >> 16) & 0xff;
+ block[63 - 3] = ((uint64_t)len >> 24) & 0xff;
+ block[63 - 4] = ((uint64_t)len >> 32) & 0xff;
+ block[63 - 5] = ((uint64_t)len >> 40) & 0xff;
+ block[63 - 6] = ((uint64_t)len >> 48) & 0xff;
+ block[63 - 7] = ((uint64_t)len >> 56) & 0xff;
FcHashComputeSHA256Digest (ret, block);
return FcHashSHA256ToString (ret);
@@ -226,7 +226,7 @@ FcHashGetSHA256DigestFromFile (const FcChar8 *filename)
{
if ((len = fread (ibuf, sizeof (char), 64, fp)) < 64)
{
- long v;
+ uint64_t v;
/* add a padding */
memset (&ibuf[len], 0, 64 - len);
@@ -281,7 +281,7 @@ FcHashGetSHA256DigestFromMemory (const char *fontdata,
{
if ((length - i) < 64)
{
- long v;
+ uint64_t v;
size_t n;
/* add a padding */
diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h
index 65bf3330b..0137deeb4 100644
--- a/fontconfig/src/fcint.h
+++ b/fontconfig/src/fcint.h
@@ -107,7 +107,9 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
typedef enum _FcValueBinding {
- FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
+ FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
+ /* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
+ FcValueBindingEnd = 0xffffffff
} FcValueBinding;
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
@@ -623,7 +625,7 @@ FcConfigSetFonts (FcConfig *config,
FcPrivate FcBool
FcConfigCompareValue (const FcValue *m,
- FcOp op,
+ unsigned int op_,
const FcValue *v);
FcPrivate FcBool
diff --git a/fontconfig/src/fclist.c b/fontconfig/src/fclist.c
index b7ae899cd..c56e24c7b 100644
--- a/fontconfig/src/fclist.c
+++ b/fontconfig/src/fclist.c
@@ -252,6 +252,7 @@ FcListValueHash (FcValue *value)
{
FcValue v = FcValueCanonicalize(value);
switch (v.type) {
+ case FcTypeUnknown:
case FcTypeVoid:
return 0;
case FcTypeInteger:
diff --git a/fontconfig/src/fcname.c b/fontconfig/src/fcname.c
index a52534548..712b2fad3 100644
--- a/fontconfig/src/fcname.c
+++ b/fontconfig/src/fcname.c
@@ -76,6 +76,8 @@ FcObjectValidType (FcObject object, FcType type)
if (t) {
switch ((int) t->type) {
+ case FcTypeUnknown:
+ return FcTrue;
case FcTypeDouble:
case FcTypeInteger:
if (type == FcTypeDouble || type == FcTypeInteger)
@@ -86,7 +88,7 @@ FcObjectValidType (FcObject object, FcType type)
return FcTrue;
break;
default:
- if (t->type == (unsigned int) -1 || type == t->type)
+ if (type == t->type)
return FcTrue;
break;
}
@@ -474,6 +476,7 @@ FcNameUnparseValue (FcStrBuf *buf,
FcValue v = FcValueCanonicalize(v0);
switch (v.type) {
+ case FcTypeUnknown:
case FcTypeVoid:
return FcTrue;
case FcTypeInteger:
diff --git a/fontconfig/src/fcobjs.c b/fontconfig/src/fcobjs.c
index 146ca70d0..1d3af73be 100644
--- a/fontconfig/src/fcobjs.c
+++ b/fontconfig/src/fcobjs.c
@@ -63,7 +63,7 @@ retry:
return NULL;
ot->object.object = (const char *) FcStrdup (str);
- ot->object.type = -1;
+ ot->object.type = FcTypeUnknown;
ot->id = fc_atomic_int_add (next_id, +1);
ot->next = ots;
diff --git a/fontconfig/src/fcpat.c b/fontconfig/src/fcpat.c
index 25bff6456..0614ac2c2 100644
--- a/fontconfig/src/fcpat.c
+++ b/fontconfig/src/fcpat.c
@@ -246,6 +246,8 @@ FcValueEqual (FcValue va, FcValue vb)
return FcFalse;
}
switch (va.type) {
+ case FcTypeUnknown:
+ return FcFalse; /* don't know how to compare this object */
case FcTypeVoid:
return FcTrue;
case FcTypeInteger:
@@ -294,6 +296,7 @@ static FcChar32
FcValueHash (const FcValue *v)
{
switch (v->type) {
+ case FcTypeUnknown:
case FcTypeVoid:
return 0;
case FcTypeInteger:
@@ -317,7 +320,7 @@ FcValueHash (const FcValue *v)
case FcTypeLangSet:
return FcLangSetHash (FcValueLangSet(v));
}
- return FcFalse;
+ return 0;
}
static FcBool
diff --git a/fontconfig/src/fcstat.c b/fontconfig/src/fcstat.c
index 390f45c37..ab56aca66 100644
--- a/fontconfig/src/fcstat.c
+++ b/fontconfig/src/fcstat.c
@@ -164,11 +164,21 @@ FcDirChecksumScandirFilter(const struct dirent *entry)
}
#endif
+#ifdef HAVE_SCANDIR
static int
FcDirChecksumScandirSorter(const struct dirent **lhs, const struct dirent **rhs)
{
return strcmp((*lhs)->d_name, (*rhs)->d_name);
}
+#elif HAVE_SCANDIR_VOID_P
+static int
+FcDirChecksumScandirSorter(const void *a, const void *b)
+{
+ const struct dirent *lhs = a, *rhs = b;
+
+ return strcmp(lhs->d_name, rhs->d_name);
+}
+#endif
static int
FcDirChecksum (const FcChar8 *dir, time_t *checksum)
diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c
index 470e44fac..7e0323064 100644
--- a/fontconfig/src/fcxml.c
+++ b/fontconfig/src/fcxml.c
@@ -705,7 +705,7 @@ FcTestCreate (FcConfigParse *parse,
FcMatchKind kind,
FcQual qual,
const FcChar8 *field,
- FcOp compare,
+ unsigned int compare,
FcExpr *expr)
{
FcTest *test = (FcTest *) malloc (sizeof (FcTest));