]> git.saurik.com Git - wxWidgets.git/commitdiff
Tell is now compatible with the wback buffer
authorGuillermo Rodriguez Garcia <guille@iies.es>
Tue, 29 Feb 2000 21:05:12 +0000 (21:05 +0000)
committerGuillermo Rodriguez Garcia <guille@iies.es>
Tue, 29 Feb 2000 21:05:12 +0000 (21:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/stream.cpp

index 16ab8391cbb417e1aac4879eb19bcd83c0d6f15a..ef92a1807a3b977facd144fa84b1a546d37644e4 100644 (file)
@@ -625,7 +625,13 @@ off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
     /* A call to SeekI() will automatically invalidate any previous call
        to Ungetch(), otherwise it would be possible to SeekI() to one
        one position, unread some bytes there, SeekI() to another position
-       and the data would be corrupted. */
+       and the data would be corrupted.
+
+       GRG: Could add code here to try to navigate within the wback
+       buffer if possible, but is it really needed? It would only work
+       when seeking in wxFromCurrent mode, else it would invalidate
+       anyway...
+     */
     if (m_wback) 
     {
         free(m_wback);
@@ -639,7 +645,13 @@ off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
 
 off_t wxInputStream::TellI() const
 {
-    return OnSysTell();
+    /* GRG: Changed to make it compatible with the wback buffer */
+    off_t pos = OnSysTell();
+
+    if (pos != wxInvalidOffset)
+        pos -= (m_wbacksize - m_wbackcur);
+
+    return pos;
 }
 
 // --------------------