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

Akira TAGOH tagoh at kemper.freedesktop.org
Thu Jan 4 11:40:10 UTC 2018


 src/fccfg.c          |    6 +++---
 src/fccompat.c       |   19 +++++++++++++++++++
 src/fcdir.c          |    4 ++++
 src/fcfreetype.c     |    4 ++--
 src/fcint.h          |    5 +++++
 test/test-bz131804.c |    1 -
 6 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit 3642d71724e7c40f44753c1f2e6d8fb2c88a3e50
Author: Akira TAGOH <akira at tagoh.org>
Date:   Thu Jan 4 20:23:16 2018 +0900

    Add FcReadLink to wrap up readlink impl.

diff --git a/src/fccfg.c b/src/fccfg.c
index a55bcef..2351ac2 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2218,7 +2218,7 @@ FcConfigRealFilename (FcConfig		*config,
 
     if (n)
     {
-	char buf[PATH_MAX];
+	FcChar8 buf[PATH_MAX];
 	ssize_t len;
 
 	if (sysroot)
@@ -2227,7 +2227,7 @@ FcConfigRealFilename (FcConfig		*config,
 	    nn = FcStrdup (n);
 	FcStrFree (n);
 
-	if ((len = readlink ((const char *) nn, buf, sizeof (buf) - 1)) != -1)
+	if ((len = FcReadLink (nn, buf, sizeof (buf) - 1)) != -1)
 	{
 	    buf[len] = 0;
 	    FcStrFree (nn);
diff --git a/src/fccompat.c b/src/fccompat.c
index 31d80be..16f108d 100644
--- a/src/fccompat.c
+++ b/src/fccompat.c
@@ -37,6 +37,9 @@
 #if HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -256,6 +259,22 @@ FcMakeDirectory (const FcChar8 *dir)
     return ret;
 }
 
+ssize_t
+FcReadLink (const FcChar8 *pathname,
+	    FcChar8       *buf,
+	    size_t         bufsiz)
+{
+#ifdef HAVE_READLINK
+    return readlink ((const char *) pathname, (char *)buf, bufsiz);
+#else
+    /* XXX: this function is only used for FcConfigRealFilename() so far
+     * and returning -1 as an error still just works.
+     */
+    errno = ENOSYS;
+    return -1;
+#endif
+}
+
 #define __fccompat__
 #include "fcaliastail.h"
 #undef __fccompat__
diff --git a/src/fcint.h b/src/fcint.h
index 6185f5a..537023f 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -822,6 +822,11 @@ FcRandom (void);
 FcPrivate FcBool
 FcMakeDirectory (const FcChar8 *dir);
 
+FcPrivate ssize_t
+FcReadLink (const FcChar8 *pathname,
+	    FcChar8       *buf,
+	    size_t         bufsiz);
+
 /* fcdbg.c */
 
 FcPrivate void
commit 767e3aa7c50c2a707b42d9eda879b1046558bb6f
Author: Akira TAGOH <akira at tagoh.org>
Date:   Thu Jan 4 20:32:46 2018 +0900

    Fix compiler warnings

diff --git a/src/fccfg.c b/src/fccfg.c
index 9844017..a55bcef 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -47,7 +47,7 @@ retry_locale:
     {
 	is_locale_initialized = FcTrue;
 	if (!fc_atomic_ptr_cmpexch (&static_is_locale_initialized, NULL,
-				    (void *)(long) is_locale_initialized))
+				    (void *)(intptr_t) is_locale_initialized))
 	    goto retry_locale;
 	setlocale (LC_ALL, "");
     }
diff --git a/src/fcdir.c b/src/fcdir.c
index d6be0be..bfcdf95 100644
--- a/src/fcdir.c
+++ b/src/fcdir.c
@@ -289,7 +289,9 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
     struct stat		dir_stat;
     const FcChar8	*sysroot = FcConfigGetSysRoot (config);
     FcChar8		*d;
+#ifndef _WIN32
     int			fd = -1;
+#endif
 
     if (sysroot)
 	d = FcStrBuildFilename (sysroot, dir, NULL);
@@ -353,7 +355,9 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
     FcStrSet *dirs;
     const FcChar8 *sysroot = FcConfigGetSysRoot (config);
     FcChar8 *d = NULL;
+#ifndef _WIN32
     int fd = -1;
+#endif
 
     cache = FcDirCacheLoad (dir, config, NULL);
     if (!cache)
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index da2dc3f..4af96b8 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -1767,7 +1767,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face  face,
 	{
 	    weight = FcIsWeight ((FcChar8 *) psfontinfo.weight);
     	    if (FcDebug() & FC_DBG_SCANV)
-    		printf ("\tType1 weight %s maps to %d\n",
+		printf ("\tType1 weight %s maps to %g\n",
 			psfontinfo.weight, weight);
 	}
 
@@ -1845,7 +1845,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face  face,
 	{
 	    weight = FcContainsWeight (style);
 	    if (FcDebug() & FC_DBG_SCANV)
-		printf ("\tStyle %s maps to weight %d\n", style, weight);
+		printf ("\tStyle %s maps to weight %g\n", style, weight);
 	}
 	if (width == -1)
 	{
diff --git a/test/test-bz131804.c b/test/test-bz131804.c
index f89756b..99f87e9 100644
--- a/test/test-bz131804.c
+++ b/test/test-bz131804.c
@@ -46,7 +46,6 @@ comp(const FcChar8 *l1, const FcChar8 *l2)
 int
 main(void)
 {
-    FcLangResult result;
     int i = 1;
 
     /* 1 */


More information about the Fontconfig mailing list