use WideCharToMultiByte() instead of wcstombs() to deal with BSTRs containing NULs (modified patch 1886062)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ebe887ed03
commit
bba85010a3
@ -83,11 +83,15 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)
|
||||
#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();
|
||||
}
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user