apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r532735 - in /apr/apr/branches/1.2.x: CHANGES strings/apr_snprintf.c test/testfmt.c
Date Thu, 26 Apr 2007 13:16:23 GMT
Author: jorton
Date: Thu Apr 26 06:16:22 2007
New Revision: 532735

URL: http://svn.apache.org/viewvc?view=rev&rev=532735
Log:
Merge r532733 from trunk:

* strings/apr_snprintf.c (conv_10_quad): Fix formatting of unsigned
integers between 2^63 and 2^64 on 32-bit platforms.

* test/testfmt.c (more_int64_fmts): Test an even bigger unsigned
int64.

Submitted by: Wynn Wilkes <wynn bungeelabs.com>
PR: 42250

Modified:
    apr/apr/branches/1.2.x/CHANGES
    apr/apr/branches/1.2.x/strings/apr_snprintf.c
    apr/apr/branches/1.2.x/test/testfmt.c

Modified: apr/apr/branches/1.2.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/CHANGES?view=diff&rev=532735&r1=532734&r2=532735
==============================================================================
--- apr/apr/branches/1.2.x/CHANGES (original)
+++ apr/apr/branches/1.2.x/CHANGES Thu Apr 26 06:16:22 2007
@@ -1,5 +1,9 @@
 Changes for APR 1.2.9
 
+  *) Fix formatting of unsigned integers larger than 2^63 in the
+     vformatter/apr_*printf.  PR 42250.  
+     [Wynn Wilkes <wynn bungeelabs.com>]
+
   *) Fix possible EFAULT failures in apr_socket_sendfile() on 32-bit
      Solaris with LFS enabled.  PR 39463.  [Joe Orton, Joseph Tam
      <tam math.ubc.ca>]

Modified: apr/apr/branches/1.2.x/strings/apr_snprintf.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/strings/apr_snprintf.c?view=diff&rev=532735&r1=532734&r2=532735
==============================================================================
--- apr/apr/branches/1.2.x/strings/apr_snprintf.c (original)
+++ apr/apr/branches/1.2.x/strings/apr_snprintf.c Thu Apr 26 06:16:22 2007
@@ -396,7 +396,7 @@
      * number against the largest long value it can be. If <=, we
      * punt to the quicker version.
      */
-    if ((num <= ULONG_MAX && is_unsigned) 
+    if (((u_widest_int)num <= (u_widest_int)ULONG_MAX && is_unsigned) 
         || (num <= LONG_MAX && num >= LONG_MIN && !is_unsigned))
             return(conv_10( (wide_int)num, is_unsigned, is_negative,
                buf_end, len));

Modified: apr/apr/branches/1.2.x/test/testfmt.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/test/testfmt.c?view=diff&rev=532735&r1=532734&r2=532735
==============================================================================
--- apr/apr/branches/1.2.x/test/testfmt.c (original)
+++ apr/apr/branches/1.2.x/test/testfmt.c Thu Apr 26 06:16:22 2007
@@ -102,7 +102,7 @@
     apr_int64_t i = APR_INT64_C(-42);
     apr_int64_t ibig = APR_INT64_C(-314159265358979323);
     apr_uint64_t ui = APR_UINT64_C(42);
-    apr_uint64_t big = APR_UINT64_C(3141592653589793238);
+    apr_uint64_t big = APR_UINT64_C(10267677267010969076);
 
     apr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, i);
     ABTS_STR_EQUAL(tc, buf, "-42");
@@ -111,7 +111,7 @@
     ABTS_STR_EQUAL(tc, buf, "42");
 
     apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, big);
-    ABTS_STR_EQUAL(tc, buf, "3141592653589793238");
+    ABTS_STR_EQUAL(tc, "10267677267010969076", buf);
 
     apr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, ibig);
     ABTS_STR_EQUAL(tc, buf, "-314159265358979323");



Mime
View raw message