From: Wouter Wijngaards Date: Mon, 22 Apr 2013 14:04:59 +0000 (+0000) Subject: nicer on 32bit X-Git-Tag: release-1.6.17rc1~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a301bff134ca55bb6a0e1e2b8d4d2434aadeef91;p=thirdparty%2Fldns.git nicer on 32bit --- 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]=')';