Commit a53f79b4 authored by Akira TAGOH's avatar Akira TAGOH
Browse files

Fix build issues regarding formatter for Win32

Fixes fontconfig/fontconfig#248
parent a5fd5dc4
Pipeline #186882 passed with stage
in 7 minutes and 24 seconds
......@@ -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))
......
......@@ -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 */
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment