git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51541
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#if wxUSE_UNICODE
wxString str(bStr);
#else
#if wxUSE_UNICODE
wxString str(bStr);
#else
- int len = SysStringLen(bStr) + 1;
- char *buf = new char[len];
- (void)wcstombs( buf, bStr, len);
- wxString str(buf);
- delete[] buf;
+ wxString str;
+ const int len = SysStringLen(bStr) + 1;
+ if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
+ bStr, len,
+ wxStringBuffer(str, len), len,
+ NULL, NULL /* no default char */) )
+ {
+ str.clear();
+ }