really fix the length of the string returned by wxConvertStringToOle() (#10056)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -86,12 +86,13 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)
|
|||||||
wxString str(bStr, len);
|
wxString str(bStr, len);
|
||||||
#else
|
#else
|
||||||
wxString str;
|
wxString str;
|
||||||
if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
|
if (len)
|
||||||
bStr, len /* not necessary NUL-terminated */,
|
|
||||||
wxStringBuffer(str, len + 1), len + 1,
|
|
||||||
NULL, NULL /* no default char */) )
|
|
||||||
{
|
{
|
||||||
str.clear();
|
wxStringBufferLength buf(str, len); // asserts if len == 0
|
||||||
|
buf.SetLength(WideCharToMultiByte(CP_ACP, 0 /* no flags */,
|
||||||
|
bStr, len /* not necessarily NUL-terminated */,
|
||||||
|
buf, len,
|
||||||
|
NULL, NULL /* no default char */));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user