diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index 330b9a5d6ae..7034d90a30c 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -252,7 +252,7 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) { _mode->bitmapName = node->values["bitmap"]; - SeekableReadStream *file = _keyboard->_fileArchive->openFile(_mode->bitmapName); + SeekableReadStream *file = _keyboard->_fileArchive->createReadStreamForMember(_mode->bitmapName); if (!file) return parserError("Bitmap '%s' not found", _mode->bitmapName.c_str()); diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index b03c2fe4454..1314ab73707 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -103,7 +103,7 @@ bool VirtualKeyboard::loadKeyboardPack(String packName) { #ifdef USE_ZLIB _fileArchive = new ZipArchive(vkDir.getChild(packName + ".zip")); if (_fileArchive->hasFile(packName + ".xml")) { - if (!_parser->loadStream(_fileArchive->openFile(packName + ".xml"))) + if (!_parser->loadStream(_fileArchive->createReadStreamForMember(packName + ".xml"))) return false; } else { warning("Could not find %s.xml file in %s.zip keyboard pack", packName.c_str(), packName.c_str()); diff --git a/common/archive.cpp b/common/archive.cpp index 614215685a8..d8b2c61dd12 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -39,7 +39,7 @@ String GenericArchiveMember::getName() const { } SeekableReadStream *GenericArchiveMember::createReadStream() const { - return _parent->openFile(_name); + return _parent->createReadStreamForMember(_name); } @@ -136,23 +136,23 @@ ArchiveMemberPtr FSDirectory::getMember(const String &name) { return ArchiveMemberPtr(new FSNode(node)); } -SeekableReadStream *FSDirectory::openFile(const String &name) const { +SeekableReadStream *FSDirectory::createReadStreamForMember(const String &name) const { if (name.empty() || !_node.isDirectory()) return 0; FSNode node = lookupCache(_fileCache, name); if (!node.exists()) { - warning("FSDirectory::openFile: FSNode does not exist"); + warning("FSDirectory::createReadStreamForMember: FSNode does not exist"); return 0; } else if (node.isDirectory()) { - warning("FSDirectory::openFile: FSNode is a directory"); + warning("FSDirectory::createReadStreamForMember: FSNode is a directory"); return 0; } SeekableReadStream *stream = node.createReadStream(); if (!stream) - warning("FSDirectory::openFile: Can't create stream for file '%s'", name.c_str()); + warning("FSDirectory::createReadStreamForMember: Can't create stream for file '%s'", name.c_str()); return stream; } @@ -434,14 +434,14 @@ ArchiveMemberPtr SearchSet::getMember(const String &name) { return ArchiveMemberPtr(); } -SeekableReadStream *SearchSet::openFile(const String &name) const { +SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) const { if (name.empty()) return 0; ArchiveNodeList::iterator it = _list.begin(); for ( ; it != _list.end(); ++it) { if (it->_arc->hasFile(name)) - return it->_arc->openFile(name); + return it->_arc->createReadStreamForMember(name); } return 0; diff --git a/common/archive.h b/common/archive.h index ea556d199ff..36bc5bc7c93 100644 --- a/common/archive.h +++ b/common/archive.h @@ -95,7 +95,7 @@ public: /** * Add all the names present in the Archive which match pattern to - * list. Returned names can be used as parameters to openFile. + * list. Returned names can be used as parameters to createReadStreamForMember. * Must not remove elements from the list. * * @return the number of names added to list @@ -104,7 +104,7 @@ public: /** * Add all the names present in the Archive to list. Returned - * names can be used as parameters to openFile. + * names can be used as parameters to createReadStreamForMember. * Must not remove elements from the list. * * @return the number of names added to list @@ -120,7 +120,7 @@ public: * Create a stream bound to a file in the archive. * @return the newly created input stream */ - virtual SeekableReadStream *openFile(const String &name) const = 0; + virtual SeekableReadStream *createReadStreamForMember(const String &name) const = 0; }; @@ -194,10 +194,10 @@ public: virtual ArchiveMemberPtr getMember(const String &name); /** - * Implements openFile from Archive base class. The current policy is + * Implements createReadStreamForMember from Archive base class. The current policy is * opening the first file encountered that matches the name. */ - virtual SeekableReadStream *openFile(const String &name) const; + virtual SeekableReadStream *createReadStreamForMember(const String &name) const; }; diff --git a/common/file.cpp b/common/file.cpp index 6184004b355..0cec608d89d 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -62,12 +62,12 @@ bool File::open(const String &filename, Archive &archive) { SeekableReadStream *stream = 0; if (archive.hasFile(filename)) { debug(3, "Opening hashed: %s", filename.c_str()); - stream = archive.openFile(filename); + stream = archive.createReadStreamForMember(filename); } else if (archive.hasFile(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.openFile(filename + "."); + stream = archive.createReadStreamForMember(filename + "."); } return open(stream, filename); diff --git a/common/fs.h b/common/fs.h index 61ce21bec59..b8e6aeecc46 100644 --- a/common/fs.h +++ b/common/fs.h @@ -243,7 +243,7 @@ public: * Again, only SLASHES are used as separators independently from the * underlying file system. * - * Relative paths can be specified when calling matching functions like openFile(), + * Relative paths can be specified when calling matching functions like createReadStreamForMember(), * hasFile(), listMatchingMembers() and listMembers(). Please see the function * specific comments for more information. * @@ -333,7 +333,7 @@ public: * Open the specified file. A full match of relative path and filename is needed * for success. */ - virtual SeekableReadStream *openFile(const String &name) const; + virtual SeekableReadStream *createReadStreamForMember(const String &name) const; }; diff --git a/common/unarj.cpp b/common/unarj.cpp index e69869a720b..4a969a6ef02 100644 --- a/common/unarj.cpp +++ b/common/unarj.cpp @@ -350,7 +350,7 @@ bool ArjFile::open(const Common::String &filename) { error("Attempt to open another instance of archive"); if (_fallBack) { - _uncompressed = SearchMan.openFile(filename); + _uncompressed = SearchMan.createReadStreamForMember(filename); if (_uncompressed) return true; } diff --git a/common/unzip.cpp b/common/unzip.cpp index 9b102872f8e..0fff54fbe3a 100644 --- a/common/unzip.cpp +++ b/common/unzip.cpp @@ -1376,7 +1376,7 @@ public: */ ZipArchive::ZipArchive(const Common::String &name) { - SeekableReadStream *stream = SearchMan.openFile(name); + SeekableReadStream *stream = SearchMan.createReadStreamForMember(name); _zipFile = unzOpen(stream); } @@ -1428,7 +1428,7 @@ ArchiveMemberPtr ZipArchive::getMember(const String &name) { return ArchiveMemberPtr(new GenericArchiveMember(name, this)); } -Common::SeekableReadStream *ZipArchive::openFile(const Common::String &name) const { +Common::SeekableReadStream *ZipArchive::createReadStreamForMember(const Common::String &name) const { if (!_zipFile) return 0; diff --git a/common/unzip.h b/common/unzip.h index 970a84ad577..94d098208ab 100644 --- a/common/unzip.h +++ b/common/unzip.h @@ -62,7 +62,7 @@ public: virtual bool hasFile(const String &name); virtual int listMembers(ArchiveMemberList &list); virtual ArchiveMemberPtr getMember(const String &name); - virtual SeekableReadStream *openFile(const String &name) const; + virtual SeekableReadStream *createReadStreamForMember(const String &name) const; }; } // End of namespace Common diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 10085d3b8eb..1385af795bc 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -31,7 +31,7 @@ namespace Common { bool XMLParser::loadFile(const Common::String &filename) { - _stream = SearchMan.openFile(filename); + _stream = SearchMan.createReadStreamForMember(filename); if (!_stream) return false; diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index e319b890237..6e1623e9844 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -311,7 +311,7 @@ bool Resource::loadFileToBuf(const char *file, void *buf, uint32 maxSize) { } Common::SeekableReadStream *Resource::getFileStream(const Common::String &file) { - return _files.openFile(file); + return _files.createReadStreamForMember(file); } Common::Archive *Resource::loadArchive(const Common::String &name, Common::SharedPtr member) { diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index 68a4a558865..4f435e8927a 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -69,7 +69,7 @@ Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) { return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); } -Common::SeekableReadStream *PlainArchive::openFile(const Common::String &name) const { +Common::SeekableReadStream *PlainArchive::createReadStreamForMember(const Common::String &name) const { FileMap::const_iterator fDesc = _files.find(name); if (fDesc == _files.end()) return 0; @@ -124,7 +124,7 @@ Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) { return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); } -Common::SeekableReadStream *CachedArchive::openFile(const Common::String &name) const { +Common::SeekableReadStream *CachedArchive::createReadStreamForMember(const Common::String &name) const { FileMap::const_iterator fDesc = _files.find(name); if (fDesc == _files.end()) return 0; diff --git a/engines/kyra/resource_intern.h b/engines/kyra/resource_intern.h index 6f16a2ba8e6..4f15985dd2c 100644 --- a/engines/kyra/resource_intern.h +++ b/engines/kyra/resource_intern.h @@ -52,7 +52,7 @@ public: bool hasFile(const Common::String &name); int listMembers(Common::ArchiveMemberList &list); Common::ArchiveMemberPtr getMember(const Common::String &name); - Common::SeekableReadStream *openFile(const Common::String &name) const; + Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: struct Entry { uint32 offset; @@ -82,7 +82,7 @@ public: bool hasFile(const Common::String &name); int listMembers(Common::ArchiveMemberList &list); Common::ArchiveMemberPtr getMember(const Common::String &name); - Common::SeekableReadStream *openFile(const Common::String &name) const; + Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: struct Entry { byte *data; diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 1bb40230107..0dca43a55c3 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -101,7 +101,7 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con lookup = name + ext; } - Common::SeekableReadStream *stream = _sset.openFile(lookup); + Common::SeekableReadStream *stream = _sset.createReadStreamForMember(lookup); if (stream) { return stream; } @@ -116,7 +116,7 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con lookup.deleteLastChar(); } lookup += ext; - stream = _sset.openFile(lookup); + stream = _sset.createReadStreamForMember(lookup); } } diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index a526facaad7..94d9f8482b3 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -78,7 +78,7 @@ public: NSArchive(Common::SeekableReadStream *stream, Common::Platform platform, uint32 features); ~NSArchive(); - Common::SeekableReadStream *openFile(const Common::String &name) const; + Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; bool hasFile(const Common::String &name); int listMembers(Common::ArchiveMemberList &list); Common::ArchiveMemberPtr getMember(const Common::String &name); @@ -127,8 +127,8 @@ uint32 NSArchive::lookup(const char *name) const { return i; } -Common::SeekableReadStream *NSArchive::openFile(const Common::String &name) const { - debugC(3, kDebugDisk, "NSArchive::openFile(%s)", name.c_str()); +Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::String &name) const { + debugC(3, kDebugDisk, "NSArchive::createReadStreamForMember(%s)", name.c_str()); if (name.empty()) return 0; @@ -136,7 +136,7 @@ Common::SeekableReadStream *NSArchive::openFile(const Common::String &name) cons uint32 index = lookup(name.c_str()); if (index == _numFiles) return 0; - debugC(9, kDebugDisk, "NSArchive::openFile: '%s' found in slot %i", name.c_str(), index); + debugC(9, kDebugDisk, "NSArchive::createReadStreamForMember: '%s' found in slot %i", name.c_str(), index); int offset = _archiveOffsets[index]; int endOffset = _archiveOffsets[index] + _archiveLenghts[index]; @@ -195,7 +195,7 @@ Common::SeekableReadStream *Disk_ns::openFile(const char *filename) { void Disk_ns::addArchive(const Common::String& name, int priority) { - Common::SeekableReadStream *stream = _sset.openFile(name); + Common::SeekableReadStream *stream = _sset.createReadStreamForMember(name); if (!stream) error("Disk_ns::addArchive() couldn't find archive '%s'", name.c_str()); @@ -257,13 +257,13 @@ void DosDisk_ns::init() { Common::SeekableReadStream *DosDisk_ns::tryOpenFile(const char* name) { debugC(3, kDebugDisk, "DosDisk_ns::tryOpenFile(%s)", name); - Common::SeekableReadStream *stream = _sset.openFile(name); + Common::SeekableReadStream *stream = _sset.createReadStreamForMember(name); if (stream) return stream; char path[PATH_LEN]; sprintf(path, "%s.pp", name); - return _sset.openFile(path); + return _sset.createReadStreamForMember(path); } @@ -896,18 +896,18 @@ GfxObj* AmigaDisk_ns::loadStatic(const char* name) { Common::SeekableReadStream *AmigaDisk_ns::tryOpenFile(const char* name) { debugC(3, kDebugDisk, "AmigaDisk_ns::tryOpenFile(%s)", name); - Common::SeekableReadStream *stream = _sset.openFile(name); + Common::SeekableReadStream *stream = _sset.createReadStreamForMember(name); if (stream) return stream; char path[PATH_LEN]; sprintf(path, "%s.pp", name); - stream = _sset.openFile(path); + stream = _sset.createReadStreamForMember(path); if (stream) return new PowerPackerStream(*stream); sprintf(path, "%s.dd", name); - stream = _sset.openFile(path); + stream = _sset.createReadStreamForMember(path); if (stream) return new PowerPackerStream(*stream); diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index ebe13f29a40..1b5b4675129 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -167,7 +167,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte } /* get file size */ - fi.file = SearchMan.openFile(_fileName); + fi.file = SearchMan.createReadStreamForMember(_fileName); if (!fi.file) { error("Cannot open file %s", _fileName.c_str()); } diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 8cf74983ca4..86ce492033a 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -1010,7 +1010,7 @@ void ScummEngine_v60he::o60_openFile() { // TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls _hInFileTable[slot] = _saveFileMan->openForLoading(filename); if (_hInFileTable[slot] == 0) { - _hInFileTable[slot] = SearchMan.openFile(filename); + _hInFileTable[slot] = SearchMan.createReadStreamForMember(filename); } break; case 2: diff --git a/graphics/video/dxa_player.cpp b/graphics/video/dxa_player.cpp index 397d1232dac..78c2b75fede 100644 --- a/graphics/video/dxa_player.cpp +++ b/graphics/video/dxa_player.cpp @@ -72,7 +72,7 @@ bool DXAPlayer::loadFile(const char *fileName) { closeFile(); - _fileStream = SearchMan.openFile(fileName); + _fileStream = SearchMan.createReadStreamForMember(fileName); if (!_fileStream) return false; diff --git a/graphics/video/flic_player.cpp b/graphics/video/flic_player.cpp index b928981ef3a..f1c051d4801 100644 --- a/graphics/video/flic_player.cpp +++ b/graphics/video/flic_player.cpp @@ -66,7 +66,7 @@ int32 FlicPlayer::getFrameCount() { bool FlicPlayer::loadFile(const char *fileName) { closeFile(); - _fileStream = SearchMan.openFile(fileName); + _fileStream = SearchMan.createReadStreamForMember(fileName); if (!_fileStream) return false; diff --git a/graphics/video/smk_player.cpp b/graphics/video/smk_player.cpp index 143fa04621f..5f162b0815e 100644 --- a/graphics/video/smk_player.cpp +++ b/graphics/video/smk_player.cpp @@ -356,7 +356,7 @@ bool SMKPlayer::loadFile(const char *fileName) { closeFile(); - _fileStream = SearchMan.openFile(fileName); + _fileStream = SearchMan.createReadStreamForMember(fileName); if (!_fileStream) return false; diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 3e61400f9f0..89b666ce58b 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -580,7 +580,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { // If not, try to load the bitmap via the ImageDecoder class. surf = Graphics::ImageDecoder::loadFile(filename); if (!surf && _themeArchive) { - Common::SeekableReadStream *stream = _themeArchive->openFile(filename); + Common::SeekableReadStream *stream = _themeArchive->createReadStreamForMember(filename); if (stream) { surf = Graphics::ImageDecoder::loadFile(*stream); delete stream; @@ -1243,7 +1243,7 @@ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &fil const Graphics::Font *font = 0; if (_themeArchive) - stream = _themeArchive->openFile(filename); + stream = _themeArchive->createReadStreamForMember(filename); if (stream) { font = Graphics::NewFont::loadFromCache(*stream); delete stream;