aboutsummaryrefslogtreecommitdiff
path: root/common/unzip.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2012-05-04 23:32:29 -0400
committerMatthew Hoops2012-05-04 23:32:29 -0400
commite80d622fa5b3a834faff22ac777838388c0cdf10 (patch)
treef19d5a4b8725796a8bad28dad9b29c7313e5c2ff /common/unzip.cpp
parent68438a2919df2756942193d9b1b77496828fd45a (diff)
parente5808c740a62cb87a1ceeef7873af3b21e912c73 (diff)
downloadscummvm-rg350-e80d622fa5b3a834faff22ac777838388c0cdf10.tar.gz
scummvm-rg350-e80d622fa5b3a834faff22ac777838388c0cdf10.tar.bz2
scummvm-rg350-e80d622fa5b3a834faff22ac777838388c0cdf10.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'common/unzip.cpp')
-rw-r--r--common/unzip.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 8cfcd605fa..ab659343a2 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -1463,22 +1463,16 @@ bool ZipArchive::hasFile(const String &name) const {
}
int ZipArchive::listMembers(ArchiveMemberList &list) const {
- int matches = 0;
- int err = unzGoToFirstFile(_zipFile);
+ int members = 0;
- while (err == UNZ_OK) {
- char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
- if (unzGetCurrentFileInfo(_zipFile, NULL,
- szCurrentFileName, sizeof(szCurrentFileName)-1,
- NULL, 0, NULL, 0) == UNZ_OK) {
- list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(szCurrentFileName, this)));
- matches++;
- }
-
- err = unzGoToNextFile(_zipFile);
+ const unz_s *const archive = (const unz_s *)_zipFile;
+ for (ZipHash::const_iterator i = archive->_hash.begin(), end = archive->_hash.end();
+ i != end; ++i) {
+ list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(i->_key, this)));
+ ++members;
}
- return matches;
+ return members;
}
const ArchiveMemberPtr ZipArchive::getMember(const String &name) const {