]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/mstream.cpp
As small as possible reorganization within wxDateTime to please PCH in DLL build...
[wxWidgets.git] / src / common / mstream.cpp
index f1625ecf557f9ae717139d12d620b9ba8cea2a6f..21cc9ee95c56ced529ec7f56a096ac453934afa7 100644 (file)
@@ -60,8 +60,15 @@ wxMemoryInputStream::~wxMemoryInputStream()
 char wxMemoryInputStream::Peek()
 {
     char *buf = (char *)m_i_streambuf->GetBufferStart();
+    size_t pos = m_i_streambuf->GetIntPosition();
+    if ( pos == m_length )
+    {
+        m_lasterror = wxSTREAM_READ_ERROR;
+
+        return 0;
+    }
 
-    return buf[m_i_streambuf->GetIntPosition()];
+    return buf[pos];
 }
 
 bool wxMemoryInputStream::Eof() const
@@ -85,12 +92,12 @@ size_t wxMemoryInputStream::OnSysRead(void *buffer, size_t nbytes)
     return m_i_streambuf->GetIntPosition() - pos;
 }
 
-off_t wxMemoryInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxMemoryInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
 {
     return m_i_streambuf->Seek(pos, mode);
 }
 
-off_t wxMemoryInputStream::OnSysTell() const
+wxFileOffset wxMemoryInputStream::OnSysTell() const
 {
     return m_i_streambuf->Tell();
 }
@@ -126,12 +133,12 @@ size_t wxMemoryOutputStream::OnSysWrite(const void *buffer, size_t nbytes)
     return newpos - oldpos;
 }
 
-off_t wxMemoryOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxMemoryOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
 {
     return m_o_streambuf->Seek(pos, mode);
 }
 
-off_t wxMemoryOutputStream::OnSysTell() const
+wxFileOffset wxMemoryOutputStream::OnSysTell() const
 {
     return m_o_streambuf->Tell();
 }