X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/53663be8a5ea8e1c6f178839209b67e8228e4642..61fef19b852d426f5b00b60de083539b9ba0f76c:/src/common/datstrm.cpp diff --git a/src/common/datstrm.cpp b/src/common/datstrm.cpp index a2c2aa55da..a7bf054ec0 100644 --- a/src/common/datstrm.cpp +++ b/src/common/datstrm.cpp @@ -110,15 +110,13 @@ wxString wxDataInputStream::ReadString() if (len > 0) { #if wxUSE_UNICODE - char *tmp = new char[len + 1]; - m_input->Read(tmp, len); - tmp[len] = 0; - wxString ret( (const wxChar*) m_conv.cMB2WX(tmp) ); - delete[] tmp; + wxCharBuffer tmp(len + 1); + m_input->Read(tmp.data(), len); + tmp.data()[len] = '\0'; + wxString ret(m_conv.cMB2WX(tmp.data())); #else wxString ret; - m_input->Read( ret.GetWriteBuf(len), len); - ret.UngetWriteBuf(); + m_input->Read( wxStringBuffer(ret, len), len); #endif return ret; }