use BSTR length to also deal with NULs inside BSTRs correctly in Unicode build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
bba85010a3
commit
59af032ab6
@ -80,19 +80,21 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)
|
||||
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,
|
||||
bStr, len + 1 /* include last NUL */,
|
||||
wxStringBuffer(str, len), len,
|
||||
NULL, NULL /* no default char */) )
|
||||
{
|
||||
str.clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user