apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject Re: svn commit: r553679 - /apr/apr/trunk/strings/apr_snprintf.c
Date Fri, 06 Jul 2007 12:09:51 GMT
Joe Orton wrote:
> On Fri, Jul 06, 2007 at 12:46:53AM -0000, Davi Arnaut wrote:
>> Author: davi
>> Date: Thu Jul  5 17:46:53 2007
>> New Revision: 553679
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=553679
>> Log:
>> Convert wide* types to the portable apr types. Conversion table:
>>
>> wide_int        apr_int32_t
>> u_wide_int      apr_uint32_t
>> widest_int      apr_int64_t
>> u_widest_int    apr_uint64_t
>> bool_int        int
> 
> Are these wide_int -> int32_t changes correct?  wide_int was long before 
> and is now always 32-bit.  Also the *INT32_MAX types are from C99 
> stdint.h which might not be present.
> 

Also, as I forgot to mention, there was a change of behavior with the patch:

-    if ((magnitude <= 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));
+    if ((magnitude <= UINT32_MAX && is_unsigned)
+        || (num <= INT32_MAX && num >= INT32_MIN && !is_unsigned))
+            return(conv_10(num, is_unsigned, is_negative, buf_end, ...

On a 64 bits build the conv_10 optimization could be inadvertently used
because ULONG_MAX would be 64-bit large, but since wide_int was `long`
it worked. Now with the behavior fix, conv_10 is only called on values
that really fits on 32 bits.

--
Davi Arnaut


Mime
View raw message