X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fc574b40c0c7dfbe4b19263d1ef178b51a45488..69659fd770f615210efac4b4fa741b3ad6223616:/src/common/zipstrm.cpp diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 83c3cfbeab..c960f548e3 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -14,19 +14,20 @@ #pragma hdrstop #endif -#if wxUSE_ZLIB && wxUSE_STREAMS && wxUSE_ZIPSTREAM +#if wxUSE_ZIPSTREAM + +#include "wx/zipstrm.h" #ifndef WX_PRECOMP + #include "wx/hashmap.h" #include "wx/intl.h" #include "wx/log.h" #include "wx/utils.h" #endif -#include "wx/zipstrm.h" #include "wx/datstrm.h" #include "wx/zstream.h" #include "wx/mstream.h" -#include "wx/buffer.h" #include "wx/ptr_scpd.h" #include "wx/wfstream.h" #include "zlib.h" @@ -156,10 +157,10 @@ wxZipClassFactory::GetProtocols(wxStreamProtocolType type) const static const wxChar *empty[] = { NULL }; switch (type) { - case wxSTREAM_PROTOCOL: return protocols; - case wxSTREAM_MIMETYPE: return mimetypes; - case wxSTREAM_FILEEXTENSION: return fileexts; - default: return empty; + case wxSTREAM_PROTOCOL: return protocols; + case wxSTREAM_MIMETYPE: return mimetypes; + case wxSTREAM_FILEEXT: return fileexts; + default: return empty; } } @@ -204,13 +205,13 @@ wxZipHeader::wxZipHeader(wxInputStream& stream, size_t size) m_ok = m_size == size; } -wxUint8 wxZipHeader::Read8() +inline wxUint8 wxZipHeader::Read8() { wxASSERT(m_pos < m_size); return m_data[m_pos++]; } -wxUint16 wxZipHeader::Read16() +inline wxUint16 wxZipHeader::Read16() { wxASSERT(m_pos + 2 <= m_size); wxUint16 n = CrackUint16(m_data + m_pos); @@ -218,7 +219,7 @@ wxUint16 wxZipHeader::Read16() return n; } -wxUint32 wxZipHeader::Read32() +inline wxUint32 wxZipHeader::Read32() { wxASSERT(m_pos + 4 <= m_size); wxUint32 n = CrackUint32(m_data + m_pos); @@ -1003,7 +1004,7 @@ size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const { wxString unixName = GetName(wxPATH_UNIX); - const wxWX2MBbuf name_buf = conv.cWX2MB(unixName); + const wxWX2MBbuf name_buf = unixName.mb_str(conv); const char *name = name_buf; if (!name) name = ""; wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); @@ -1079,12 +1080,12 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv) size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const { wxString unixName = GetName(wxPATH_UNIX); - const wxWX2MBbuf name_buf = conv.cWX2MB(unixName); + const wxWX2MBbuf name_buf = unixName.mb_str(conv); const char *name = name_buf; if (!name) name = ""; wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); - const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment); + const wxWX2MBbuf comment_buf = m_Comment.mb_str(conv); const char *comment = comment_buf; if (!comment) comment = ""; wxUint16 commentLen = wx_truncate_cast(wxUint16, strlen(comment)); @@ -1234,7 +1235,7 @@ wxZipEndRec::wxZipEndRec() bool wxZipEndRec::Write(wxOutputStream& stream, wxMBConv& conv) const { - const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment); + const wxWX2MBbuf comment_buf = m_Comment.mb_str(conv); const char *comment = comment_buf; if (!comment) comment = ""; wxUint16 commentLen = (wxUint16)strlen(comment); @@ -1373,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 } @@ -1882,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 // @@ -1947,7 +1948,7 @@ wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode) return pos; } -#endif // WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE +#endif // WXWIN_COMPATIBILITY_2_6 ///////////////////////////////////////////////////////////////////////////// @@ -2421,4 +2422,4 @@ size_t wxZipOutputStream::OnSysWrite(const void *buffer, size_t size) return m_comp->LastWrite(); } -#endif // wxUSE_ZLIB && wxUSE_STREAMS && wxUSE_ZIPSTREAM +#endif // wxUSE_ZIPSTREAM