X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/53663be8a5ea8e1c6f178839209b67e8228e4642..a0c6a355b7b53866286ec6263b99f787cfdbe731:/src/common/datstrm.cpp?ds=inline

diff --git a/src/common/datstrm.cpp b/src/common/datstrm.cpp
index a2c2aa55da..1580055ca7 100644
--- a/src/common/datstrm.cpp
+++ b/src/common/datstrm.cpp
@@ -9,7 +9,7 @@
 // Licence:   	wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "datstrm.h"
 #endif
 
@@ -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;
   }