From 63482228c26c90874788ddeb62ba44e7f3e484ff Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 6 Jun 2003 00:43:51 +0000 Subject: [PATCH] Put terminating NUL in the buffer since MB2WC doesn't do it. [#749825] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20959 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/string.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common/string.cpp b/src/common/string.cpp index 6eef24695f..3465875613 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -164,14 +164,14 @@ wxSTD ostream& operator<<(wxSTD ostream& os, const wxString& str) // wxStringData core // =========================================================================== -#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) -# pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!") -void wxStringData::Free() -{ - free(this); -} -#endif - +#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) +# pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!") +void wxStringData::Free() +{ + free(this); +} +#endif + // =========================================================================== // wxString class core // =========================================================================== @@ -267,6 +267,7 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength) if ( conv.MB2WC(m_pchData, psz, nLen + 1) != (size_t)-1 ) { // initialized ok + m_pchData[nLen] = 0; return; } //else: the conversion failed -- leave the string empty (what else?) @@ -773,7 +774,7 @@ wxString wxString::FromAscii(const char ascii) wxString res; res += (wchar_t)(unsigned char) ascii; - + return res; }