From 686a3ee080e7b5f17a3d1dbd688602f7f4bcf22a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 20 Mar 2005 18:48:58 +0000 Subject: [PATCH] Seek(-1, mode) should work instead of giving an error if mode != wxFromStart git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/file.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5a64ce5bcd..d56a29c43f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -13,6 +13,7 @@ All: - Added wxTempFileOutputStream by Stas Sergeev. - Fixed wxDateTime::SetToWeekDayInSameWeek(Sun, Monday_First). - Added WXK_SPECIAL keycodes for special hardware buttons. +- Fixed bug with wxFile::Seek(-1, wxFromCurrent) All (GUI): diff --git a/src/common/file.cpp b/src/common/file.cpp index a4b94e28ca..9985b9d448 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -356,7 +356,10 @@ bool wxFile::Flush() // seek wxFileOffset wxFile::Seek(wxFileOffset ofs, wxSeekMode mode) { - wxASSERT( IsOpened() ); + wxASSERT_MSG( IsOpened(), _T("can't seek on closed file") ); + wxCHECK_MSG( ofs != wxInvalidOffset || mode != wxFromStart, + wxInvalidOffset, + _T("invalid absolute file offset") ); int origin; switch ( mode ) { @@ -376,11 +379,6 @@ wxFileOffset wxFile::Seek(wxFileOffset ofs, wxSeekMode mode) break; } - if (ofs == wxInvalidOffset) - { - wxLogSysError(_("can't seek on file descriptor %d, large files support is not enabled."), m_fd); - return wxInvalidOffset; - } wxFileOffset iRc = wxSeek(m_fd, ofs, origin); if ( iRc == wxInvalidOffset ) { -- 2.45.2