aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2009-06-24 21:48:13 +0000
committerSven Hesse2009-06-24 21:48:13 +0000
commit53c4e66b71bf6fa42ef0281ec848cf2ed2fc3286 (patch)
tree4c4690c1b80d0eae7cb48604a6b6177327a8c8cd /engines
parent483c3a51c39da67b53a97f89108e4b5817706225 (diff)
downloadscummvm-rg350-53c4e66b71bf6fa42ef0281ec848cf2ed2fc3286.tar.gz
scummvm-rg350-53c4e66b71bf6fa42ef0281ec848cf2ed2fc3286.tar.bz2
scummvm-rg350-53c4e66b71bf6fa42ef0281ec848cf2ed2fc3286.zip
Checking for the file's existence in DataIO::getDataStream()
svn-id: r41837
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/dataio.cpp3
-rw-r--r--engines/gob/script.cpp5
-rw-r--r--engines/gob/totfile.cpp8
3 files changed, 10 insertions, 6 deletions
diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp
index 0a0b8b8c49..493da55f45 100644
--- a/engines/gob/dataio.cpp
+++ b/engines/gob/dataio.cpp
@@ -585,6 +585,9 @@ byte *DataIO::getData(const char *path) {
}
DataStream *DataIO::getDataStream(const char *path) {
+ if (!path || (path[0] == '\0') || !existData(path))
+ return 0;
+
uint32 size = getDataSize(path);
byte *data = getData(path);
diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp
index 134ad428ce..d4409b0a4e 100644
--- a/engines/gob/script.cpp
+++ b/engines/gob/script.cpp
@@ -508,10 +508,9 @@ uint16 Script::getFunctionOffset(uint8 function) const {
}
uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
- if (!vm->_dataIO->existData(fileName))
- return 0;
-
DataStream *stream = vm->_dataIO->getDataStream(fileName);
+ if (!stream)
+ return 0;
stream->seek(0x2C);
uint32 variablesCount = stream->readUint32LE();
diff --git a/engines/gob/totfile.cpp b/engines/gob/totfile.cpp
index 2506c00b19..0a955b086d 100644
--- a/engines/gob/totfile.cpp
+++ b/engines/gob/totfile.cpp
@@ -44,9 +44,11 @@ TOTFile::~TOTFile() {
}
bool TOTFile::load(const Common::String &fileName) {
- if (_vm->_dataIO->existData(fileName.c_str()))
- _stream = _vm->_dataIO->getDataStream(fileName.c_str());
- else
+ // Trying to open normally
+ _stream = _vm->_dataIO->getDataStream(fileName.c_str());
+
+ if (!_stream)
+ // Trying to open from video video
_stream = _vm->_vidPlayer->getExtraData(fileName.c_str());
if (!_stream)