]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stream.cpp
fix for private access for wxTimerProc
[wxWidgets.git] / src / common / stream.cpp
index dda5f6446bee5ba0e264eb2fb20d85bd4655cdf6..3c038e14d901dd402478badf538341f200bd4ed5 100644 (file)
@@ -52,6 +52,8 @@ void wxStreamBuffer::WriteBack(char c)
 
   // Assume that if we write "back" we have read a few bytes: so we have some
   // space.
+  if (m_buffer_pos == m_buffer_start)
+    return;
 
   m_buffer_pos--;
   *m_buffer_pos = c;
@@ -212,6 +214,7 @@ wxInputStream::wxInputStream()
   m_i_destroybuf = TRUE;
   m_i_streambuf = new wxStreamBuffer(*this);
   m_eof = FALSE;
+  m_lastread = 0;
 }
 
 wxInputStream::wxInputStream(wxStreamBuffer *buffer)
@@ -219,6 +222,7 @@ wxInputStream::wxInputStream(wxStreamBuffer *buffer)
   m_i_destroybuf = FALSE;
   m_i_streambuf = buffer;
   m_eof = FALSE;
+  m_lastread = 0;
 }
 
 wxInputStream::~wxInputStream()
@@ -344,7 +348,7 @@ wxInputStream& wxInputStream::operator>>(float& f)
   }
 
   if (c == '.') {
-    float f_multiplicator = 0.1;
+    float f_multiplicator = (float) 0.1;
     c = GetC();
 
     while (isdigit(c)) {
@@ -359,12 +363,14 @@ wxInputStream& wxInputStream::operator>>(float& f)
   return *this;
 }
 
+#if wxUSE_SERIAL
 wxInputStream& wxInputStream::operator>>(wxObject *& obj)
 {
   wxObjectInputStream obj_s(*this);
   obj = obj_s.LoadObject();
   return *this;
 }
+#endif
 
 off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
 {
@@ -416,12 +422,16 @@ wxOutputStream::wxOutputStream()
 {
   m_o_destroybuf = TRUE;
   m_o_streambuf = new wxStreamBuffer(*this);
+  m_bad = FALSE;
+  m_lastwrite = 0;
 }
 
 wxOutputStream::wxOutputStream(wxStreamBuffer *buffer)
 {
   m_o_destroybuf = FALSE;
   m_o_streambuf = buffer;
+  m_bad = FALSE;
+  m_lastwrite = 0;
 }
 
 wxOutputStream::~wxOutputStream()
@@ -534,20 +544,38 @@ wxOutputStream& wxOutputStream::operator<<(double f)
   return Write(strfloat, strfloat.Len());
 }
 
+#if wxUSE_SERIAL
 wxOutputStream& wxOutputStream::operator<<(wxObject& obj)
 {
   wxObjectOutputStream obj_s(*this);
   obj_s.SaveObject(obj);
   return *this;
 }
+#endif
+
+// ----------------------------------------------------------------------------
+// wxStream
+// ----------------------------------------------------------------------------
+
+wxStream::wxStream()
+  : wxInputStream(), wxOutputStream()
+{
+}
 
 // ----------------------------------------------------------------------------
 // wxFilterInputStream
 // ----------------------------------------------------------------------------
+wxFilterInputStream::wxFilterInputStream()
+  : wxInputStream(NULL)
+{
+}
+
 wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
   : wxInputStream(NULL)
 {
   m_parent_i_stream = &stream;
+  wxDELETE(m_i_streambuf); // In case m_i_streambuf has been initialized.
+  m_i_destroybuf = FALSE;
   m_i_streambuf = stream.InputStreamBuffer();
 }
 
@@ -570,14 +598,20 @@ off_t wxFilterInputStream::DoTellInput() const
   return m_parent_i_stream->TellI();
 }
 
-
 // ----------------------------------------------------------------------------
 // wxFilterOutputStream
 // ----------------------------------------------------------------------------
+wxFilterOutputStream::wxFilterOutputStream()
+  : wxOutputStream(NULL)
+{
+}
+
 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream)
   : wxOutputStream(NULL)
 {
   m_parent_o_stream = &stream;
+  wxDELETE(m_o_streambuf); // In case m_o_streambuf has been initialized.
+  m_o_destroybuf = FALSE;
   m_o_streambuf = stream.OutputStreamBuffer();
 }
 
@@ -600,6 +634,19 @@ off_t wxFilterOutputStream::DoTellOutput() const
   return m_parent_o_stream->TellO();
 }
 
+// ----------------------------------------------------------------------------
+// wxFilterStream
+// ----------------------------------------------------------------------------
+
+wxFilterStream::wxFilterStream()
+{
+}
+
+wxFilterStream::wxFilterStream(wxStream& stream)
+  : wxFilterInputStream(stream), wxFilterOutputStream(stream)
+{
+}
+
 // ----------------------------------------------------------------------------
 // Some IOManip function
 // ----------------------------------------------------------------------------