Module: wine Branch: master Commit: ac26d786c4845e3fba688c8b52ca70f281084dc2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ac26d786c4845e3fba688c8b52...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Tue Sep 28 03:47:56 2010 -0500
msvcrt: Convert the Unix asctime string from CP_UNIXCP to CP_ACP.
---
dlls/msvcrt/time.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 54bbd74..df31593 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -756,6 +756,9 @@ MSVCRT_size_t CDECL MSVCRT_wcsftime( MSVCRT_wchar_t *str, MSVCRT_size_t max, */ char * CDECL MSVCRT_asctime(const struct MSVCRT_tm *mstm) { + char bufferA[30]; + WCHAR bufferW[30]; + thread_data_t *data = msvcrt_get_thread_data(); struct tm tm;
@@ -764,12 +767,13 @@ char * CDECL MSVCRT_asctime(const struct MSVCRT_tm *mstm) if (!data->asctime_buffer) data->asctime_buffer = MSVCRT_malloc( 30 ); /* ought to be enough */
- /* FIXME: may want to map from Unix codepage to CP_ACP */ #ifdef HAVE_ASCTIME_R - asctime_r( &tm, data->asctime_buffer ); + asctime_r( &tm, bufferA ); #else - strcpy( data->asctime_buffer, asctime(&tm) ); + strcpy( bufferA, asctime(&tm) ); #endif + MultiByteToWideChar( CP_UNIXCP, 0, bufferA, -1, bufferW, 30 ); + WideCharToMultiByte( CP_ACP, 0, bufferW, -1, data->asctime_buffer, 30, NULL, NULL ); return data->asctime_buffer; }