aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2009-02-22 04:40:10 +0000
committerMax Horn2009-02-22 04:40:10 +0000
commitf6de07921e92a57210cc44a0daffc95491136d42 (patch)
treeafb29df8bf3c9cfbdf5cc7d019f569f62fb0627f /common
parentd9a98ddc215cd4244c21673552f31331126abcb9 (diff)
downloadscummvm-rg350-f6de07921e92a57210cc44a0daffc95491136d42.tar.gz
scummvm-rg350-f6de07921e92a57210cc44a0daffc95491136d42.tar.bz2
scummvm-rg350-f6de07921e92a57210cc44a0daffc95491136d42.zip
Changed Common::File and FSDirectory to invoke FSNode::exists a few times less, reducing overhead
svn-id: r38780
Diffstat (limited to 'common')
-rw-r--r--common/archive.cpp9
-rw-r--r--common/file.cpp7
2 files changed, 3 insertions, 13 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index 1fce9c144a..8add12e570 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -141,15 +141,6 @@ SeekableReadStream *FSDirectory::createReadStreamForMember(const String &name) c
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());
diff --git a/common/file.cpp b/common/file.cpp
index 69f4a4a31b..ee741a8990 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -61,14 +61,13 @@ bool File::open(const String &filename, Archive &archive) {
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);