oleaut32: Ignore underflows in VarR8FromStr.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-11-07 16:22:57 +01:00 committed by Alexandre Julliard
parent 61c18632b8
commit 409bafcc73
3 changed files with 10 additions and 4 deletions

View file

@ -1947,6 +1947,11 @@ static void test_VarNumFromParseNum(void)
/* Currency is preferred over decimal */
SETRGB(0, 1); CONVERT(1,0,0,1,0,0, VTBIT_CY|VTBIT_DECIMAL); EXPECT_CY(1);
/* Underflow test */
SETRGB(0, 1); CONVERT(1,0,NUMPRS_EXPONENT,1,0,-94938484, VTBIT_R4); EXPECT_R4(0.0);
SETRGB(0, 1); CONVERT(1,0,NUMPRS_EXPONENT,1,0,-94938484, VTBIT_R8); EXPECT_R8(0.0);
SETRGB(0, 1); CONVERT(1,0,NUMPRS_EXPONENT,1,0,-94938484, VTBIT_CY); EXPECT_CY(0);
}

View file

@ -2729,6 +2729,7 @@ static void test_VarR8FromStr(void)
CONVERT_STR(VarR8FromStr,"0.5",LOCALE_NOUSEROVERRIDE); EXPECT(0.5);
CONVERT_STR(VarR8FromStr,"0.6",LOCALE_NOUSEROVERRIDE); EXPECT(0.6);
CONVERT_STR(VarR8FromStr,"1.5",LOCALE_NOUSEROVERRIDE); EXPECT(1.5);
CONVERT_STR(VarR8FromStr,"1e-94938484",LOCALE_NOUSEROVERRIDE); EXPECT(0);
/* We already have exhaustive tests for number parsing, so skip those tests here */
}

View file

@ -2392,8 +2392,8 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
{
if (whole < dblMinimums[10] && whole != 0)
{
dwVtBits &= ~(VTBIT_R4|VTBIT_R8|VTBIT_CY); /* Underflow */
bOverflow = TRUE;
whole = 0; /* ignore underflow */
divisor10 = 0;
break;
}
whole = whole / dblMultipliers[10];
@ -2403,8 +2403,8 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
{
if (whole < dblMinimums[divisor10] && whole != 0)
{
dwVtBits &= ~(VTBIT_R4|VTBIT_R8|VTBIT_CY); /* Underflow */
bOverflow = TRUE;
whole = 0; /* ignore underflow */
divisor10 = 0;
}
else
whole = whole / dblMultipliers[divisor10];