diff options
author | Max Horn | 2009-01-23 03:30:40 +0000 |
---|---|---|
committer | Max Horn | 2009-01-23 03:30:40 +0000 |
commit | e4b013f616818f6da4cf7a1896f31d1429ef8f04 (patch) | |
tree | 81ea72ac2ccb737bd8e2934af9335c1f56f46c18 | |
parent | 3e7155981e020bc19540abc8486b816cb57c8a41 (diff) | |
download | scummvm-rg350-e4b013f616818f6da4cf7a1896f31d1429ef8f04.tar.gz scummvm-rg350-e4b013f616818f6da4cf7a1896f31d1429ef8f04.tar.bz2 scummvm-rg350-e4b013f616818f6da4cf7a1896f31d1429ef8f04.zip |
Renamed OSystem::openConfigFileForReading & openConfigFileForWriting to createConfigReadStream & createConfigWriteStream, in order to make it clear that the *caller* is responsible for deleting the streams (i.e., 'owns' them)
svn-id: r36013
-rw-r--r-- | backends/platform/PalmOS/Src/be_base.cpp | 4 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/be_base.h | 4 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.cpp | 4 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.h | 4 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 6 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.h | 4 | ||||
-rw-r--r-- | backends/platform/psp/osys_psp.cpp | 4 | ||||
-rw-r--r-- | backends/platform/psp/osys_psp.h | 4 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 4 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.h | 4 | ||||
-rw-r--r-- | backends/platform/symbian/src/SymbianOS.cpp | 4 | ||||
-rw-r--r-- | backends/platform/symbian/src/SymbianOS.h | 4 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 4 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.h | 4 | ||||
-rw-r--r-- | common/config-manager.cpp | 4 | ||||
-rw-r--r-- | common/system.cpp | 4 | ||||
-rw-r--r-- | common/system.h | 4 | ||||
-rw-r--r-- | common/util.cpp | 2 |
18 files changed, 37 insertions, 35 deletions
diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp index 9e1fdf39d1..c1a694292f 100644 --- a/backends/platform/PalmOS/Src/be_base.cpp +++ b/backends/platform/PalmOS/Src/be_base.cpp @@ -181,12 +181,12 @@ Common::TimerManager *OSystem_PalmBase::getTimerManager() { #define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini" -Common::SeekableReadStream *OSystem_PalmBase::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() { Common::FSNode file(PALMOS_CONFIG_FILE); return file.openForReading(); } -Common::WriteStream *OSystem_PalmBase::openConfigFileForWriting() { +Common::WriteStream *OSystem_PalmBase::createConfigWriteStream() { Common::FSNode file(PALMOS_CONFIG_FILE); return file.openForWriting(); } diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h index 009c5a9997..36f8a1d080 100644 --- a/backends/platform/PalmOS/Src/be_base.h +++ b/backends/platform/PalmOS/Src/be_base.h @@ -254,8 +254,8 @@ public: Common::SaveFileManager *getSavefileManager(); Common::TimerManager *getTimerManager(); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); }; #endif diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index c9fd0e4dff..48e95074e0 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -1312,12 +1312,12 @@ OSystem *OSystem_IPHONE_create() { return new OSystem_IPHONE(); } -Common::SeekableReadStream *OSystem_IPHONE::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() { Common::FSNode file(SCUMMVM_PREFS_PATH); return file.openForReading(); } -Common::WriteStream *OSystem_IPHONE::openConfigFileForWriting() { +Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() { Common::FSNode file(SCUMMVM_PREFS_PATH); return file.openForWriting(); } diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index 1f16a8d0c3..746a6e848f 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -178,8 +178,8 @@ public: void startSoundsystem(); void stopSoundsystem(); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); protected: inline void addDirtyRect(int16 x1, int16 y1, int16 w, int16 h); diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index e8a7d11318..a9b3b9f29f 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -758,7 +758,7 @@ void OSystem_PS2::quit(void) { } void OSystem_PS2::makeConfigPath(char *dest) { - // FIXME: Maybe merge this method into openConfigFileForReading/openConfigFileForWriting ? + // FIXME: Maybe merge this method into createConfigReadStream/createConfigWriteStream ? FILE *handle; strcpy(dest, "cdfs:/ScummVM.ini"); handle = ps2_fopen(dest, "r"); @@ -772,14 +772,14 @@ void OSystem_PS2::makeConfigPath(char *dest) { strcpy(dest, "mc0:ScummVM/scummvm.ini"); } -Common::SeekableReadStream *OSystem_PS2::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_PS2::createConfigReadStream() { char configFile[MAXPATHLEN]; makeConfigPath(configFile); Common::FSNode file(configFile); return file.openForReading(); } -Common::WriteStream *OSystem_PS2::openConfigFileForWriting() { +Common::WriteStream *OSystem_PS2::createConfigWriteStream() { char configFile[MAXPATHLEN]; makeConfigPath(configFile); Common::FSNode file(configFile); diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index e4ac410caa..fecd7244f8 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -107,8 +107,8 @@ public: virtual void quit(); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<555>(); } diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 72dd05e664..38208718de 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -643,12 +643,12 @@ void OSystem_PSP::displayMessageOnOSD(const char *msg) { #define PSP_CONFIG_FILE "ms0:/scummvm.ini" -Common::SeekableReadStream *OSystem_PSP::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() { Common::FSNode file(PSP_CONFIG_FILE); return file.openForReading(); } -Common::WriteStream *OSystem_PSP::openConfigFileForWriting() { +Common::WriteStream *OSystem_PSP::createConfigWriteStream() { Common::FSNode file(PSP_CONFIG_FILE); return file.openForWriting(); } diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index d91526e41c..626e1a5e63 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -142,7 +142,7 @@ public: virtual void displayMessageOnOSD(const char *msg); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); }; diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 94f358db08..c852ba206d 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -384,12 +384,12 @@ static Common::String getDefaultConfigFileName() { return configFile; } -Common::SeekableReadStream *OSystem_SDL::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_SDL::createConfigReadStream() { Common::FSNode file(getDefaultConfigFileName()); return file.openForReading(); } -Common::WriteStream *OSystem_SDL::openConfigFileForWriting() { +Common::WriteStream *OSystem_SDL::createConfigWriteStream() { Common::FSNode file(getDefaultConfigFileName()); return file.openForWriting(); } diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index b6383d65f8..80a08de821 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -205,8 +205,8 @@ public: virtual FilesystemFactory *getFilesystemFactory(); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); protected: bool _inited; diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 251ba2c48e..b822789b04 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -123,12 +123,12 @@ static Common::String getDefaultConfigFileName() { return configFile; } -Common::SeekableReadStream *OSystem_SDL_Symbian::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_SDL_Symbian::createConfigReadStream() { Common::FSNode file(getDefaultConfigFileName()); return file.openForReading(); } -Common::WriteStream *OSystem_SDL_Symbian::openConfigFileForWriting() { +Common::WriteStream *OSystem_SDL_Symbian::createConfigWriteStream() { Common::FSNode file(getDefaultConfigFileName()); return file.openForWriting(); } diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h index 03d7fb972c..efca94b706 100644 --- a/backends/platform/symbian/src/SymbianOS.h +++ b/backends/platform/symbian/src/SymbianOS.h @@ -70,8 +70,8 @@ protected: static void symbianMixCallback(void *s, byte *samples, int len); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); public: // vibration support #ifdef USE_VIBRA_SE_PXXX diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index b891a83689..7bfa3a97f6 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -463,12 +463,12 @@ static Common::String getDefaultConfigFileName() { return configFile; } -Common::SeekableReadStream *OSystem_WINCE3::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_WINCE3::createConfigReadStream() { Common::FSNode file(getDefaultConfigFileName()); return file.openForReading(); } -Common::WriteStream *OSystem_WINCE3::openConfigFileForWriting() { +Common::WriteStream *OSystem_WINCE3::createConfigWriteStream() { Common::FSNode file(getDefaultConfigFileName()); return file.openForWriting(); } diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 46070e1180..0efb7828fb 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -86,8 +86,8 @@ public: // Overloaded from OSystem //void engineInit(); void getTimeAndDate(struct tm &t) const; - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); // Overloaded from SDL_Common (FIXME) diff --git a/common/config-manager.cpp b/common/config-manager.cpp index e0a8dfa56b..88e5e8512a 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -62,7 +62,7 @@ ConfigManager::ConfigManager() void ConfigManager::loadDefaultConfigFile() { // Open the default config file - SeekableReadStream *stream = g_system->openConfigFileForReading(); + SeekableReadStream *stream = g_system->createConfigReadStream(); _filename.clear(); // clear the filename to indicate that we are using the default config file // ... load it, if available ... @@ -190,7 +190,7 @@ void ConfigManager::flushToDisk() { if (_filename.empty()) { // Write to the default config file - stream = g_system->openConfigFileForWriting(); + stream = g_system->createConfigWriteStream(); if (!stream) // If writing to the config file is not possible, do nothing return; } else { diff --git a/common/system.cpp b/common/system.cpp index 2d55162869..dbbfef54b2 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -114,12 +114,12 @@ void OSystem::clearScreen() { #define DEFAULT_CONFIG_FILE "scummvm.ini" #endif -Common::SeekableReadStream *OSystem::openConfigFileForReading() { +Common::SeekableReadStream *OSystem::createConfigReadStream() { Common::FSNode file(DEFAULT_CONFIG_FILE); return file.openForReading(); } -Common::WriteStream *OSystem::openConfigFileForWriting() { +Common::WriteStream *OSystem::createConfigWriteStream() { #ifdef __DC__ return 0; #else diff --git a/common/system.h b/common/system.h index 155ec81b8a..447feeebe5 100644 --- a/common/system.h +++ b/common/system.h @@ -908,7 +908,7 @@ public: * ReadStream instance. It is the callers responsiblity to delete * the stream after use. */ - virtual Common::SeekableReadStream *openConfigFileForReading(); + virtual Common::SeekableReadStream *createConfigReadStream(); /** * Open the default config file for writing, by returning a suitable @@ -917,7 +917,7 @@ public: * * May return 0 to indicate that writing to config file is not possible. */ - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::WriteStream *createConfigWriteStream(); //@} }; diff --git a/common/util.cpp b/common/util.cpp index 3771c3433b..73e76fa94a 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -27,6 +27,8 @@ #include "common/system.h" #include "gui/debugger.h" +#include <stdarg.h> // For va_list etc. + #ifdef _WIN32_WCE // This is required for the debugger attachment extern bool isSmartphone(void); |