Fix the separator for VarDateFromStr

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sat Oct 22 13:12:26 CDT 2005


Changelog:
	wine/dlls/oleaut32/vartype.c:
	Check for the language specific date separator
	Add test case.

Is it right to add language specific test in out test suite? Will the test
run crosscompiled on e.g some asian native windows?

The patch makes TGEB.exe 
www.billiger-telefonieren.de/downloads/tgeb_install.php3 
leave an endless exception loop and proceed a little more.

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/oleaut32/tests/vartype.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tests/vartype.c,v
retrieving revision 1.32
diff -u -r1.32 vartype.c
--- wine/dlls/oleaut32/tests/vartype.c	12 Sep 2005 22:07:53 -0000	1.32
+++ wine/dlls/oleaut32/tests/vartype.c	22 Oct 2005 17:48:33 -0000
@@ -3412,6 +3412,16 @@
   DFS("1/2/1970");        EXPECT_DBL(25570.0);
   DFS("1-2-1970");        EXPECT_DBL(25570.0);
   /* Native fails "1999 January 3, 9AM". I consider that a bug in native */
+
+  /* some tests for the german locale */
+  lcid = MAKELCID(MAKELANGID(LANG_GERMAN,SUBLANG_GERMAN),SORT_DEFAULT);
+  DFS("1.2.1970");        EXPECT_DBL(25600.0);
+  /* Unusual format in German locale, but accepted by native oleaut32*/
+  DFS("1-2-1970");        EXPECT_DBL(25600.0);
+  DFS("01.02.1970");      EXPECT_DBL(25600.0);
+  DFS("1. Februar 1970"); EXPECT_DBL(25600.0);
+  DFS("1. Feb. 1970");    EXPECT_DBL(25600.0);
+
 }
 
 static void test_VarDateCopy(void)
Index: wine/dlls/oleaut32/vartype.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/vartype.c,v
retrieving revision 1.18
diff -u -r1.18 vartype.c
--- wine/dlls/oleaut32/vartype.c	22 Sep 2005 10:49:01 -0000	1.18
+++ wine/dlls/oleaut32/vartype.c	22 Oct 2005 17:48:44 -0000
@@ -6372,6 +6372,7 @@
   };
   size_t i;
   BSTR tokens[sizeof(ParseDateTokens)/sizeof(ParseDateTokens[0])];
+  WCHAR date_sep[2];
   DATEPARSE dp;
   DWORD dwDateSeps = 0, iDate = 0;
   HRESULT hRet = S_OK;
@@ -6408,6 +6409,10 @@
     TRACE("token %d is %s\n", i, debugstr_w(tokens[i]));
   }
 
+  GetLocaleInfoW(lcid, LOCALE_SDATE| (dwFlags & LOCALE_NOUSEROVERRIDE),
+                 date_sep, 2);
+  TRACE("Date_Sep %s\n", debugstr_w(date_sep));
+
   /* Parse the string into our structure */
   while (*strIn)
   {
@@ -6477,20 +6482,23 @@
         }
       }
     }
-    else if (*strIn == ':' ||  *strIn == '.')
+    /* Also not normaly used in Germany (lcid 0407), the '-' seems to be 
+       accepted by native oleaut32 as date separator. People in other
+       languages should check too*/
+    else if (*strIn == '-' || *strIn == date_sep[0])
     {
-      if (!dp.dwCount || !strIn[1])
+      dwDateSeps++;
+      if (dwDateSeps > 2 || !dp.dwCount || !strIn[1])
         hRet = DISP_E_TYPEMISMATCH;
       else
-        dp.dwFlags[dp.dwCount - 1] |= DP_TIMESEP;
+        dp.dwFlags[dp.dwCount - 1] |= DP_DATESEP;
     }
-    else if (*strIn == '-' || *strIn == '/')
+    else if (*strIn == ':' ||  *strIn == '.')
     {
-      dwDateSeps++;
-      if (dwDateSeps > 2 || !dp.dwCount || !strIn[1])
+      if (!dp.dwCount || !strIn[1])
         hRet = DISP_E_TYPEMISMATCH;
       else
-        dp.dwFlags[dp.dwCount - 1] |= DP_DATESEP;
+        dp.dwFlags[dp.dwCount - 1] |= DP_TIMESEP;
     }
     else if (*strIn == ',' || isspaceW(*strIn))
     {



More information about the wine-patches mailing list