PATCH: wctime / wasctime
Marcus Meissner
marcus at jet.franken.de
Tue Dec 20 16:19:53 CST 2005
Hi,
This implements wctime() and wasctime(), using thread area
data for the static buffers.
Ciao, Marcus
Changelog:
Implemented wctime() and wasctime().
Index: dlls/msvcrt/msvcrt.h
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.h,v
retrieving revision 1.41
diff -u -r1.41 msvcrt.h
--- dlls/msvcrt/msvcrt.h 12 Dec 2005 12:50:40 -0000 1.41
+++ dlls/msvcrt/msvcrt.h 20 Dec 2005 22:18:23 -0000
@@ -88,6 +88,8 @@
MSVCRT_unexpected_function unexpected_handler;
MSVCRT__se_translator_function se_translator;
EXCEPTION_RECORD *exc_record;
+ MSVCRT_wchar_t *wctime_buffer; /* buffer for ctime */
+ MSVCRT_wchar_t *wasctime_buffer; /* buffer for asctime */
};
typedef struct __thread_data thread_data_t;
Index: dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.110
diff -u -r1.110 msvcrt.spec
--- dlls/msvcrt/msvcrt.spec 16 Dec 2005 13:41:49 -0000 1.110
+++ dlls/msvcrt/msvcrt.spec 20 Dec 2005 22:18:23 -0000
@@ -487,7 +487,7 @@
@ cdecl _vsnprintf(ptr long ptr ptr) MSVCRT_vsnprintf
@ cdecl _vsnwprintf(ptr long wstr long) MSVCRT_vsnwprintf
@ cdecl _waccess(wstr long)
-@ stub _wasctime #(ptr) MSVCRT__wasctime
+@ cdecl _wasctime(ptr) MSVCRT__wasctime
@ cdecl _wchdir(wstr)
@ cdecl _wchmod(wstr long)
@ extern _wcmdln MSVCRT__wcmdln
@@ -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 20 Dec 2005 22:18:23 -0000
@@ -410,3 +410,39 @@
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) {
+ thread_data_t *data = msvcrt_get_thread_data();
+
+ if (!data->wctime_buffer)
+ data->wctime_buffer = MSVCRT_malloc( 30*sizeof(MSVCRT_wchar_t) ); /* ought to be enough */
+ MultiByteToWideChar( CP_ACP, 0, ctime(timet), -1, data->wctime_buffer, 30 );
+ return data->wctime_buffer;
+}
+
+/*********************************************************************
+ * _wctime (MSVCRT.@)
+ */
+MSVCRT_wchar_t *MSVCRT__wasctime(const struct MSVCRT_tm *mstm) {
+ thread_data_t *data = msvcrt_get_thread_data();
+ struct tm xtm;
+
+ memset(&xtm,0,sizeof(xtm));
+ xtm.tm_sec = mstm->tm_sec;
+ xtm.tm_min = mstm->tm_min;
+ xtm.tm_hour = mstm->tm_hour;
+ xtm.tm_mday = mstm->tm_mday;
+ xtm.tm_mon = mstm->tm_mon;
+ xtm.tm_year = mstm->tm_year;
+ xtm.tm_wday = mstm->tm_wday;
+ xtm.tm_yday = mstm->tm_yday;
+ xtm.tm_isdst = mstm->tm_isdst;
+
+ if (!data->wasctime_buffer)
+ data->wasctime_buffer = MSVCRT_malloc( 30*sizeof(MSVCRT_wchar_t) ); /* ought to be enough */
+ MultiByteToWideChar( CP_ACP, 0, asctime(&xtm), -1, data->wasctime_buffer, 30 );
+ return data->wasctime_buffer;
+}
More information about the wine-patches
mailing list