if ( !bStr )
return wxString();
+ const int len = SysStringLen(bStr);
+
#if wxUSE_UNICODE
- wxString str(bStr);
+ wxString str(bStr, len);
#else
wxString str;
- const int len = SysStringLen(bStr) + 1;
if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
- bStr, len,
- wxStringBuffer(str, len), len,
+ bStr, len /* not necessary NUL-terminated */,
+ wxStringBuffer(str, len + 1), len + 1,
NULL, NULL /* no default char */) )
{
str.clear();
}
#endif
+
return str;
}