From c8dc029d412a0360c70ff0fef9ba908b0d0f6eec Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Thu, 22 Jul 2021 00:03:49 +0200 Subject: [PATCH] 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 Signed-off-by: Alexandre Julliard (cherry picked from commit c2aeb915f4fc05d596aec0ff43f5e5f26569cd21) Signed-off-by: Michael Stefaniuc --- dlls/oleaut32/tests/vartest.c | 4 ++-- dlls/oleaut32/variant.c | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 7aaec0ef80a..7030771c78f 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -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 { diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index f3fa5d64caf..0f00384aeb2 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -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