]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
nicer compile on 32bit.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 22 Apr 2013 14:04:03 +0000 (14:04 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 22 Apr 2013 14:04:03 +0000 (14:04 +0000)
git-svn-id: file:///svn/unbound/trunk@2891 be551aaa-1e26-0410-a405-d3ace91eadb9

compat/snprintf.c

index 4114a70188093b8af9480379ee6d4e603e9c6b01..65959309c9cc93ca4e0dfddf2d09e9e492fdf531 100644 (file)
@@ -39,6 +39,9 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <errno.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#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 <stdint.h> 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]=')';