Francois Gouget : oleaut32: Fix VarParseNumFromStr()'s support for two-character currencies.

Alexandre Julliard julliard at winehq.org
Fri Feb 25 07:30:22 CST 2022


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Jul 20 14:02:23 2021 +0200

oleaut32: Fix VarParseNumFromStr()'s support for two-character currencies.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51452
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 4e34e7513d3fdd590c8d5edff4003efc7ba4b135)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/oleaut32/tests/vartest.c | 7 +++----
 dlls/oleaut32/variant.c       | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index ee21590706c..c2cf93caf6e 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -2153,14 +2153,13 @@ static void test_VarParseNumFromStrMisc(void)
   /* 2 Polish zloty */
   lcid = MAKELCID(MAKELANGID(LANG_POLISH,SUBLANG_POLISH_POLAND),SORT_DEFAULT);
   WCONVERT(L"z\x142\x32", NUMPRS_CURRENCY|NUMPRS_USE_ALL);
-  todo_wine EXPECT(1,NUMPRS_CURRENCY|NUMPRS_USE_ALL,NUMPRS_CURRENCY,3,0,0);
-  todo_wine EXPECT2(2,FAILDIG);
+  EXPECT(1,NUMPRS_CURRENCY|NUMPRS_USE_ALL,NUMPRS_CURRENCY,3,0,0);
+  EXPECT2(2,FAILDIG);
 
   /* Multi-character currencies can be repeated too "zl2zlzl" */
   WCONVERT(L"z\x142\x32z\x142z\x142", NUMPRS_CURRENCY|NUMPRS_USE_ALL);
   todo_wine EXPECT(1,NUMPRS_CURRENCY|NUMPRS_USE_ALL,NUMPRS_CURRENCY,7,0,0);
-  todo_wine EXPECTRGB(0,2);
-  EXPECTRGB(1,FAILDIG);
+  EXPECT2(2,FAILDIG);
 
   lcid = MAKELCID(MAKELANGID(LANG_FRENCH,SUBLANG_FRENCH_SWISS),SORT_DEFAULT);
   WCONVERT(L"3CHF", NUMPRS_CURRENCY|NUMPRS_USE_ALL);
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 36191b6b424..143895bde2f 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -1668,8 +1668,8 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
              (!chars.cCurrencyLocal2 || lpszStr[1] == chars.cCurrencyLocal2))
     {
       pNumprs->dwOutFlags |= NUMPRS_CURRENCY;
-      cchUsed++;
-      lpszStr++;
+      cchUsed += chars.cCurrencyLocal2 ? 2 : 1;
+      lpszStr += chars.cCurrencyLocal2 ? 2 : 1;
       /* Only accept currency characters */
       chars.cDecimalPoint = chars.cCurrencyDecimalPoint;
       chars.cDigitSeparator = chars.cCurrencyDigitSeparator;




More information about the wine-cvs mailing list