diff options
author | Filippos Karapetis | 2015-01-07 23:46:49 +0200 |
---|---|---|
committer | Filippos Karapetis | 2015-01-07 23:49:13 +0200 |
commit | 474ef741226ac56bd146c79be96c55c00551593b (patch) | |
tree | 7063de40b86e4fb4a9e3e349e9d76a5ad13d1d7b /engines | |
parent | 07ad10babe6eed96ac1d3ff8e9fc9580ec21b7bd (diff) | |
download | scummvm-rg350-474ef741226ac56bd146c79be96c55c00551593b.tar.gz scummvm-rg350-474ef741226ac56bd146c79be96c55c00551593b.tar.bz2 scummvm-rg350-474ef741226ac56bd146c79be96c55c00551593b.zip |
ZVISION: Check the validity of ZIX files
Diffstat (limited to 'engines')
-rw-r--r-- | engines/zvision/file/search_manager.cpp | 11 | ||||
-rw-r--r-- | engines/zvision/file/search_manager.h | 2 |
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; |