[Scummvm-cvs-logs] SF.net SVN: scummvm:[38780] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Feb 22 05:40:11 CET 2009


Revision: 38780
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38780&view=rev
Author:   fingolfin
Date:     2009-02-22 04:40:10 +0000 (Sun, 22 Feb 2009)

Log Message:
-----------
Changed Common::File and FSDirectory to invoke FSNode::exists a few times less, reducing overhead

Modified Paths:
--------------
    scummvm/trunk/common/archive.cpp
    scummvm/trunk/common/file.cpp

Modified: scummvm/trunk/common/archive.cpp
===================================================================
--- scummvm/trunk/common/archive.cpp	2009-02-22 04:22:53 UTC (rev 38779)
+++ scummvm/trunk/common/archive.cpp	2009-02-22 04:40:10 UTC (rev 38780)
@@ -141,15 +141,6 @@
 		return 0;
 
 	FSNode node = lookupCache(_fileCache, name);
-
-	if (!node.exists()) {
-		warning("FSDirectory::createReadStreamForMember: FSNode does not exist");
-		return 0;
-	} else if (node.isDirectory()) {
-		warning("FSDirectory::createReadStreamForMember: FSNode is a directory");
-		return 0;
-	}
-
 	SeekableReadStream *stream = node.createReadStream();
 	if (!stream)
 		warning("FSDirectory::createReadStreamForMember: Can't create stream for file '%s'", name.c_str());

Modified: scummvm/trunk/common/file.cpp
===================================================================
--- scummvm/trunk/common/file.cpp	2009-02-22 04:22:53 UTC (rev 38779)
+++ scummvm/trunk/common/file.cpp	2009-02-22 04:40:10 UTC (rev 38780)
@@ -61,14 +61,13 @@
 	clearIOFailed();
 
 	SeekableReadStream *stream = 0;
-	if (archive.hasFile(filename)) {
+	
+	if ((stream = archive.createReadStreamForMember(filename))) {
 		debug(3, "Opening hashed: %s", filename.c_str());
-		stream = archive.createReadStreamForMember(filename);
-	} else if (archive.hasFile(filename + ".")) {
+	} else if ((stream = archive.createReadStreamForMember(filename + "."))) {
 		// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
 		// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
 		debug(3, "Opening hashed: %s.", filename.c_str());
-		stream = archive.createReadStreamForMember(filename + ".");
 	}
 
 	return open(stream, filename);


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