[Resent] Fix the separator for VarDateFromStr
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Oct 31 14:50:25 CST 2005
Changelog:
wine/dlls/oleaut32/vartype.c:
Check for the language specific date separator
Add test case.
The patch makes TGEB.exe
www.billiger-telefonieren.de/downloads/tgeb_install.php3
leave an endless exception loop and proceed a little more.
Feedback wanted: Is it right to add language specific test
in out test suite? Will the test run crosscompiled on e.g
some asian native windows?
--
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/vartype.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/vartype.c,v
retrieving revision 1.21
diff -u -w -r1.21 vartype.c
--- wine/dlls/oleaut32/vartype.c 26 Oct 2005 13:53:21 -0000 1.21
+++ wine/dlls/oleaut32/vartype.c 31 Oct 2005 20:19:29 -0000
@@ -7034,6 +7034,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;
@@ -7070,6 +7071,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)
{
@@ -7139,20 +7144,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))
{
Index: wine/dlls/oleaut32/tests/vartype.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tests/vartype.c,v
retrieving revision 1.33
diff -u -w -r1.33 vartype.c
--- wine/dlls/oleaut32/tests/vartype.c 27 Oct 2005 12:09:40 -0000 1.33
+++ wine/dlls/oleaut32/tests/vartype.c 31 Oct 2005 20:19:33 -0000
@@ -3419,6 +3419,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)
More information about the wine-patches
mailing list