PATCH: VARFORMAT_FormatDate fixes

Marcus Meissner marcus at jet.franken.de
Fri Nov 4 03:57:25 CST 2005


Hi,

Obvious fixes for VARIANT_FormatDate. It could never have worked
before, since pbstrOut is off limits, date and pDate were always NULL.

Reference app now no longer crashes here.

Ciao, Marcus

Changelog:
	Fixed FMT_DATE_GENERAL and FMT_DATE_TIME_SYS cases in
	VARIANT_FormatDate.

Index: dlls/oleaut32/varformat.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/varformat.c,v
retrieving revision 1.14
diff -u -p -r1.14 varformat.c
--- dlls/oleaut32/varformat.c	26 Aug 2005 08:53:32 -0000	1.14
+++ dlls/oleaut32/varformat.c	4 Nov 2005 09:50:04 -0000
@@ -1598,10 +1598,11 @@ static HRESULT VARIANT_FormatDate(LPVARI
     case FMT_DATE_GENERAL:
       {
         BSTR date = NULL;
-        WCHAR *pDate = date;
-        hRes = VarBstrFromDate(V_DATE(&vDate), lcid, 0, pbstrOut);
+        WCHAR *pDate;
+        hRes = VarBstrFromDate(V_DATE(&vDate), lcid, 0, &date);
         if (FAILED(hRes))
           goto VARIANT_FormatDate_Exit;
+	pDate = date;
         while (*pDate)
           *pBuff++ = *pDate++;
         SysFreeString(date);
@@ -1623,10 +1624,11 @@ static HRESULT VARIANT_FormatDate(LPVARI
       {
         /* FIXME: VARIANT_CALENDAR HIJRI should cause Hijri output */
         BSTR date = NULL;
-        WCHAR *pDate = date;
-        hRes = VarBstrFromDate(V_DATE(&vDate), lcid, VAR_TIMEVALUEONLY, pbstrOut);
+        WCHAR *pDate;
+        hRes = VarBstrFromDate(V_DATE(&vDate), lcid, VAR_TIMEVALUEONLY, &date);
         if (FAILED(hRes))
           goto VARIANT_FormatDate_Exit;
+	pDate = date;
         while (*pDate)
           *pBuff++ = *pDate++;
         SysFreeString(date);



More information about the wine-patches mailing list