fix the length passed to wxMB2WC (replaces patch 1554431); don't use (and especially...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 4 Oct 2006 19:43:20 +0000 (19:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 4 Oct 2006 19:43:20 +0000 (19:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/wince/time.cpp

index 62b10ed256387637131cc43f5c96219b933a7361..965502e15b724fc12bbd68978ffbdcac23ead98c 100644 (file)
@@ -500,18 +500,20 @@ strftime(char * const s, const size_t maxsize, const char *format, const struct
 extern "C"
 {
 
-size_t wcsftime(wchar_t* const s, const size_t maxsize, const wchar_t *format, const struct tm * const t)
+size_t wcsftime(wchar_t *s,
+                const size_t maxsize,
+                const wchar_t *format,
+                const struct tm *t)
 {
-    char sBuf[256];
-    sBuf[0] = 0;
-    
+    wxCharBuffer sBuf(maxsize/sizeof(wchar_t));
+
     wxString formatStr(format);
     wxCharBuffer bufFormatStr(formatStr.mb_str());
-    
-    size_t sz = strftime(sBuf, maxsize, bufFormatStr, t);
-    
-    wxMB2WC(s, sBuf, strlen(sBuf));
-    
+
+    size_t sz = strftime(sBuf, maxsize/sizeof(wchar_t), bufFormatStr, t);
+
+    wxMB2WC(s, sBuf, maxsize);
+
     return sz;
 }