diff options
-rw-r--r-- | include/apr.h.in | 58 | ||||
-rw-r--r-- | include/apr.hnw | 60 | ||||
-rw-r--r-- | include/apr.hw | 58 | ||||
-rw-r--r-- | include/arch/apr_private_common.h | 1 | ||||
-rw-r--r-- | strings/apr_snprintf.c | 8 |
5 files changed, 173 insertions, 12 deletions
diff --git a/include/apr.h.in b/include/apr.h.in index 7d60c489a..9d37d5c3f 100644 --- a/include/apr.h.in +++ b/include/apr.h.in @@ -269,10 +269,10 @@ typedef unsigned char apr_byte_t; typedef @short_value@ apr_int16_t; typedef unsigned @short_value@ apr_uint16_t; - + typedef @int_value@ apr_int32_t; typedef unsigned @int_value@ apr_uint32_t; - + typedef @long_value@ apr_int64_t; typedef unsigned @long_value@ apr_uint64_t; @@ -290,6 +290,60 @@ typedef @socklen_t_value@ apr_socklen_t; @int64_literal@ @uint64_literal@ +#ifdef INT16_MIN +#define APR_INT16_MIN INT16_MIN +#else +#define APR_INT16_MIN (-0x7fff - 1) +#endif + +#ifdef INT16_MAX +#define APR_INT16_MAX INT16_MAX +#else +#define APR_INT16_MAX (0x7fff) +#endif + +#ifdef UINT16_MAX +#define APR_UINT16_MAX UINT16_MAX +#else +#define APR_UINT16_MAX (0xffff) +#endif + +#ifdef INT32_MIN +#define APR_INT32_MIN INT32_MIN +#else +#define APR_INT32_MIN (-0x7fffffff - 1) +#endif + +#ifdef INT32_MAX +#define APR_INT32_MAX INT32_MAX +#else +#define APR_INT32_MAX 0x7fffffff +#endif + +#ifdef UINT32_MAX +#define APR_UINT32_MAX UINT32_MAX +#else +#define APR_UINT32_MAX (0xffffffffU) +#endif + +#ifdef INT64_MIN +#define APR_INT64_MIN INT64_MIN +#else +#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1) +#endif + +#ifdef INT64_MAX +#define APR_INT64_MAX INT64_MAX +#else +#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff) +#endif + +#ifdef UINT64_MAX +#define APR_UINT64_MAX UINT64_MAX +#else +#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff) +#endif + /* Definitions that APR programs need to work properly. */ /** diff --git a/include/apr.hnw b/include/apr.hnw index 2af98b378..5722e956b 100644 --- a/include/apr.hnw +++ b/include/apr.hnw @@ -236,11 +236,11 @@ typedef unsigned char apr_byte_t; typedef short apr_int16_t; typedef unsigned short apr_uint16_t; - + typedef int apr_int32_t; typedef unsigned int apr_uint32_t; - -typedef long long apr_int64_t; + +typedef long long apr_int64_t; typedef unsigned long long apr_uint64_t; typedef size_t apr_size_t; @@ -270,6 +270,60 @@ typedef size_t apr_socklen_t; #define APR_INT64_C(val) (val##LL) #define APR_UINT64_C(val) (val##ULL) +#ifdef INT16_MIN +#define APR_INT16_MIN INT16_MIN +#else +#define APR_INT16_MIN (-0x7fff - 1) +#endif + +#ifdef INT16_MAX +#define APR_INT16_MAX INT16_MAX +#else +#define APR_INT16_MAX (0x7fff) +#endif + +#ifdef UINT16_MAX +#define APR_UINT16_MAX UINT16_MAX +#else +#define APR_UINT16_MAX (0xffff) +#endif + +#ifdef INT32_MIN +#define APR_INT32_MIN INT32_MIN +#else +#define APR_INT32_MIN (-0x7fffffff - 1) +#endif + +#ifdef INT32_MAX +#define APR_INT32_MAX INT32_MAX +#else +#define APR_INT32_MAX 0x7fffffff +#endif + +#ifdef UINT32_MAX +#define APR_UINT32_MAX UINT32_MAX +#else +#define APR_UINT32_MAX (0xffffffffU) +#endif + +#ifdef INT64_MIN +#define APR_INT64_MIN INT64_MIN +#else +#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1) +#endif + +#ifdef INT64_MAX +#define APR_INT64_MAX INT64_MAX +#else +#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff) +#endif + +#ifdef UINT64_MAX +#define APR_UINT64_MAX UINT64_MAX +#else +#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff) +#endif + /* PROC mutex is a GLOBAL mutex on Netware */ #define APR_PROC_MUTEX_IS_GLOBAL 1 diff --git a/include/apr.hw b/include/apr.hw index d00686e6c..8883c13b2 100644 --- a/include/apr.hw +++ b/include/apr.hw @@ -326,10 +326,10 @@ typedef unsigned char apr_byte_t; typedef short apr_int16_t; typedef unsigned short apr_uint16_t; - + typedef int apr_int32_t; typedef unsigned int apr_uint32_t; - + typedef __int64 apr_int64_t; typedef unsigned __int64 apr_uint64_t; @@ -375,6 +375,60 @@ typedef int gid_t; #define APR_UINT64_C(val) (val##ULL) #endif +#ifdef INT16_MIN +#define APR_INT16_MIN INT16_MIN +#else +#define APR_INT16_MIN (-0x7fff - 1) +#endif + +#ifdef INT16_MAX +#define APR_INT16_MAX INT16_MAX +#else +#define APR_INT16_MAX (0x7fff) +#endif + +#ifdef UINT16_MAX +#define APR_UINT16_MAX UINT16_MAX +#else +#define APR_UINT16_MAX (0xffff) +#endif + +#ifdef INT32_MIN +#define APR_INT32_MIN INT32_MIN +#else +#define APR_INT32_MIN (-0x7fffffff - 1) +#endif + +#ifdef INT32_MAX +#define APR_INT32_MAX INT32_MAX +#else +#define APR_INT32_MAX 0x7fffffff +#endif + +#ifdef UINT32_MAX +#define APR_UINT32_MAX UINT32_MAX +#else +#define APR_UINT32_MAX (0xffffffffU) +#endif + +#ifdef INT64_MIN +#define APR_INT64_MIN INT64_MIN +#else +#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1) +#endif + +#ifdef INT64_MAX +#define APR_INT64_MAX INT64_MAX +#else +#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff) +#endif + +#ifdef UINT64_MAX +#define APR_UINT64_MAX UINT64_MAX +#else +#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff) +#endif + #if APR_HAVE_IPV6 /* Appears in later flavors, not the originals. */ diff --git a/include/arch/apr_private_common.h b/include/arch/apr_private_common.h index 9cd52ecf2..ec850c652 100644 --- a/include/arch/apr_private_common.h +++ b/include/arch/apr_private_common.h @@ -37,6 +37,5 @@ apr_status_t apr_filepath_list_merge_impl(char **liststr, /* temporary defines to handle 64bit compile mismatches */ #define APR_INT_TRUNC_CAST int #define APR_UINT32_TRUNC_CAST apr_uint32_t -#define APR_UINT32_MAX 0xFFFFFFFFUL #endif /*APR_PRIVATE_COMMON_H*/ diff --git a/strings/apr_snprintf.c b/strings/apr_snprintf.c index 0213964e4..9ede49e2a 100644 --- a/strings/apr_snprintf.c +++ b/strings/apr_snprintf.c @@ -381,9 +381,9 @@ static char *conv_10_quad(apr_int64_t num, register int is_unsigned, * number against the largest long value it can be. If <=, we * punt to the quicker version. */ - if ((magnitude <= UINT32_MAX && is_unsigned) - || (num <= INT32_MAX && num >= INT32_MIN && !is_unsigned)) - return(conv_10(num, is_unsigned, is_negative, buf_end, len)); + if ((magnitude <= APR_UINT32_MAX && is_unsigned) + || (num <= APR_INT32_MAX && num >= APR_INT32_MIN && !is_unsigned)) + return(conv_10((apr_int32_t)num, is_unsigned, is_negative, buf_end, len)); if (is_unsigned) { *is_negative = FALSE; @@ -640,7 +640,7 @@ static char *conv_p2_quad(apr_uint64_t num, register int nbits, static const char upper_digits[] = "0123456789ABCDEF"; register const char *digits = (format == 'X') ? upper_digits : low_digits; - if (num <= UINT32_MAX) + if (num <= APR_UINT32_MAX) return(conv_p2((apr_uint32_t)num, nbits, format, buf_end, len)); do { |