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:
@@ -83,11 +83,15 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)
|
|||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
wxString str(bStr);
|
wxString str(bStr);
|
||||||
#else
|
#else
|
||||||
int len = SysStringLen(bStr) + 1;
|
wxString str;
|
||||||
char *buf = new char[len];
|
const int len = SysStringLen(bStr) + 1;
|
||||||
(void)wcstombs( buf, bStr, len);
|
if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
|
||||||
wxString str(buf);
|
bStr, len,
|
||||||
delete[] buf;
|
wxStringBuffer(str, len), len,
|
||||||
|
NULL, NULL /* no default char */) )
|
||||||
|
{
|
||||||
|
str.clear();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user