+ delete m_o_streambuf;
+}
+
+size_t wxMemoryOutputStream::OnSysWrite(const void *buffer, size_t nbytes)
+{
+ size_t bufsize = m_o_streambuf->GetBufferEnd() - m_o_streambuf->GetBufferStart();
+ size_t oldpos = m_o_streambuf->GetIntPosition();
+ m_o_streambuf->Write(buffer, nbytes);
+ size_t newpos = m_o_streambuf->GetIntPosition();
+ if (newpos == 0) return bufsize - oldpos;
+ else return newpos - oldpos;
+}
+
+off_t wxMemoryOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+{
+ return m_o_streambuf->Seek(pos, mode);
+}
+
+off_t wxMemoryOutputStream::OnSysTell() const
+{
+ return m_o_streambuf->Tell();
+}
+
+size_t wxMemoryOutputStream::CopyTo(char *buffer, size_t len) const
+{
+ if (!buffer)
+ return 0;
+
+ if (len > GetSize())
+ len = GetSize();
+
+ memcpy(buffer, m_o_streambuf->GetBufferStart(), len);
+ return len;