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

Alexandre Julliard julliard at winehq.org
Thu Jul 22 16:28:18 CDT 2021


Module: wine
Branch: master
Commit: c2aeb915f4fc05d596aec0ff43f5e5f26569cd21
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c2aeb915f4fc05d596aec0ff43f5e5f26569cd21

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jul 22 00:03:49 2021 +0200

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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




More information about the wine-cvs mailing list