]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datstrm.cpp
Fix a number of mingw compile errors.
[wxWidgets.git] / src / common / datstrm.cpp
index 40e10fe09c11e29ff8239ee0dd00c85ae0724c99..607c542647064d4983d1faff61b3501d4c2ed842 100644 (file)
@@ -45,6 +45,14 @@ wxDataInputStream::~wxDataInputStream()
 #endif // wxUSE_UNICODE
 }
 
+#if wxUSE_UNICODE
+void wxDataInputStream::SetConv( const wxMBConv &conv )
+{
+    delete m_conv;
+    m_conv = conv.Clone();
+}
+#endif
+
 #if wxHAS_INT64
 wxUint64 wxDataInputStream::Read64()
 {
@@ -100,25 +108,27 @@ double wxDataInputStream::ReadDouble()
 
 wxString wxDataInputStream::ReadString()
 {
-  size_t len;
-
-  len = Read32();
+    wxString ret;
 
-  if (len > 0)
-  {
+    const size_t len = Read32();
+    if ( len > 0 )
+    {
 #if wxUSE_UNICODE
-    wxCharBuffer tmp(len + 1);
-    m_input->Read(tmp.data(), len);
-    tmp.data()[len] = '\0';
-    wxString ret(m_conv->cMB2WX(tmp.data()));
+        wxCharBuffer tmp(len + 1);
+        if ( tmp )
+        {
+            m_input->Read(tmp.data(), len);
+            tmp.data()[len] = '\0';
+            ret = m_conv->cMB2WX(tmp.data());
+        }
 #else
-    wxString ret;
-    m_input->Read( wxStringBuffer(ret, len), len);
+        wxStringBuffer buf(ret, len);
+        if ( buf )
+            m_input->Read(buf, len);
 #endif
+    }
+
     return ret;
-  }
-  else
-    return wxEmptyString;
 }
 
 #if wxUSE_LONGLONG
@@ -471,6 +481,14 @@ wxDataOutputStream::~wxDataOutputStream()
 #endif // wxUSE_UNICODE
 }
 
+#if wxUSE_UNICODE
+void wxDataOutputStream::SetConv( const wxMBConv &conv )
+{
+    delete m_conv;
+    m_conv = conv.Clone();
+}
+#endif
+
 #if wxHAS_INT64
 void wxDataOutputStream::Write64(wxUint64 i)
 {
@@ -531,8 +549,13 @@ void wxDataOutputStream::WriteDouble(double d)
 #if wxUSE_APPLE_IEEE
   wxConvertToIeeeExtended(d, (wxInt8 *)buf);
 #else
+  wxUnusedVar(d);
 #if !defined(__VMS__) && !defined(__GNUG__)
+#ifdef _MSC_VER
+# pragma message("wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!")
+#else
 # pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!"
+#endif
 #endif
    buf[0] = '\0';
 #endif