From a301bff134ca55bb6a0e1e2b8d4d2434aadeef91 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 22 Apr 2013 14:04:59 +0000 Subject: [PATCH] nicer on 32bit --- compat/snprintf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compat/snprintf.c b/compat/snprintf.c index 5296fa24..d869ba5e 100644 --- a/compat/snprintf.c +++ b/compat/snprintf.c @@ -39,6 +39,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif /* for test */ /* #define SNPRINTF_TEST 1 */ @@ -425,11 +428,12 @@ print_num_llp(char** at, size_t* left, int* ret, void* value, char buf[PRINT_DEC_BUFSZ]; int negative = 0; int zero = (value == 0); - /* no portable macros to determine sizeof(void*); 64bit is upcast, - * to remove warning here on 32bit systems it would need configure - * assistance to detect include and something like - * if defined(UINTPTR_MAX) && defined(UINT32_MAX) && (UINTPTR_MAX == UINT32MAX) */ +#if defined(UINTPTR_MAX) && defined(UINT32_MAX) && (UINTPTR_MAX == UINT32_MAX) + /* avoid warning about upcast on 32bit systems */ + unsigned long long llvalue = (unsigned long)value; +#else unsigned long long llvalue = (unsigned long long)value; +#endif int len = print_hex_ll(buf, (int)sizeof(buf), llvalue); if(zero) { buf[0]=')'; -- 2.47.3