From: Guilhem Lavaux Date: Fri, 13 Aug 1999 17:49:02 +0000 (+0000) Subject: Bug fix in wxBufferedInputStream::SeekI X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d4feedcff19fcb93e35242375be3e1e478f44eac Bug fix in wxBufferedInputStream::SeekI git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3371 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/stream.cpp b/src/common/stream.cpp index c755d78c9d..774f0b129b 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -371,7 +371,13 @@ 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. + if (diff < 0) + ret_off = m_stream->OnSysSeek(-(last_access-diff), wxFromCurrent); + // lastaccess + abs(diff) = lastaccess - diff here + else + ret_off = m_stream->OnSysSeek(diff-last_access, wxFromCurrent); ResetBuffer(); return ret_off; } else {