remove WXWIN_COMPATIBILITY_2_6, add WXWIN_COMPATIBILITY_3_0

closes #15792

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2014-01-04 20:07:33 +00:00
parent 61728d5d54
commit 967a94c91a
140 changed files with 291 additions and 1561 deletions

View File

@@ -1325,40 +1325,6 @@ wxZipInputStream::wxZipInputStream(wxInputStream *stream,
Init();
}
#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
// Part of the compatibility constructor, which has been made inline to
// avoid a problem with it not being exported by mingw 3.2.3
//
void wxZipInputStream::Init(const wxString& file)
{
// no error messages
wxLogNull nolog;
Init();
m_allowSeeking = true;
wxFFileInputStream *ffile;
ffile = static_cast<wxFFileInputStream*>(m_parent_i_stream);
wxZipEntryPtr_ entry;
if (ffile->IsOk()) {
do {
entry.reset(GetNextEntry());
}
while (entry.get() != NULL && entry->GetInternalName() != file);
}
if (entry.get() == NULL)
m_lasterror = wxSTREAM_READ_ERROR;
}
wxInputStream* wxZipInputStream::OpenFile(const wxString& archive)
{
wxLogNull nolog;
return new wxFFileInputStream(archive);
}
#endif // WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
void wxZipInputStream::Init()
{
m_store = new wxStoredInputStream(*m_parent_i_stream);
@@ -1375,9 +1341,6 @@ void wxZipInputStream::Init()
m_signature = 0;
m_TotalEntries = 0;
m_lasterror = m_parent_i_stream->GetLastError();
#if WXWIN_COMPATIBILITY_2_6
m_allowSeeking = false;
#endif
}
wxZipInputStream::~wxZipInputStream()
@@ -1892,74 +1855,6 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t size)
return count;
}
#if WXWIN_COMPATIBILITY_2_6
// Borrowed from VS's zip stream (c) 1999 Vaclav Slavik
//
wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode)
{
// seeking works when the stream is created with the compatibility
// constructor
if (!m_allowSeeking)
return wxInvalidOffset;
if (!IsOpened())
if ((AtHeader() && !DoOpen()) || !OpenDecompressor())
m_lasterror = wxSTREAM_READ_ERROR;
if (!IsOk())
return wxInvalidOffset;
// NB: since ZIP files don't natively support seeking, we have to
// implement a brute force workaround -- reading all the data
// between current and the new position (or between beginning of
// the file and new position...)
wxFileOffset nextpos;
wxFileOffset pos = TellI();
switch ( mode )
{
case wxFromCurrent : nextpos = seek + pos; break;
case wxFromStart : nextpos = seek; break;
case wxFromEnd : nextpos = GetLength() + seek; break;
default : nextpos = pos; break; /* just to fool compiler, never happens */
}
wxFileOffset toskip wxDUMMY_INITIALIZE(0);
if ( nextpos >= pos )
{
toskip = nextpos - pos;
}
else
{
wxZipEntry current(m_entry);
if (!OpenEntry(current))
{
m_lasterror = wxSTREAM_READ_ERROR;
return pos;
}
toskip = nextpos;
}
if ( toskip > 0 )
{
const int BUFSIZE = 4096;
size_t sz;
char buffer[BUFSIZE];
while ( toskip > 0 )
{
sz = wx_truncate_cast(size_t, wxMin(toskip, BUFSIZE));
Read(buffer, sz);
toskip -= sz;
}
}
pos = nextpos;
return pos;
}
#endif // WXWIN_COMPATIBILITY_2_6
/////////////////////////////////////////////////////////////////////////////
// Output stream