PATCH: msvcrt.wctime

Marcus Meissner marcus at jet.franken.de
Thu Dec 15 02:22:32 CST 2005


Hi,

Used by Google Earth. If anyone has a better
idea on the static buffer handling please speak up.. ;)

Ciao, Marcus

Changelog:
	Implemented wctime().

Index: dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.109
diff -u -r1.109 msvcrt.spec
--- dlls/msvcrt/msvcrt.spec	21 Nov 2005 13:34:29 -0000	1.109
+++ dlls/msvcrt/msvcrt.spec	15 Dec 2005 08:16:16 -0000
@@ -503,7 +503,7 @@
 @ cdecl _wcsrev(wstr)
 @ cdecl _wcsset(wstr long)
 @ cdecl _wcsupr(wstr) ntdll._wcsupr
-@ stub _wctime #(ptr)
+@ cdecl _wctime(ptr) MSVCRT_wctime
 @ extern _wenviron
 @ stub _wexecl #(wstr wstr) varargs
 @ stub _wexecle #(wstr wstr) varargs
Index: dlls/msvcrt/time.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/time.c,v
retrieving revision 1.25
diff -u -r1.25 time.c
--- dlls/msvcrt/time.c	30 Oct 2005 19:03:58 -0000	1.25
+++ dlls/msvcrt/time.c	15 Dec 2005 08:16:17 -0000
@@ -410,3 +410,25 @@
     lstrcpynA(tzname_dst, tzname[1], sizeof(tzname_dst));
     tzname_dst[sizeof(tzname_dst) - 1] = '\0';
 }
+
+/*********************************************************************
+ *		_wctime (MSVCRT.@)
+ */
+MSVCRT_wchar_t *MSVCRT_wctime(time_t *timet) {
+    static MSVCRT_wchar_t *wctime = NULL;
+    static int wctimelen = 0;
+    char *atime;
+    int newlen;
+
+    atime = ctime(timet);
+    newlen = MultiByteToWideChar( CP_ACP, 0, atime, -1, NULL, 0 );
+    if (newlen*sizeof(WCHAR) > wctimelen) {
+        wctimelen = newlen*sizeof(WCHAR);
+	if (wctime)
+	    wctime = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,wctime,wctimelen);
+        else
+	    wctime = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,wctimelen);
+    }
+    MultiByteToWideChar( CP_ACP, 0, atime, -1, wctime, newlen );
+    return wctime;
+}



More information about the wine-patches mailing list