From 4bc6e5c51af44eb04313ae14f390f3780dfea346 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 17 Aug 2002 18:20:53 +0000 Subject: [PATCH] iconv() doesn't set the trailing zero git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/filefn.cpp | 14 +++++--------- src/common/strconv.cpp | 3 +++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index fd4b6b7ae9..61c33fbcbb 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1522,15 +1522,11 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) wxString wxGetCwd() { - wxString str; - - // we can't create wxStringBuffer object inline: Sun CC generates buggy - // code in this case! - { - wxStringBuffer buf(str, _MAXPATHLEN); - wxGetWorkingDirectory(buf, _MAXPATHLEN); - } - + wxChar *buffer = new wxChar[_MAXPATHLEN]; + wxGetWorkingDirectory(buffer, _MAXPATHLEN); + wxString str( buffer ); + delete [] buffer; + return str; } diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index f1d4c56ea2..b4eaa65148 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -661,6 +661,9 @@ size_t IC_CharSet::MB2WC(wchar_t *buf, const char *psz, size_t n) // convert to native endianness WC_BSWAP(buf /* _not_ bufPtr */, res) } + + // iconv doesn't seem to set the trailing 0 + buf[res] = 0; } else { -- 2.45.2