From 8f16458e9ba830fe80f177cc2fc3bcf2af84ebef Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 23 Jan 2009 03:41:36 +0000 Subject: [PATCH] Renamed FSNode::openForReading / openForWriting to createReadStream / createWriteStream, again to make ownership of the returned stream clear svn-id: r36014 --- backends/fs/abstract-fs.h | 6 +++--- backends/fs/amigaos4/amigaos4-fs.cpp | 8 ++++---- backends/fs/ds/ds-fs.cpp | 8 ++++---- backends/fs/ds/ds-fs.h | 8 ++++---- backends/fs/palmos/palmos-fs.cpp | 8 ++++---- backends/fs/posix/posix-fs.cpp | 4 ++-- backends/fs/posix/posix-fs.h | 4 ++-- backends/fs/ps2/ps2-fs.cpp | 8 ++++---- backends/fs/psp/psp-fs.cpp | 8 ++++---- backends/fs/symbian/symbian-fs.cpp | 8 ++++---- backends/fs/wii/wii-fs.cpp | 8 ++++---- backends/fs/windows/windows-fs.cpp | 8 ++++---- backends/platform/PalmOS/Src/be_base.cpp | 4 ++-- backends/platform/dc/dc-fs.cpp | 10 +++++----- backends/platform/iphone/osys_iphone.cpp | 4 ++-- backends/platform/ps2/systemps2.cpp | 4 ++-- backends/platform/psp/osys_psp.cpp | 4 ++-- backends/platform/sdl/sdl.cpp | 4 ++-- backends/platform/symbian/src/SymbianOS.cpp | 4 ++-- backends/platform/wince/wince-sdl.cpp | 4 ++-- backends/saves/default/default-saves.cpp | 4 ++-- common/archive.cpp | 2 +- common/file.cpp | 4 ++-- common/fs.cpp | 14 +++++++------- common/fs.h | 10 +++++----- common/md5.cpp | 2 +- common/system.cpp | 4 ++-- common/unzip.cpp | 2 +- common/xmlparser.cpp | 2 +- engines/agi/wagparser.cpp | 2 +- 30 files changed, 85 insertions(+), 85 deletions(-) diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 68478ea8a4e..604d6e20002 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -52,7 +52,7 @@ protected: * When called with a name not matching any of the files/dirs contained in this * directory, a valid node shold be returned, which returns 'false' upon calling * the exists() method. The idea is that this node can then still can be used to - * create a new file via the openForWriting() method. + * create a new file via the createWriteStream() method. * * Example: * Calling getChild() for a node with path "/foo/bar" using name="file.txt", @@ -169,7 +169,7 @@ public: * * @return pointer to the stream object, 0 in case of a failure */ - virtual Common::SeekableReadStream *openForReading() = 0; + virtual Common::SeekableReadStream *createReadStream() = 0; /** * Creates a WriteStream instance corresponding to the file @@ -178,7 +178,7 @@ public: * * @return pointer to the stream object, 0 in case of a failure */ - virtual Common::WriteStream *openForWriting() = 0; + virtual Common::WriteStream *createWriteStream() = 0; }; diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 3b8d7b635c7..d6ae719695a 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -107,8 +107,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); /** * Creates a list with all the volumes present in the root node. @@ -569,11 +569,11 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const { return myList; } -Common::SeekableReadStream *AmigaOSFilesystemNode::openForReading() { +Common::SeekableReadStream *AmigaOSFilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *AmigaOSFilesystemNode::openForWriting() { +Common::WriteStream *AmigaOSFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 3ab1c90038d..79f10fdb626 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -196,11 +196,11 @@ AbstractFSNode* DSFileSystemNode::getParent() const { return p; } -Common::SeekableReadStream *DSFileSystemNode::openForReading() { +Common::SeekableReadStream *DSFileSystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *DSFileSystemNode::openForWriting() { +Common::WriteStream *DSFileSystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } @@ -372,7 +372,7 @@ AbstractFSNode* GBAMPFileSystemNode::getParent() const { return p; } -Common::SeekableReadStream *GBAMPFileSystemNode::openForReading() { +Common::SeekableReadStream *GBAMPFileSystemNode::createReadStream() { // consolePrintf("Opening: %s\n", getPath().c_str()); if (!strncmp(getPath().c_str(), "mp:/", 4)) { @@ -382,7 +382,7 @@ Common::SeekableReadStream *GBAMPFileSystemNode::openForReading() { } } -Common::WriteStream *GBAMPFileSystemNode::openForWriting() { +Common::WriteStream *GBAMPFileSystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index 24d51d9d71a..beea422a14b 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -90,8 +90,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); /** * Returns the zip file this node points to. @@ -155,8 +155,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); }; struct fileHandle { diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index b828213817b..e8b924e1fca 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -68,8 +68,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); private: /** @@ -208,11 +208,11 @@ AbstractFSNode *PalmOSFilesystemNode::getParent() const { return p; } -Common::SeekableReadStream *PalmOSFilesystemNode::openForReading() { +Common::SeekableReadStream *PalmOSFilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *PalmOSFilesystemNode::openForWriting() { +Common::WriteStream *PalmOSFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 446ded779da..b218e9dd591 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -237,11 +237,11 @@ AbstractFSNode *POSIXFilesystemNode::getParent() const { return makeNode(Common::String(start, end)); } -Common::SeekableReadStream *POSIXFilesystemNode::openForReading() { +Common::SeekableReadStream *POSIXFilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *POSIXFilesystemNode::openForWriting() { +Common::WriteStream *POSIXFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/posix/posix-fs.h b/backends/fs/posix/posix-fs.h index 8050f52b416..859e8973b36 100644 --- a/backends/fs/posix/posix-fs.h +++ b/backends/fs/posix/posix-fs.h @@ -73,8 +73,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); private: /** diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index 5246a9bd386..a8dcb4d2bb5 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -100,8 +100,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); }; Ps2FilesystemNode::Ps2FilesystemNode() { @@ -341,10 +341,10 @@ char *Ps2FilesystemNode::getDeviceDescription(const char *path) const { return "Harddisk"; } -Common::SeekableReadStream *Ps2FilesystemNode::openForReading() { +Common::SeekableReadStream *Ps2FilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *Ps2FilesystemNode::openForWriting() { +Common::WriteStream *Ps2FilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index bf08fdd2c68..5c6727d8782 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -71,8 +71,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); }; PSPFilesystemNode::PSPFilesystemNode() { @@ -161,11 +161,11 @@ AbstractFSNode *PSPFilesystemNode::getParent() const { return new PSPFilesystemNode(Common::String(start, end - start), false); } -Common::SeekableReadStream *PSPFilesystemNode::openForReading() { +Common::SeekableReadStream *PSPFilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *PSPFilesystemNode::openForWriting() { +Common::WriteStream *PSPFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 3b57ac03568..edb44d9ba96 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -79,8 +79,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); }; /** @@ -252,11 +252,11 @@ AbstractFSNode *SymbianFilesystemNode::getParent() const { return p; } -Common::SeekableReadStream *SymbianFilesystemNode::openForReading() { +Common::SeekableReadStream *SymbianFilesystemNode::createReadStream() { return SymbianStdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *SymbianFilesystemNode::openForWriting() { +Common::WriteStream *SymbianFilesystemNode::createWriteStream() { return SymbianStdioStream::makeFromPath(getPath().c_str(), true); } #endif //#if defined (__SYMBIAN32__) diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index dac336f0327..7a144cddbfa 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -79,8 +79,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); static void asyncHandler(bool umount, const Common::String *path); }; @@ -290,11 +290,11 @@ AbstractFSNode *WiiFilesystemNode::getParent() const { return new WiiFilesystemNode(Common::String(start, end - start)); } -Common::SeekableReadStream *WiiFilesystemNode::openForReading() { +Common::SeekableReadStream *WiiFilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *WiiFilesystemNode::openForWriting() { +Common::WriteStream *WiiFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 9732efdb6d5..00f72773c35 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -102,8 +102,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting(); + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream(); private: /** @@ -313,11 +313,11 @@ AbstractFSNode *WindowsFilesystemNode::getParent() const { return p; } -Common::SeekableReadStream *WindowsFilesystemNode::openForReading() { +Common::SeekableReadStream *WindowsFilesystemNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } -Common::WriteStream *WindowsFilesystemNode::openForWriting() { +Common::WriteStream *WindowsFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath().c_str(), true); } diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp index c1a694292f9..424c70566ca 100644 --- a/backends/platform/PalmOS/Src/be_base.cpp +++ b/backends/platform/PalmOS/Src/be_base.cpp @@ -183,10 +183,10 @@ Common::TimerManager *OSystem_PalmBase::getTimerManager() { Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() { Common::FSNode file(PALMOS_CONFIG_FILE); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_PalmBase::createConfigWriteStream() { Common::FSNode file(PALMOS_CONFIG_FILE); - return file.openForWriting(); + return file.createWriteStream(); } diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp index 810eed836c3..e21a12fa330 100644 --- a/backends/platform/dc/dc-fs.cpp +++ b/backends/platform/dc/dc-fs.cpp @@ -53,8 +53,8 @@ public: virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const { return false; } virtual AbstractFSNode *getParent() const; - virtual Common::SeekableReadStream *openForReading(); - virtual Common::WriteStream *openForWriting() { return 0; } + virtual Common::SeekableReadStream *createReadStream(); + virtual Common::WriteStream *createWriteStream() { return 0; } static AbstractFSNode *makeFileNodePath(const Common::String &path); }; @@ -67,7 +67,7 @@ public: virtual bool isDirectory() const { return true; } virtual AbstractFSNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual Common::SeekableReadStream *openForReading() { return 0; } + virtual Common::SeekableReadStream *createReadStream() { return 0; } }; /* A file/directory which does not exist */ @@ -77,7 +77,7 @@ public: virtual bool exists() const { return false; } virtual bool isReadable() const { return false; } - virtual Common::SeekableReadStream *openForReading() { return 0; } + virtual Common::SeekableReadStream *createReadStream() { return 0; } }; AbstractFSNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) { @@ -150,7 +150,7 @@ AbstractFSNode *RoninCDFileNode::getParent() const { } -Common::SeekableReadStream *RoninCDFileNode::openForReading() { +Common::SeekableReadStream *RoninCDFileNode::createReadStream() { return StdioStream::makeFromPath(getPath().c_str(), false); } diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index 48e95074e03..226626d5517 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -1314,12 +1314,12 @@ OSystem *OSystem_IPHONE_create() { Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() { Common::FSNode file(SCUMMVM_PREFS_PATH); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() { Common::FSNode file(SCUMMVM_PREFS_PATH); - return file.openForWriting(); + return file.createWriteStream(); } void iphone_main(int argc, char *argv[]) { diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index a9b3b9f29f2..e4852e67fa7 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -776,14 +776,14 @@ Common::SeekableReadStream *OSystem_PS2::createConfigReadStream() { char configFile[MAXPATHLEN]; makeConfigPath(configFile); Common::FSNode file(configFile); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_PS2::createConfigWriteStream() { char configFile[MAXPATHLEN]; makeConfigPath(configFile); Common::FSNode file(configFile); - return file.openForWriting(); + return file.createWriteStream(); } bool OSystem_PS2::runningFromHost(void) { diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 38208718de8..de7ec0631c9 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -645,10 +645,10 @@ void OSystem_PSP::displayMessageOnOSD(const char *msg) { Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() { Common::FSNode file(PSP_CONFIG_FILE); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_PSP::createConfigWriteStream() { Common::FSNode file(PSP_CONFIG_FILE); - return file.openForWriting(); + return file.createWriteStream(); } diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c852ba206de..13ad2840608 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -386,12 +386,12 @@ static Common::String getDefaultConfigFileName() { Common::SeekableReadStream *OSystem_SDL::createConfigReadStream() { Common::FSNode file(getDefaultConfigFileName()); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_SDL::createConfigWriteStream() { Common::FSNode file(getDefaultConfigFileName()); - return file.openForWriting(); + return file.createWriteStream(); } void OSystem_SDL::setWindowCaption(const char *caption) { diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index b822789b044..43a27c54361 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -125,12 +125,12 @@ static Common::String getDefaultConfigFileName() { Common::SeekableReadStream *OSystem_SDL_Symbian::createConfigReadStream() { Common::FSNode file(getDefaultConfigFileName()); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_SDL_Symbian::createConfigWriteStream() { Common::FSNode file(getDefaultConfigFileName()); - return file.openForWriting(); + return file.createWriteStream(); } OSystem_SDL_Symbian::zoneDesc OSystem_SDL_Symbian::_zones[TOTAL_ZONES] = { diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 7bfa3a97f64..a67f09fd751 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -465,12 +465,12 @@ static Common::String getDefaultConfigFileName() { Common::SeekableReadStream *OSystem_WINCE3::createConfigReadStream() { Common::FSNode file(getDefaultConfigFileName()); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem_WINCE3::createConfigWriteStream() { Common::FSNode file(getDefaultConfigFileName()); - return file.openForWriting(); + return file.createWriteStream(); } // ******************************************************************************************** diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index b7949e31141..a35b76c98ac 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -84,7 +84,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename) Common::FSNode file = savePath.getChild(filename); // Open the file for reading - Common::SeekableReadStream *sf = file.openForReading(); + Common::SeekableReadStream *sf = file.createReadStream(); return Common::wrapCompressedReadStream(sf); } @@ -99,7 +99,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) Common::FSNode file = savePath.getChild(filename); // Open the file for saving - Common::WriteStream *sf = file.openForWriting(); + Common::WriteStream *sf = file.createWriteStream(); return Common::wrapCompressedWriteStream(sf); } diff --git a/common/archive.cpp b/common/archive.cpp index d9d0a0a1d85..1a78f4629a5 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -150,7 +150,7 @@ SeekableReadStream *FSDirectory::openFile(const String &name) { return 0; } - SeekableReadStream *stream = node.openForReading(); + SeekableReadStream *stream = node.createReadStream(); if (!stream) warning("FSDirectory::openFile: Can't create stream for file '%s'", name.c_str()); diff --git a/common/file.cpp b/common/file.cpp index 51736ccd672..6184004b355 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -84,7 +84,7 @@ bool File::open(const FSNode &node) { return false; } - SeekableReadStream *stream = node.openForReading(); + SeekableReadStream *stream = node.createReadStream(); return open(stream, node.getPath()); } @@ -192,7 +192,7 @@ bool DumpFile::open(const FSNode &node) { return false; } - _handle = node.openForWriting(); + _handle = node.createWriteStream(); if (_handle == NULL) debug(2, "File %s not found", node.getName().c_str()); diff --git a/common/fs.cpp b/common/fs.cpp index de553d42b79..f911b544b00 100644 --- a/common/fs.cpp +++ b/common/fs.cpp @@ -135,31 +135,31 @@ bool FSNode::isWritable() const { return _realNode->isWritable(); } -Common::SeekableReadStream *FSNode::openForReading() const { +Common::SeekableReadStream *FSNode::createReadStream() const { if (_realNode == 0) return 0; if (!_realNode->exists()) { - warning("FSNode::openForReading: FSNode does not exist"); + warning("FSNode::createReadStream: FSNode does not exist"); return false; } else if (_realNode->isDirectory()) { - warning("FSNode::openForReading: FSNode is a directory"); + warning("FSNode::createReadStream: FSNode is a directory"); return false; } - return _realNode->openForReading(); + return _realNode->createReadStream(); } -Common::WriteStream *FSNode::openForWriting() const { +Common::WriteStream *FSNode::createWriteStream() const { if (_realNode == 0) return 0; if (_realNode->isDirectory()) { - warning("FSNode::openForWriting: FSNode is a directory"); + warning("FSNode::createWriteStream: FSNode is a directory"); return 0; } - return _realNode->openForWriting(); + return _realNode->createWriteStream(); } } // End of namespace Common diff --git a/common/fs.h b/common/fs.h index d530cbae4f9..72b492e9c4e 100644 --- a/common/fs.h +++ b/common/fs.h @@ -109,9 +109,9 @@ public: * If a child matching the name exists, a normal node for it is returned. * If no child with the name exists, a node for it is still returned, * but exists() will return 'false' for it. This node can however be used - * to create a new file using the openForWriting() method. + * to create a new file using the createWriteStream() method. * - * @todo If openForWriting() (or a hypothetical future mkdir() method) is used, + * @todo If createWriteStream() (or a hypothetical future mkdir() method) is used, * this should affect what exists/isDirectory/isReadable/isWritable return * for existing nodes. However, this is not the case for many existing * FSNode implementations. Either fix those, or document that FSNodes @@ -213,7 +213,7 @@ public: * * @return pointer to the stream object, 0 in case of a failure */ - virtual SeekableReadStream *openForReading() const; + virtual SeekableReadStream *createReadStream() const; /** * Creates a WriteStream instance corresponding to the file @@ -222,11 +222,11 @@ public: * * @return pointer to the stream object, 0 in case of a failure */ - virtual WriteStream *openForWriting() const; + virtual WriteStream *createWriteStream() const; // Compatibility with ArchiveMember API. SeekableReadStream *open() { - return openForReading(); + return createReadStream(); } }; diff --git a/common/md5.cpp b/common/md5.cpp index daaf176b7cf..a1b60816c67 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -258,7 +258,7 @@ bool md5_file(const FSNode &file, uint8 digest[16], uint32 length) { return false; } - ReadStream *stream = file.openForReading(); + ReadStream *stream = file.createReadStream(); if (!stream) { warning("md5_file: failed to open '%s'", file.getPath().c_str()); return false; diff --git a/common/system.cpp b/common/system.cpp index dbbfef54b21..1c89c4048db 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -116,7 +116,7 @@ void OSystem::clearScreen() { Common::SeekableReadStream *OSystem::createConfigReadStream() { Common::FSNode file(DEFAULT_CONFIG_FILE); - return file.openForReading(); + return file.createReadStream(); } Common::WriteStream *OSystem::createConfigWriteStream() { @@ -124,6 +124,6 @@ Common::WriteStream *OSystem::createConfigWriteStream() { return 0; #else Common::FSNode file(DEFAULT_CONFIG_FILE); - return file.openForWriting(); + return file.createWriteStream(); #endif } diff --git a/common/unzip.cpp b/common/unzip.cpp index abb2096f4a0..25e26ec24c0 100644 --- a/common/unzip.cpp +++ b/common/unzip.cpp @@ -1381,7 +1381,7 @@ ZipArchive::ZipArchive(const Common::String &name) { } ZipArchive::ZipArchive(const Common::FSNode &node) { - SeekableReadStream *stream = node.openForReading(); + SeekableReadStream *stream = node.createReadStream(); _zipFile = unzOpen(stream); } diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 91cd6aa4585..10085d3b8eb 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -40,7 +40,7 @@ bool XMLParser::loadFile(const Common::String &filename) { } bool XMLParser::loadFile(const FSNode &node) { - _stream = node.openForReading(); + _stream = node.createReadStream(); if (!_stream) return false; diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp index adf5a0a6cf8..5ada824f3b1 100644 --- a/engines/agi/wagparser.cpp +++ b/engines/agi/wagparser.cpp @@ -180,7 +180,7 @@ bool WagFileParser::parse(const Common::FSNode &node) { _parsedOk = false; // We haven't parsed the file yet - stream = node.openForReading(); // Open the file + stream = node.createReadStream(); // Open the file if (stream) { // Check that opening the file was succesful if (checkWagVersion(*stream)) { // Check that WinAGI version string is valid // It seems we've got a valid *.wag file so let's parse its properties from the start.