X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bba85010a3d174d43c82c1450b72d744baefafd6..4a36036eb24baac040eea64216458773c9dd6e40:/src/msw/ole/oleutils.cpp diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index c596c2bc1c..59f387426c 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -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, - 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; }