reverted the change of r56246 and keep the old behaviour of MB2WC/WC2MB; document it even more clearly and correct code using these functions incorrectly

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-17 11:31:22 +00:00
parent f9736c27be
commit 51725fc0c2
5 changed files with 54 additions and 41 deletions

View File

@@ -990,15 +990,10 @@ wxTextCtrl::StreamIn(const wxString& value,
if (len == wxCONV_FAILED)
return false;
#if wxUSE_WCHAR_T
wxWCharBuffer wchBuf(len);
wxWCharBuffer wchBuf(len); // allocates one extra character
wchar_t *wpc = wchBuf.data();
#else
wchar_t *wchBuf = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
wchar_t *wpc = wchBuf;
#endif
conv.MB2WC(wpc, value.mb_str(), value.length());
conv.MB2WC(wpc, value.mb_str(), len + 1);
#endif // wxUSE_UNICODE_MSLU
// finally, stream it in the control