X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..1a83b9bd10b7d92520c202e6ed6cff2015f13315:/src/common/fs_zip.cpp?ds=sidebyside diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index f3e807d87c..65fbf89cc2 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik // CVS-ID: $Id$ -// Licence: wxWindows Licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,6 @@ #include "wx/log.h" #endif -#include "wx/hashmap.h" #include "wx/filesys.h" #include "wx/zipstrm.h" #include "wx/fs_zip.h" @@ -38,9 +37,6 @@ #include "unzip.h" #endif -WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, - wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); - //---------------------------------------------------------------------------- // wxZipFSHandler //---------------------------------------------------------------------------- @@ -51,7 +47,7 @@ wxZipFSHandler::wxZipFSHandler() : wxFileSystemHandler() { m_Archive = NULL; m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString; - m_AllowDirs = m_AllowFiles = TRUE; + m_AllowDirs = m_AllowFiles = true; m_DirsFound = NULL; } @@ -96,7 +92,7 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l rightPart.Normalize(wxPATH_NORM_DOTS, wxT("/"), wxPATH_UNIX); right = rightPart.GetFullPath(wxPATH_UNIX); } - + if (right.GetChar(0) == wxT('/')) right = right.Mid(1); wxFileName leftFilename = wxFileSystem::URLToFileName(left); @@ -142,16 +138,16 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags) switch (flags) { case wxFILE: - m_AllowDirs = FALSE, m_AllowFiles = TRUE; break; + m_AllowDirs = false, m_AllowFiles = true; break; case wxDIR: - m_AllowDirs = TRUE, m_AllowFiles = FALSE; break; + m_AllowDirs = true, m_AllowFiles = false; break; default: - m_AllowDirs = m_AllowFiles = TRUE; break; + m_AllowDirs = m_AllowFiles = true; break; } m_ZipFile = left; wxString nativename = wxFileSystem::URLToFileName(m_ZipFile).GetFullPath(); - m_Archive = (void*) unzOpen(nativename.mb_str()); + m_Archive = (void*) unzOpen(nativename.mb_str(wxConvFile)); m_Pattern = right.AfterLast(wxT('/')); m_BaseDir = right.BeforeLast(wxT('/')); @@ -196,7 +192,7 @@ wxString wxZipFSHandler::DoFind() { unzGetCurrentFileInfo((unzFile)m_Archive, NULL, namebuf, 1024, NULL, 0, NULL, 0); for (c = namebuf; *c; c++) if (*c == '\\') *c = '/'; - namestr = wxString::FromAscii( namebuf ); // TODO what encoding does ZIP use? + namestr = wxString::FromAscii(namebuf); // TODO what encoding does ZIP use? if (m_AllowDirs) { @@ -208,11 +204,11 @@ wxString wxZipFSHandler::DoFind() wxLongToLongHashMap::iterator it = m_DirsFound->find(key); if (it == m_DirsFound->end()) { - m_DirsFound[key] = 1; + (*m_DirsFound)[key] = 1; filename = dir.AfterLast(wxT('/')); dir = dir.BeforeLast(wxT('/')); if (!filename.IsEmpty() && m_BaseDir == dir && - wxMatchWild(m_Pattern, filename, FALSE)) + wxMatchWild(m_Pattern, filename, false)) match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename; } else @@ -223,7 +219,7 @@ wxString wxZipFSHandler::DoFind() filename = namestr.AfterLast(wxT('/')); dir = namestr.BeforeLast(wxT('/')); if (m_AllowFiles && !filename.IsEmpty() && m_BaseDir == dir && - wxMatchWild(m_Pattern, filename, FALSE)) + wxMatchWild(m_Pattern, filename, false)) match = m_ZipFile + wxT("#zip:") + namestr; if (unzGoToNextFile((unzFile)m_Archive) != UNZ_OK)