[PATCH] dlls/oleaut32: Do not skip the first character

David Kahurani k.kahurani at gmail.com
Mon Feb 21 07:40:22 CST 2022


Added a test case too thanks to Fabian Maurer

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52476
Signed-off-by: David Kahurani <k.kahurani at gmail.com>
---
 dlls/oleaut32/tests/vartest.c | 5 +++++
 dlls/oleaut32/variant.c       | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index f25a448..44b2dd8 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -1764,6 +1764,11 @@ static void test_VarParseNumFromStrEn(void)
 
   /** NUMPRS_DECIMAL **/
 
+  /* Decimal with no leading zero */
+  CONVERT(".308", NUMPRS_DECIMAL);
+  EXPECT(3, NUMPRS_DECIMAL, NUMPRS_DECIMAL, 4, 0, -3);
+  EXPECT2(3, 0);
+
   /* With flag, consumes decimal point */
   CONVERT("1.1", NUMPRS_DECIMAL);
   EXPECT(2,NUMPRS_DECIMAL,NUMPRS_DECIMAL,3,0,-1);
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index bf8f041..66bd905 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -1633,7 +1633,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
       /* If we have no digits so far, skip leading zeros */
       if (!pNumprs->cDig)
       {
-        while (lpszStr[1] == '0')
+        while (lpszStr[0] == '0')
         {
           dwState |= B_LEADING_ZERO;
           cchUsed++;
-- 
2.25.1




More information about the wine-devel mailing list