From: Michael Wetherell Date: Sun, 19 Nov 2006 02:11:40 +0000 (+0000) Subject: wxArchiveFSHandler switches on simulated seeking for compatibility with X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5c80cef4bf3c6bac25e412a253bcce4fa268620f?ds=inline wxArchiveFSHandler switches on simulated seeking for compatibility with previous versions. Still overridden by wxFS_SEEKABLE. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/zipstrm.h b/include/wx/zipstrm.h index be3ff8790c..7f6876573b 100644 --- a/include/wx/zipstrm.h +++ b/include/wx/zipstrm.h @@ -440,9 +440,9 @@ private: friend bool wxZipOutputStream::CopyArchiveMetaData( wxZipInputStream& inputStream); -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE +#if WXWIN_COMPATIBILITY_2_6 bool m_allowSeeking; - friend class wxZipFSInputStream; + friend class wxArchiveFSHandler; #endif DECLARE_NO_COPY_CLASS(wxZipInputStream) diff --git a/src/common/fs_arc.cpp b/src/common/fs_arc.cpp index 9c92942c23..a00e6accd7 100644 --- a/src/common/fs_arc.cpp +++ b/src/common/fs_arc.cpp @@ -22,7 +22,12 @@ #include "wx/log.h" #endif -#include "wx/archive.h" +#if WXWIN_COMPATIBILITY_2_6 + #include "wx/zipstrm.h" +#else + #include "wx/archive.h" +#endif + #include "wx/private/fileback.h" //--------------------------------------------------------------------------- @@ -393,6 +398,12 @@ wxFSFile* wxArchiveFSHandler::OpenFile( s->OpenEntry(*entry); if (s && s->IsOk()) + { +#if WXWIN_COMPATIBILITY_2_6 + if (factory->IsKindOf(CLASSINFO(wxZipClassFactory))) + ((wxZipInputStream*)s)->m_allowSeeking = true; +#endif // WXWIN_COMPATIBILITY_2_6 + return new wxFSFile(s, key + right, GetMimeTypeFromExt(location), @@ -401,6 +412,7 @@ wxFSFile* wxArchiveFSHandler::OpenFile( , entry->GetDateTime() #endif // wxUSE_DATETIME ); + } delete s; return NULL; diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 484dbabcc0..eff8cc54f0 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -1374,7 +1374,7 @@ void wxZipInputStream::Init() m_signature = 0; m_TotalEntries = 0; m_lasterror = m_parent_i_stream->GetLastError(); -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE +#if WXWIN_COMPATIBILITY_2_6 m_allowSeeking = false; #endif } @@ -1883,7 +1883,7 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t size) return count; } -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE +#if WXWIN_COMPATIBILITY_2_6 // Borrowed from VS's zip stream (c) 1999 Vaclav Slavik // @@ -1948,7 +1948,7 @@ wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode) return pos; } -#endif // WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE +#endif // WXWIN_COMPATIBILITY_2_6 /////////////////////////////////////////////////////////////////////////////