You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2007/04/26 15:10:36 UTC
svn commit: r532733 - in /apr/apr/trunk: strings/apr_snprintf.c
test/testfmt.c
Author: jorton
Date: Thu Apr 26 06:10:34 2007
New Revision: 532733
URL: http://svn.apache.org/viewvc?view=rev&rev=532733
Log:
* 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/trunk/strings/apr_snprintf.c
apr/apr/trunk/test/testfmt.c
Modified: apr/apr/trunk/strings/apr_snprintf.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/strings/apr_snprintf.c?view=diff&rev=532733&r1=532732&r2=532733
==============================================================================
--- apr/apr/trunk/strings/apr_snprintf.c (original)
+++ apr/apr/trunk/strings/apr_snprintf.c Thu Apr 26 06:10:34 2007
@@ -397,7 +397,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/trunk/test/testfmt.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testfmt.c?view=diff&rev=532733&r1=532732&r2=532733
==============================================================================
--- apr/apr/trunk/test/testfmt.c (original)
+++ apr/apr/trunk/test/testfmt.c Thu Apr 26 06:10:34 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");