aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2015-01-07 23:46:49 +0200
committerFilippos Karapetis2015-01-07 23:49:13 +0200
commit474ef741226ac56bd146c79be96c55c00551593b (patch)
tree7063de40b86e4fb4a9e3e349e9d76a5ad13d1d7b
parent07ad10babe6eed96ac1d3ff8e9fc9580ec21b7bd (diff)
downloadscummvm-rg350-474ef741226ac56bd146c79be96c55c00551593b.tar.gz
scummvm-rg350-474ef741226ac56bd146c79be96c55c00551593b.tar.bz2
scummvm-rg350-474ef741226ac56bd146c79be96c55c00551593b.zip
ZVISION: Check the validity of ZIX files
-rw-r--r--engines/zvision/file/search_manager.cpp11
-rw-r--r--engines/zvision/file/search_manager.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/engines/zvision/file/search_manager.cpp b/engines/zvision/file/search_manager.cpp
index aecfff5208..80792b07d8 100644
--- a/engines/zvision/file/search_manager.cpp
+++ b/engines/zvision/file/search_manager.cpp
@@ -134,9 +134,10 @@ bool SearchManager::hasFile(const Common::String &name) {
return false;
}
-void SearchManager::loadZix(const Common::String &name) {
+bool SearchManager::loadZix(const Common::String &name) {
Common::File file;
- file.open(name);
+ if (!file.open(name))
+ return false;
Common::String line;
@@ -147,7 +148,7 @@ void SearchManager::loadZix(const Common::String &name) {
}
if (file.eos())
- return;
+ error("Corrupt ZIX file: %s", name.c_str());
Common::Array<Common::Archive *> archives;
@@ -189,7 +190,7 @@ void SearchManager::loadZix(const Common::String &name) {
}
if (file.eos())
- return;
+ error("Corrupt ZIX file: %s", name.c_str());
while (!file.eos()) {
line = file.readLine();
@@ -202,6 +203,8 @@ void SearchManager::loadZix(const Common::String &name) {
}
}
}
+
+ return true;
}
void SearchManager::addDir(const Common::String &name) {
diff --git a/engines/zvision/file/search_manager.h b/engines/zvision/file/search_manager.h
index 43e7ff4d14..0d0ab14d31 100644
--- a/engines/zvision/file/search_manager.h
+++ b/engines/zvision/file/search_manager.h
@@ -44,7 +44,7 @@ public:
bool openFile(Common::File &file, const Common::String &name);
bool hasFile(const Common::String &name);
- void loadZix(const Common::String &name);
+ bool loadZix(const Common::String &name);
struct Node {
Common::String name;