]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datstrm.cpp
wxLogTrace doesn't give messages with two 'Trace' in the beginning
[wxWidgets.git] / src / common / datstrm.cpp
index befc354784a28c74710af7a043b58a6680c7310d..5c4fd46091807f4a169209053ec3579403eb6091 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // Created:     28/06/98
 // RCS-ID:      $Id$
-// Copyright:   (c) Guilhem Lavaux 
+// Copyright:   (c) Guilhem Lavaux
 // Licence:    wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
@@ -86,22 +86,25 @@ double wxDataInputStream::ReadDouble()
 
 wxString wxDataInputStream::ReadString()
 {
-  wxString wx_string;
-  char *string;
-  unsigned long len;
+  size_t len;
 
   len = Read32();
-  string = new char[len+1];
 
-  m_input->Read(string, len);
-
-  string[len] = 0;
-  wx_string = string;
-  delete string;
+#if wxUSE_UNICODE
+  char *tmp = new char[len + 1];
+  m_input->Read(tmp, len);
+  tmp[len] = 0;
+  wxString s(tmp);
+  delete[] tmp;
+#else
+  wxString s;
+  m_input->Read(s.GetWriteBuf(len), len);
+  s.UngetWriteBuf();
+#endif
 
-  return wx_string;
+  return s;
 }
-  
+
 wxDataInputStream& wxDataInputStream::operator>>(wxString& s)
 {
   s = ReadString();
@@ -214,8 +217,10 @@ void wxDataOutputStream::WriteDouble(double d)
 #if wxUSE_APPLE_IEEE
   ConvertToIeeeExtended(d, (unsigned char *)buf);
 #else
-#  pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!"
- buf[0] = '\0';
+#ifndef __VMS__
+# pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!"
+#endif
+   buf[0] = '\0';
 #endif
   m_output->Write(buf, 10);
 }
@@ -283,4 +288,4 @@ wxDataOutputStream& wxDataOutputStream::operator<<(float f)
 
 #endif
   // wxUSE_STREAMS
-  
+