Peter Schellenbach : oleaut32: Fixed short time & medium time named formats .

Alexandre Julliard julliard at winehq.org
Tue Feb 22 10:36:12 CST 2011


Module: wine
Branch: master
Commit: 4f3b78797db0be5a1a5637513e36b7efe59ad213
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4f3b78797db0be5a1a5637513e36b7efe59ad213

Author: Peter Schellenbach <pjs at asent.com>
Date:   Mon Feb 21 12:15:22 2011 -0800

oleaut32: Fixed short time & medium time named formats.

---

 dlls/oleaut32/tests/varformat.c |   25 +++++++++++++++++++++++++
 dlls/oleaut32/varformat.c       |   10 +++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c
index d83f218..b1fe73f 100644
--- a/dlls/oleaut32/tests/varformat.c
+++ b/dlls/oleaut32/tests/varformat.c
@@ -217,6 +217,14 @@ static const FMTDATERES VarFormat_date_results[] =
   { 40531.0, "ddd", "Sun" }
 };
 
+/* The following tests require that the time separator is a colon (:) */
+static const FMTDATERES VarFormat_namedtime_results[] =
+{
+  { 2.525, "short time", "12:36" },
+  { 2.525, "medium time", "12:36 PM" },
+  { 2.525, "long time", "12:36:00 PM" }
+};
+
 #define VNUMFMT(vt,v) \
   for (i = 0; i < sizeof(VarFormat_results)/sizeof(FMTRES); i++) \
   { \
@@ -301,6 +309,23 @@ static void test_VarFormat(void)
            VarFormat_date_results[i].res);
   }
 
+  /* Named time formats */
+  GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, buff, sizeof(buff)/sizeof(char));
+  if (buff[0] != ':' || buff[1])
+  {
+    skip("Skipping namedtime tests as time separator is '%s'\n", buff);
+  }
+  else
+  {
+    for (i = 0; i < sizeof(VarFormat_namedtime_results)/sizeof(FMTDATERES); i++)
+    {
+      fd = 0;
+      VARFMT(VT_DATE,V_DATE,VarFormat_namedtime_results[i].val,
+             VarFormat_namedtime_results[i].fmt,S_OK,
+             VarFormat_namedtime_results[i].res);
+    }
+  }
+
   /* Strings */
   bstrin = SysAllocString(szTesting);
   VARFMT(VT_BSTR,V_BSTR,bstrin,"",S_OK,"testing");
diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
index 529528b..e21ce96 100644
--- a/dlls/oleaut32/varformat.c
+++ b/dlls/oleaut32/varformat.c
@@ -263,7 +263,7 @@ typedef struct tagFMT_DATE_HEADER
 #define FMT_DATE_HOUR_0     0x1F /* Hours with leading 0 */
 #define FMT_DATE_HOUR_12    0x20 /* Hours with no leading 0, 12 hour clock */
 #define FMT_DATE_HOUR_12_0  0x21 /* Hours with leading 0, 12 hour clock */
-#define FMT_DATE_TIME_UNK2  0x23
+#define FMT_DATE_TIME_UNK2  0x23 /* same as FMT_DATE_HOUR_0, for "short time" format */
 /* FIXME: probably missing some here */
 #define FMT_DATE_AMPM_SYS1  0x2E /* AM/PM as defined by system settings */
 #define FMT_DATE_AMPM_UPPER 0x2F /* Upper-case AM or PM */
@@ -1660,6 +1660,13 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
       pToken += 2;
       break;
 
+    case FMT_GEN_INLINE:
+      pToken += 2;
+      TRACE("copy %s\n", debugstr_a((LPCSTR)pToken));
+      while (*pToken)
+        *pBuff++ = *pToken++;
+      break;
+
     case FMT_DATE_TIME_SEP:
       TRACE("time separator\n");
       localeValue = LOCALE_STIME;
@@ -1836,6 +1843,7 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
       break;
 
     case FMT_DATE_HOUR_0:
+    case FMT_DATE_TIME_UNK2:
       szPrintFmt = szPercentZeroTwo_d;
       dwVal = udate.st.wHour;
       break;




More information about the wine-cvs mailing list