]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stream.cpp
Fix to prevent Assert when there is an empty string in a combobox/choice.
[wxWidgets.git] / src / common / stream.cpp
index 61de20d228ea59d3bf87c71c3d35f4f49fbb3fd9..76a0b3fdbf15bc4930f34fdc694386a90335f5a1 100644 (file)
@@ -371,7 +371,9 @@ off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
     diff = pos + GetIntPosition();
 
     if ( (diff > last_access) || (diff < 0) ) {
-      ret_off = m_stream->OnSysSeek(pos, wxFromCurrent);
+      // We must take into account the fact that we have read something
+      // previously.
+      ret_off = m_stream->OnSysSeek(diff-last_access, wxFromCurrent);
       ResetBuffer();
       return ret_off;
     } else {
@@ -499,7 +501,7 @@ size_t wxInputStream::GetWBack(char *buf, size_t bsize)
   return s_toget;
 }
 
-size_t wxInputStream::Ungetch(void *buf, size_t bufsize)
+size_t wxInputStream::Ungetch(const void *buf, size_t bufsize)
 {
   char *ptrback;
 
@@ -574,12 +576,12 @@ wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
 
 off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
 {
-  return wxInvalidOffset;
+  return OnSysSeek(pos, mode);
 }
 
 off_t wxInputStream::TellI() const
 {
-  return wxInvalidOffset;
+  return OnSysTell();
 }
 
 // --------------------
@@ -622,12 +624,12 @@ wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
 
 off_t wxOutputStream::TellO() const
 {
-  return wxInvalidOffset;
+  return OnSysTell();
 }
 
 off_t wxOutputStream::SeekO(off_t pos, wxSeekMode mode)
 {
-  return wxInvalidOffset;
+  return OnSysSeek(pos, mode);
 }
 
 void wxOutputStream::Sync()