summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2020-08-06 12:44:39 +0900
committerAkira TAGOH <akira@tagoh.org>2020-08-06 13:02:00 +0900
commita53f79b4a283569d45c34e29b24815836be42464 (patch)
tree7e542c69f71e4124aea81c04d7742066ff5de3e2 /src
parenta5fd5dc47126aee7eaea8e1cd88b502948feb3be (diff)
downloadfontconfig-a53f79b4a283569d45c34e29b24815836be42464.tar.gz
Fix build issues regarding formatter for Win32
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/248
Diffstat (limited to 'src')
-rw-r--r--src/fcatomic.h6
-rw-r--r--src/fccache.c6
-rw-r--r--src/fcint.h4
-rw-r--r--src/fcwindows.h2
4 files changed, 15 insertions, 3 deletions
diff --git a/src/fcatomic.h b/src/fcatomic.h
index 657a5f5..ba45b6c 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -61,6 +61,7 @@ static inline void _FCMemoryBarrier (void) {
}
typedef LONG fc_atomic_int_t;
+#define FC_ATOMIC_INT_FORMAT "ld"
#define fc_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
#define fc_atomic_ptr_get(P) (_FCMemoryBarrier (), (void *) *(P))
@@ -73,6 +74,7 @@ typedef LONG fc_atomic_int_t;
#include <AvailabilityMacros.h>
typedef int fc_atomic_int_t;
+#define FC_ATOMIC_INT_FORMAT "d"
#define fc_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
#define fc_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P))
@@ -85,6 +87,7 @@ typedef int fc_atomic_int_t;
#elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
typedef int fc_atomic_int_t;
+#define FC_ATOMIC_INT_FORMAT "d"
#define fc_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))
#define fc_atomic_ptr_get(P) (void *) (__sync_synchronize (), *(P))
@@ -97,6 +100,7 @@ typedef int fc_atomic_int_t;
#include <mbarrier.h>
typedef unsigned int fc_atomic_int_t;
+#define FC_ATOMIC_INT_FORMAT "u"
#define fc_atomic_int_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
#define fc_atomic_ptr_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P))
@@ -107,6 +111,7 @@ typedef unsigned int fc_atomic_int_t;
#define FC_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
typedef volatile int fc_atomic_int_t;
+#define FC_ATOMIC_INT_FORMAT "d"
#define fc_atomic_int_add(AI, V) (((AI) += (V)) - (V))
#define fc_atomic_ptr_get(P) ((void *) *(P))
@@ -116,6 +121,7 @@ typedef volatile int fc_atomic_int_t;
#else /* FC_NO_MT */
typedef int fc_atomic_int_t;
+#define FC_ATOMIC_INT_FORMAT "d"
#define fc_atomic_int_add(AI, V) (((AI) += (V)) - (V))
#define fc_atomic_ptr_get(P) ((void *) *(P))
diff --git a/src/fccache.c b/src/fccache.c
index d10f249..df497c9 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -808,7 +808,7 @@ FcCacheFini (void)
if (fcCacheChains[i] != NULL)
{
FcCacheSkip *s = fcCacheChains[i];
- printf("Fontconfig error: not freed %p (dir: %s, refcount %d)\n", s->cache, FcCacheDir(s->cache), s->ref.count);
+ printf("Fontconfig error: not freed %p (dir: %s, refcount %" FC_ATOMIC_INT_FORMAT ")\n", s->cache, FcCacheDir(s->cache), s->ref.count);
}
}
else
@@ -1157,14 +1157,14 @@ FcDirChecksum (struct stat *statb)
else if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
|| (errno != 0 && epoch == 0))
fprintf (stderr,
- "Fontconfig: SOURCE_DATE_EPOCH: strtoull: %s: %llu\n",
+ "Fontconfig: SOURCE_DATE_EPOCH: strtoull: %s: %" FC_UINT64_FORMAT "\n",
strerror(errno), epoch);
else if (*endptr != '\0')
fprintf (stderr,
"Fontconfig: SOURCE_DATE_EPOCH has trailing garbage\n");
else if (epoch > ULONG_MAX)
fprintf (stderr,
- "Fontconfig: SOURCE_DATE_EPOCH must be <= %lu but saw: %llu\n",
+ "Fontconfig: SOURCE_DATE_EPOCH must be <= %lu but saw: %" FC_UINT64_FORMAT "\n",
ULONG_MAX, epoch);
else if (epoch < ret)
/* Only override if directory is newer */
diff --git a/src/fcint.h b/src/fcint.h
index 11efdba..88e0701 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -84,6 +84,10 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FC_UNUSED
#endif
+#ifndef FC_UINT64_FORMAT
+#define FC_UINT64_FORMAT "llu"
+#endif
+
#define FC_DBG_MATCH 1
#define FC_DBG_MATCHV 2
#define FC_DBG_EDIT 4
diff --git a/src/fcwindows.h b/src/fcwindows.h
index d18e1af..23331f5 100644
--- a/src/fcwindows.h
+++ b/src/fcwindows.h
@@ -51,6 +51,8 @@
typedef SSIZE_T ssize_t;
#endif
+#define FC_UINT64_FORMAT "I64u"
+
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#ifndef S_ISDIR