oleaut32: Fix VarParseNumFromStr()'s support for trailing thousands separator spaces.

If a trailing character is a thousands separator, VarParseNumFromStr()
only processes it if NUMPRS_THOUSANDS was specified; even if that
character is also a space and NUMPRS_TRAILING_WHITE was specified.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit c2aeb915f4)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Francois Gouget 2021-07-22 00:03:49 +02:00 committed by Michael Stefaniuc
parent 014c114a28
commit c8dc029d41
2 changed files with 18 additions and 3 deletions

View File

@ -1902,7 +1902,7 @@ static void test_VarParseNumFromStrFr(void)
if (spaces[i] == ' ' || spaces[i] == 0xa0 /* non-breaking space */)
{
/* Spaces aliased to the thousands separator are never allowed! */
todo_wine EXPECTFAIL;
EXPECTFAIL;
}
else
{
@ -2019,7 +2019,7 @@ static void test_VarParseNumFromStrFr(void)
if (spaces[i] == ' ' || spaces[i] == 0xa0 /* non-breaking space */)
{
/* Spaces aliased to thousands separator are never allowed! */
todo_wine EXPECTFAIL;
EXPECTFAIL;
}
else
{

View File

@ -1922,7 +1922,22 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
/* Consume any trailing symbols and space */
while (1)
{
if ((pNumprs->dwInFlags & NUMPRS_TRAILING_WHITE) && iswspace(*lpszStr))
if ((chars.cDigitSeparator && *lpszStr == chars.cDigitSeparator) ||
(cDigitSeparator2 && *lpszStr == cDigitSeparator2))
{
if (pNumprs->dwInFlags & NUMPRS_THOUSANDS)
{
pNumprs->dwOutFlags |= NUMPRS_THOUSANDS;
cchUsed++;
lpszStr++;
}
else
{
/* Not allowed, even with NUMPRS_TRAILING_WHITE */
break;
}
}
else if ((pNumprs->dwInFlags & NUMPRS_TRAILING_WHITE) && iswspace(*lpszStr))
{
pNumprs->dwOutFlags |= NUMPRS_TRAILING_WHITE;
do