From 7e7bdc19e76a5f87bccf7a84872f8d45295ee5b7 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Thu, 5 Aug 2021 20:10:07 +0100 Subject: Define PRIuSIZE to avoid issues compiling with msvcrt On windows and when cross compiling with mingw the standard library only supports C89 which means that print format arguments cannot take "%zu". To fix this, a PRIuSIZE macros is needed which expands to PRIu32 on windows 32 bit and PRIu64 on windows 64 bit. --- pack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pack.c') diff --git a/pack.c b/pack.c index 4dc6c3a..a287448 100644 --- a/pack.c +++ b/pack.c @@ -25,7 +25,7 @@ enum pack_status pack(void *buf_, size_t size, const char *fmt, ...) size_t offset = 0; va_list ap; - tr_call("pack(%p, %zu, %s, ...)", (void *)buf, size, fmt); + tr_call("pack(%p, %" PRIuSIZE ", %s, ...)", (void *)buf, size, fmt); va_start(ap, fmt); @@ -54,7 +54,7 @@ enum pack_status pack(void *buf_, size_t size, const char *fmt, ...) tr_debug("i: %d, fmt[i]: %c, sign: %ssigned", i, fmt[i], sign ? "" : "un"); s = getsize(fmt[i]); - tr_debug("s: %zu", s); + tr_debug("s: %" PRIuSIZE, s); if (s == (size_t)-1) return PACK_FMTINVAL; if (size - offset < s) return PACK_TOOSMALL; -- cgit v1.2.3-54-g00ecf