oleaut32: Fix handling of hexadecimal/octal numbers in VarParseNumFromStr().

They are incompatible with decimal numbers and currencies.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2021-08-10 05:12:54 +02:00 committed by Alexandre Julliard
parent b63195d595
commit 2e302e8d8c
2 changed files with 4 additions and 7 deletions

View File

@ -1654,12 +1654,10 @@ static void test_VarParseNumFromStrEn(void)
/* With flag, currency amounts cannot be in hexadecimal */
CONVERT("$&ha", NUMPRS_HEX_OCT|NUMPRS_CURRENCY);
todo_wine EXPECTFAIL;
EXPECTFAIL;
CONVERT("&ha$", NUMPRS_HEX_OCT|NUMPRS_CURRENCY);
if (broken(1)) /* FIXME Reenable once Wine is less broken */
EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_CURRENCY,NUMPRS_HEX_OCT,3,4,0);
todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags);
EXPECTRGB(0,10);
EXPECTRGB(1,FAILDIG);
@ -1797,9 +1795,7 @@ static void test_VarParseNumFromStrEn(void)
/* With flag, incompatible with NUMPRS_HEX_OCT */
CONVERT("&o1e1", NUMPRS_HEX_OCT|NUMPRS_EXPONENT);
if (broken(1)) /* FIXME Reenable once Wine is less broken */
EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_EXPONENT,NUMPRS_HEX_OCT,3,3,0);
todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags);
EXPECT2(1,FAILDIG);
/* With flag, even if it sort of looks like an exponent */

View File

@ -1709,7 +1709,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
break;
}
if (!(pNumprs->dwOutFlags & NUMPRS_DECIMAL))
if (!(pNumprs->dwOutFlags & (NUMPRS_CURRENCY|NUMPRS_DECIMAL)))
{
if ((*lpszStr == '&' && (*(lpszStr+1) == 'H' || *(lpszStr+1) == 'h')) &&
pNumprs->dwInFlags & NUMPRS_HEX_OCT)
@ -1858,7 +1858,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
}
else if ((*lpszStr == 'e' || *lpszStr == 'E') &&
pNumprs->dwInFlags & NUMPRS_EXPONENT &&
!(pNumprs->dwOutFlags & NUMPRS_EXPONENT))
!(pNumprs->dwOutFlags & (NUMPRS_HEX_OCT|NUMPRS_CURRENCY|NUMPRS_EXPONENT)))
{
dwState |= B_PROCESSING_EXPONENT;
pNumprs->dwOutFlags |= NUMPRS_EXPONENT;
@ -2006,6 +2006,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
pNumprs->dwOutFlags |= NUMPRS_NEG;
}
else if (pNumprs->dwInFlags & NUMPRS_CURRENCY &&
!(pNumprs->dwOutFlags & NUMPRS_HEX_OCT) &&
wcsncmp(lpszStr, chars.sCurrency, chars.sCurrencyLen) == 0)
{
pNumprs->dwOutFlags |= NUMPRS_CURRENCY;