aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/configure.ac29
-rw-r--r--fontconfig/fontconfig/fcprivate.h3
-rw-r--r--fontconfig/fontconfig/fontconfig.h1
-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
13 files changed, 77 insertions, 18 deletions
diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac
index 0f129db0d..a2b1c72f4 100644
--- a/fontconfig/configure.ac
+++ b/fontconfig/configure.ac
@@ -161,6 +161,35 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_POSIX_FADVISE], [1], [Define to 1 if you have the 'posix_fadvise' function.])
],[AC_MSG_RESULT([no])])
+AC_MSG_CHECKING([for scandir])
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #include <dirent.h>
+ int comp(const struct dirent **, const struct dirent **);
+ int comp(const struct dirent **a, const struct dirent **b) { return 0; }
+ int main(void) {
+ struct dirent **d;
+ return scandir(".", &d, 0, &comp) >= 0;
+ }
+ ]])],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_SCANDIR], [1], [Define to 1 if you have the 'scandir' function.])
+ ],[
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #include <dirent.h>
+ int comp(const void *, const void *);
+ int comp(const void *a, const void *b) { return 0; }
+ int main(void) {
+ struct dirent **d;
+ return scandir(".", &d, 0, &comp) >= 0;
+ }
+ ]])],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_SCANDIR_VOID_P], [1], [Define to 1 if you have the 'scandir' function with int (* compar)(const void *, const void *)])
+ ],[
+ AC_MSG_ERROR([
+*** No scandir function available.])
+ ])
+ ])
CFLAGS="$fc_saved_CFLAGS"
#
diff --git a/fontconfig/fontconfig/fcprivate.h b/fontconfig/fontconfig/fcprivate.h
index 18b8c08ca..210c1d8a3 100644
--- a/fontconfig/fontconfig/fcprivate.h
+++ b/fontconfig/fontconfig/fcprivate.h
@@ -48,8 +48,9 @@
__o__ = va_arg (va, const char *); \
if (!__o__) \
break; \
- __v__.type = va_arg (va, FcType); \
+ __v__.type = va_arg (va, int); \
switch (__v__.type) { \
+ case FcTypeUnknown: \
case FcTypeVoid: \
goto _FcPatternVapBuild_bail1; \
case FcTypeInteger: \
diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h
index 422187b3c..39d1b1b9c 100644
--- a/fontconfig/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig/fontconfig.h
@@ -185,6 +185,7 @@ typedef int FcBool;
#define FC_LCD_LEGACY 3
typedef enum _FcType {
+ FcTypeUnknown = -1,
FcTypeVoid,
FcTypeInteger,
FcTypeDouble,
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 9e84aa490..0263a0082 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 dba58eaeb..0f2123f38 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));