X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8dfb846e801cf2c5bfa1bbd83817e567ddb04d0e..aa154cb1578ba9d44c7e24c5e76d8238bf8809d0:/src/common/wxchar.cpp diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index aa6fb1ec6d..f7649183cc 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -2,7 +2,7 @@ // Name: wxchar.cpp // Purpose: wxChar implementation // Author: Ove Kåven -// Modified by: +// Modified by: Ron Lee // Created: 09/04/99 // RCS-ID: $Id$ // Copyright: (c) wxWindows copyright @@ -919,8 +919,9 @@ int wxSprintf( wxChar *str, const wxChar *format, ... ) va_list argptr; va_start(argptr, format); - // callers of wxSprintf() deserve what they get - int ret = vswprintf( str, UINT_MAX, wxFormatConverter(format), argptr ); + // note that wxString::Format() uses wxVsnprintf(), not wxSprintf(), so + // it's safe to implement this one in terms of it + wxStrcpy(str, wxString::Format(format, argptr)); va_end(argptr); @@ -964,7 +965,7 @@ int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list argptr int wxVsprintf( wxChar *str, const wxChar *format, va_list argptr ) { // same as for wxSprintf() - return vswprintf(str, UINT_MAX, wxFormatConverter(format), argptr); + return vswprintf(str, INT_MAX / 4, wxFormatConverter(format), argptr); } #endif // wxNEED_PRINTF_CONVERSION @@ -1345,6 +1346,18 @@ WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const } #endif // wxNEED_WX_TIME_H +#ifndef wxCtime +WXDLLEXPORT wxChar *wxCtime(const time_t *timep) +{ + static wxChar buf[128]; + + wxStrncpy( buf, wxConvertMB2WX( ctime( timep ) ), sizeof( buf ) ); + buf[ sizeof( buf ) - 1 ] = _T('\0'); + + return buf; +} +#endif // wxCtime + #endif // wxUSE_WCHAR_T // ----------------------------------------------------------------------------