apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r554692 - in /apr/apr/trunk: include/apr.h.in include/apr.hnw include/apr.hw include/arch/apr_private_common.h strings/apr_snprintf.c
Date Mon, 09 Jul 2007 16:06:00 GMT
Author: davi
Date: Mon Jul  9 09:05:59 2007
New Revision: 554692

URL: http://svn.apache.org/viewvc?view=rev&rev=554692
Log:
Introduce macro definitions of the min/max characteristics of the apr integer
types.

Modified:
    apr/apr/trunk/include/apr.h.in
    apr/apr/trunk/include/apr.hnw
    apr/apr/trunk/include/apr.hw
    apr/apr/trunk/include/arch/apr_private_common.h
    apr/apr/trunk/strings/apr_snprintf.c

Modified: apr/apr/trunk/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.h.in?view=diff&rev=554692&r1=554691&r2=554692
==============================================================================
--- apr/apr/trunk/include/apr.h.in (original)
+++ apr/apr/trunk/include/apr.h.in Mon Jul  9 09:05:59 2007
@@ -269,10 +269,10 @@
 
 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;
 
@@ -289,6 +289,60 @@
 /* Mechanisms to properly type numeric literals */
 @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. */
 

Modified: apr/apr/trunk/include/apr.hnw
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.hnw?view=diff&rev=554692&r1=554691&r2=554692
==============================================================================
--- apr/apr/trunk/include/apr.hnw (original)
+++ apr/apr/trunk/include/apr.hnw Mon Jul  9 09:05:59 2007
@@ -236,11 +236,11 @@
 
 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;
@@ -269,6 +269,60 @@
 /* Mechanisms to properly type numeric literals */
 #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

Modified: apr/apr/trunk/include/apr.hw
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.hw?view=diff&rev=554692&r1=554691&r2=554692
==============================================================================
--- apr/apr/trunk/include/apr.hw (original)
+++ apr/apr/trunk/include/apr.hw Mon Jul  9 09:05:59 2007
@@ -326,10 +326,10 @@
 
 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;
 
@@ -373,6 +373,60 @@
 #else
 #define APR_INT64_C(val) (val##LL)
 #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

Modified: apr/apr/trunk/include/arch/apr_private_common.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/apr_private_common.h?view=diff&rev=554692&r1=554691&r2=554692
==============================================================================
--- apr/apr/trunk/include/arch/apr_private_common.h (original)
+++ apr/apr/trunk/include/arch/apr_private_common.h Mon Jul  9 09:05:59 2007
@@ -37,6 +37,5 @@
 /* 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*/

Modified: apr/apr/trunk/strings/apr_snprintf.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/strings/apr_snprintf.c?view=diff&rev=554692&r1=554691&r2=554692
==============================================================================
--- apr/apr/trunk/strings/apr_snprintf.c (original)
+++ apr/apr/trunk/strings/apr_snprintf.c Mon Jul  9 09:05:59 2007
@@ -381,9 +381,9 @@
      * 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 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 {



Mime
View raw message