diff options
author | Vicent Marti | 2008-09-29 22:29:07 +0000 |
---|---|---|
committer | Vicent Marti | 2008-09-29 22:29:07 +0000 |
commit | d11fa6484ace66be389e6d059f63060730a1ceb6 (patch) | |
tree | 570f6310b88d9694f515ad0f773f1e01c78050f1 /common | |
parent | 8fc8531f70dbccb963823392ae923e89666839bb (diff) | |
download | scummvm-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.cpp | 16 | ||||
-rw-r--r-- | common/unzip.h | 2 |
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); }; |