oleaut32: be more explicit with locale dependent parsing of dates

André Hentschel nerv at dawncrow.de
Thu Apr 8 09:33:03 CDT 2010


I underestimated the differences between locales in my previos patches on this.
---
 dlls/oleaut32/tests/vartype.c |    4 ++++
 dlls/oleaut32/vartype.c       |    4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c
index d785a59..5732b80 100644
--- a/dlls/oleaut32/tests/vartype.c
+++ b/dlls/oleaut32/tests/vartype.c
@@ -3436,10 +3436,14 @@ static void test_VarDateFromStr(void)
   /* Native fails "1999 January 3, 9AM". I consider that a bug in native */
 
   /* test a non-english data string */
+  DFS("02.01.1970"); EXPECT_MISMATCH;
   DFS("02.01.1970 00:00:00"); EXPECT_MISMATCH;
   lcid = MAKELCID(MAKELANGID(LANG_GERMAN,SUBLANG_GERMAN),SORT_DEFAULT);
   DFS("02.01.1970"); EXPECT_DBL(25570.0);
   DFS("02.01.1970 00:00:00"); EXPECT_DBL(25570.0);
+  lcid = MAKELCID(MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH),SORT_DEFAULT);
+  DFS("02.01.1970"); EXPECT_MISMATCH;
+  DFS("02.01.1970 00:00:00"); EXPECT_MISMATCH;
 }
 
 static void test_VarDateCopy(void)
diff --git a/dlls/oleaut32/vartype.c b/dlls/oleaut32/vartype.c
index da1288d..dabf073 100644
--- a/dlls/oleaut32/vartype.c
+++ b/dlls/oleaut32/vartype.c
@@ -7607,7 +7607,7 @@ HRESULT WINAPI VarDateFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, DATE* pd
       break;
 
     case 0x3: /* TTT TTTDD TTTDDD */
-      if (iDate && dp.dwCount == 3)
+      if (PRIMARYLANGID(lcid) == LANG_GERMAN && dp.dwCount == 3)
         {
           /* DDD */
           if ((dp.dwFlags[0] & (DP_AM|DP_PM)) || (dp.dwFlags[1] & (DP_AM|DP_PM)) ||
@@ -7708,7 +7708,7 @@ HRESULT WINAPI VarDateFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, DATE* pd
       break;
 
     case 0x1B: /* localized DDDTTT */
-      if (!iDate)
+      if (PRIMARYLANGID(lcid) != LANG_GERMAN)
         {
           hRet = DISP_E_TYPEMISMATCH;
           break;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list