[PATCH 3/3] oleaut32: Fix VarParseNumFromStr()'s support for trailing thousands separator spaces.
Francois Gouget
fgouget at codeweavers.com
Wed Jul 21 17:03:49 CDT 2021
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 at codeweavers.com>
---
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 47dfbefc081..73df13fe5c9 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -1903,7 +1903,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
{
@@ -2020,7 +2020,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 35e4539c2ef..e4993de75a5 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -1923,7 +1923,22 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
/* 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
--
2.20.1
More information about the wine-devel
mailing list