Alexandre Julliard : msvcrt: Implementation of wcsftime (
based on a patch by Mike McCormack).
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 23 13:50:24 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 7fe881c7f2712e2e0d39342450470a94855782d3
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=7fe881c7f2712e2e0d39342450470a94855782d3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Mar 23 20:35:52 2006 +0100
msvcrt: Implementation of wcsftime (based on a patch by Mike McCormack).
---
dlls/msvcrt/time.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index 819f905..ba1be48 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -445,10 +445,28 @@ MSVCRT_size_t MSVCRT_strftime( char *str
MSVCRT_size_t MSVCRT_wcsftime( MSVCRT_wchar_t *str, MSVCRT_size_t max,
const MSVCRT_wchar_t *format, const struct MSVCRT_tm *mstm )
{
- FIXME( "%p, %d, %s, %p - stub\n", str, max, debugstr_w(format), mstm );
+ char *s, *fmt;
+ MSVCRT_size_t len;
- *str = '\0';
- return 0;
+ TRACE("%p %d %s %p\n", str, max, debugstr_w(format), mstm );
+
+ len = WideCharToMultiByte( CP_UNIXCP, 0, format, -1, NULL, 0, NULL, NULL );
+ if (!(fmt = MSVCRT_malloc( len ))) return 0;
+ WideCharToMultiByte( CP_UNIXCP, 0, format, -1, fmt, len, NULL, NULL );
+
+ if ((s = MSVCRT_malloc( max*4 )))
+ {
+ struct tm tm;
+ msvcrt_tm_to_unix( &tm, mstm );
+ if (!strftime( s, max*4, fmt, &tm )) s[0] = 0;
+ len = MultiByteToWideChar( CP_UNIXCP, 0, s, -1, str, max );
+ if (len) len--;
+ MSVCRT_free( s );
+ }
+ else len = 0;
+
+ MSVCRT_free( fmt );
+ return len;
}
/*********************************************************************
More information about the wine-cvs
mailing list