[2/3] oleaut32: Use strtoull() instead of multiplication during variant conversion
Nikolay Sivov
nsivov at codeweavers.com
Tue Nov 16 19:52:47 CST 2010
On 11/17/2010 02:00, Adam Martinson wrote:
> ---
> dlls/msxml3/tests/domdoc.c | 4 ++--
> dlls/oleaut32/variant.c | 17 +++++++++--------
> 2 files changed, 11 insertions(+), 10 deletions(-)
>
If oleaut32 needs a fix like this, please add a test for it in
oleaut32/tests, fixed msxml tests will be a side effect.
> */
> BOOL bOverflow = FALSE, bNegative;
> ULONG64 ul64 = 0;
You don't need this initialization now.
> + char tmp[1024], *end;
Does this buffer size really make sense if you're getting ULONG64 from
this string?
> int i;
>
> /* Convert the integer part of the number into a UI8 */
> - for (i = 0; i< wholeNumberDigits; i++)
> + for (i = 0; i< wholeNumberDigits; ++i)
> + tmp[i] = rgbDig[i] + '0';
> + tmp[wholeNumberDigits] = 0;
> +
> + ul64 = strtoull(tmp,&end, 10);
> + if (end !=&tmp[wholeNumberDigits])
> {
> - if (ul64> (UI8_MAX / 10 - rgbDig[i]))
> - {
> - TRACE("Overflow multiplying digits\n");
> - bOverflow = TRUE;
> - break;
> - }
> - ul64 = ul64 * 10 + rgbDig[i];
> + TRACE("Overflow reading digits\n");
> + bOverflow = TRUE;
> }
>
More information about the wine-devel
mailing list