aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVicent Marti2008-09-29 22:29:07 +0000
committerVicent Marti2008-09-29 22:29:07 +0000
commitd11fa6484ace66be389e6d059f63060730a1ceb6 (patch)
tree570f6310b88d9694f515ad0f773f1e01c78050f1 /common
parent8fc8531f70dbccb963823392ae923e89666839bb (diff)
downloadscummvm-rg350-d11fa6484ace66be389e6d059f63060730a1ceb6.tar.gz
scummvm-rg350-d11fa6484ace66be389e6d059f63060730a1ceb6.tar.bz2
scummvm-rg350-d11fa6484ace66be389e6d059f63060730a1ceb6.zip
Ported ZipArchive::getAllNames() implementation from GUI branch.
svn-id: r34691
Diffstat (limited to 'common')
-rw-r--r--common/unzip.cpp16
-rw-r--r--common/unzip.h2
2 files changed, 16 insertions, 2 deletions
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 054200e7a2..775a6e2dab 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -1393,7 +1393,21 @@ bool ZipArchive::hasFile(const Common::String &name) {
}
int ZipArchive::getAllNames(Common::StringList &list) {
- return 0;
+ if (!_zipFile)
+ return 0;
+
+ if (unzGoToFirstFile(_zipFile) != UNZ_OK)
+ return 0;
+
+ char fileNameBuffer[UNZ_MAXFILENAMEINZIP + 1];
+ list.clear();
+
+ do {
+ unzGetCurrentFileInfo(_zipFile, 0, fileNameBuffer, UNZ_MAXFILENAMEINZIP + 1, 0, 0, 0, 0);
+ list.push_back(Common::String(fileNameBuffer));
+ } while (unzGoToNextFile(_zipFile) == UNZ_OK);
+
+ return list.size();
}
/*
diff --git a/common/unzip.h b/common/unzip.h
index 93afd0b05b..e4eb754eee 100644
--- a/common/unzip.h
+++ b/common/unzip.h
@@ -44,7 +44,7 @@ public:
bool isOpen() const;
virtual bool hasFile(const String &name);
- virtual int getAllNames(StringList &list); // FIXME: This one is not (yet?) implemented
+ virtual int getAllNames(StringList &list);
virtual Common::SeekableReadStream *openFile(const Common::String &name);
};