[Scummvm-cvs-logs] SF.net SVN: scummvm:[41837] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Wed Jun 24 23:48:13 CEST 2009


Revision: 41837
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41837&view=rev
Author:   drmccoy
Date:     2009-06-24 21:48:13 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
Checking for the file's existence in DataIO::getDataStream()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/dataio.cpp
    scummvm/trunk/engines/gob/script.cpp
    scummvm/trunk/engines/gob/totfile.cpp

Modified: scummvm/trunk/engines/gob/dataio.cpp
===================================================================
--- scummvm/trunk/engines/gob/dataio.cpp	2009-06-24 21:47:54 UTC (rev 41836)
+++ scummvm/trunk/engines/gob/dataio.cpp	2009-06-24 21:48:13 UTC (rev 41837)
@@ -585,6 +585,9 @@
 }
 
 DataStream *DataIO::getDataStream(const char *path) {
+	if (!path || (path[0] == '\0') || !existData(path))
+		return 0;
+
 	uint32 size = getDataSize(path);
 	byte *data = getData(path);
 

Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp	2009-06-24 21:47:54 UTC (rev 41836)
+++ scummvm/trunk/engines/gob/script.cpp	2009-06-24 21:48:13 UTC (rev 41837)
@@ -508,11 +508,10 @@
 }
 
 uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
-	if (!vm->_dataIO->existData(fileName))
+	DataStream *stream = vm->_dataIO->getDataStream(fileName);
+	if (!stream)
 		return 0;
 
-	DataStream *stream = vm->_dataIO->getDataStream(fileName);
-
 	stream->seek(0x2C);
 	uint32 variablesCount = stream->readUint32LE();
 	delete stream;

Modified: scummvm/trunk/engines/gob/totfile.cpp
===================================================================
--- scummvm/trunk/engines/gob/totfile.cpp	2009-06-24 21:47:54 UTC (rev 41836)
+++ scummvm/trunk/engines/gob/totfile.cpp	2009-06-24 21:48:13 UTC (rev 41837)
@@ -44,9 +44,11 @@
 }
 
 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)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list