X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03c0fc660317ee8ddbd80c5f2564bce68c0d9593..a4de7e8ccf4bf69d150c29c9a3d53e5754c8b8a9:/src/common/zipstrm.cpp diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 9fbff10320..3e8d0dead1 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -3,10 +3,10 @@ // Purpose: input stream for ZIP archive access // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows Licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "zipstrm.h" #endif @@ -40,15 +40,16 @@ wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file m_Pos = 0; m_Size = 0; - m_Archive = (void*) unzOpen(archive.mb_str()); + m_Archive = (void*) unzOpen(archive.mb_str(wxConvFile)); if (m_Archive == NULL) { - m_lasterror = wxStream_READ_ERR; + m_lasterror = wxSTREAM_READ_ERROR; return; } - if (unzLocateFile((unzFile)m_Archive, file.mb_str(), 0) != UNZ_OK) + // TODO what encoding does ZIP use? + if (unzLocateFile((unzFile)m_Archive, file.ToAscii(), 0) != UNZ_OK) { - m_lasterror = wxStream_READ_ERR; + m_lasterror = wxSTREAM_READ_ERROR; return; } @@ -56,7 +57,7 @@ wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK) { - m_lasterror = wxStream_READ_ERR; + m_lasterror = wxSTREAM_READ_ERROR; return; } m_Size = (size_t)zinfo.uncompressed_size; @@ -90,7 +91,7 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize) if ( m_Pos >= (off_t)m_Size ) { - m_lasterror = wxStream_EOF; + m_lasterror = wxSTREAM_EOF; return 0; } @@ -122,7 +123,7 @@ off_t wxZipInputStream::OnSysSeek(off_t seek, wxSeekMode mode) default : nextpos = m_Pos; break; /* just to fool compiler, never happens */ } - size_t toskip = 0; + size_t toskip; if ( nextpos > m_Pos ) { toskip = nextpos - m_Pos; @@ -132,7 +133,7 @@ off_t wxZipInputStream::OnSysSeek(off_t seek, wxSeekMode mode) unzCloseCurrentFile((unzFile)m_Archive); if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK) { - m_lasterror = wxStream_READ_ERR; + m_lasterror = wxSTREAM_READ_ERROR; return m_Pos; } toskip = nextpos;