GetNumberFormat with negative numbers

Bill Medland billmedland at mercuryspeed.com
Fri Feb 6 15:00:52 CST 2004


Bill Medland (billmedland at mercuryspeed.com)
Correct GetNumberFormat for negative numbers with e.g. 3 leading digits

Index: wine/dlls/kernel/lcformat.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/lcformat.c,v
retrieving revision 1.6
diff -u -r1.6 lcformat.c
--- wine/dlls/kernel/lcformat.c	1 Dec 2003 22:47:28 -0000	1.6
+++ wine/dlls/kernel/lcformat.c	6 Feb 2004 20:56:26 -0000
@@ -1134,7 +1134,7 @@
 
     dwState |= NF_DIGITS_OUT;
     dwCurrentGroupCount++;
-    if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount)
+    if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount && *szSrc != '-')
     {
       LPWSTR lpszGrp = lpFormat->lpThousandSep + strlenW(lpFormat->lpThousandSep) - 1;
 
Index: wine/dlls/kernel/tests/locale.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/locale.c,v
retrieving revision 1.26
diff -u -r1.26 locale.c
--- wine/dlls/kernel/tests/locale.c	6 Feb 2004 05:24:34 -0000	1.26
+++ wine/dlls/kernel/tests/locale.c	6 Feb 2004 20:56:48 -0000
@@ -660,6 +660,10 @@
   ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer));
   EXPECT_VALID; EXPECT_LENA; EXPECT_EQA;
 
+  STRINGSA("-353","-353.00"); /* test for off by one error in grouping */
+  ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer));
+  EXPECT_VALID; EXPECT_LENA; EXPECT_EQA;
+
   STRINGSA("2353.1","2,353.10"); /* Valid real number */
   ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer));
   EXPECT_VALID; EXPECT_LENA; EXPECT_EQA;





More information about the wine-patches mailing list