[Fontconfig] fontconfig: Branch 'master' - 3 commits

Akira TAGOH tagoh at kemper.freedesktop.org
Wed Jun 26 21:16:51 PDT 2013


 configure.ac |   29 +++++++++++++++++++++++++++++
 src/fchash.c |   20 ++++++++++----------
 src/fcname.c |    2 +-
 src/fcstat.c |   10 ++++++++++
 4 files changed, 50 insertions(+), 11 deletions(-)

New commits:
commit 38ab7ab2fbd83c0c62e4b78302b5fe89da0cb79e
Author: Akira TAGOH <akira at tagoh.org>
Date:   Thu Jun 27 13:10:27 2013 +0900

    Fix a incompatible pointer warning on NetBSD

diff --git a/configure.ac b/configure.ac
index 0f129db..a2b1c72 100644
--- a/configure.ac
+++ b/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/src/fcstat.c b/src/fcstat.c
index 390f45c..ab56aca 100644
--- a/src/fcstat.c
+++ b/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)
commit 8603e5869505ff06d443b8b22d5357d4caaaac24
Author: Akira TAGOH <akira at tagoh.org>
Date:   Thu Jun 27 12:30:56 2013 +0900

    Fix a shift count overflow on 32bit box

diff --git a/src/fchash.c b/src/fchash.c
index 92585a6..7216bee 100644
--- a/src/fchash.c
+++ b/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 */
commit 9acc14c34a372b54f9075ec3611588298fb2a501
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Jun 26 12:03:38 2013 +0900

    Fix a comparison of constant warning with clang

diff --git a/src/fcname.c b/src/fcname.c
index a525345..8d02da7 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -86,7 +86,7 @@ FcObjectValidType (FcObject object, FcType type)
 		return FcTrue;
 	    break;
 	default:
-	    if (t->type == (unsigned int) -1 || type == t->type)
+	    if ((unsigned int) t->type == (unsigned int) -1 || type == t->type)
 		return FcTrue;
 	    break;
 	}


More information about the Fontconfig mailing list