Dmitry Timoshkov dmitry@baikal.ru writes:
- len = MultiByteToWideChar( CP_ACP, 0, format, -1, NULL, 0 );
- if ((fmt = MSVCRT_malloc( len * sizeof(MSVCRT_wchar_t) )))
- {
MultiByteToWideChar( CP_ACP, 0, format, -1, fmt, len );
if ((len = MSVCRT_wcsftime( s, max, fmt, mstm )))
{
len = WideCharToMultiByte( CP_ACP, 0, s, len, str, max, NULL, NULL );
if (len < max) str[len] = 0;
}
The overflow handling still looks suspicious. It probably needs some more test cases.