diff options
author | Max Horn | 2003-11-30 00:35:12 +0000 |
---|---|---|
committer | Max Horn | 2003-11-30 00:35:12 +0000 |
commit | 3612dc54dcc1fbf9f863127bd919c7921fe11988 (patch) | |
tree | ff04db84a69a7285b4c3b9d820db77215892be00 /backends/PalmOS/Src | |
parent | 81f210544a1996f33905f6b8840d218239529cfb (diff) | |
download | scummvm-rg350-3612dc54dcc1fbf9f863127bd919c7921fe11988.tar.gz scummvm-rg350-3612dc54dcc1fbf9f863127bd919c7921fe11988.tar.bz2 scummvm-rg350-3612dc54dcc1fbf9f863127bd919c7921fe11988.zip |
cleanup; added (currently commented out) zlib/gzip code
svn-id: r11433
Diffstat (limited to 'backends/PalmOS/Src')
-rw-r--r-- | backends/PalmOS/Src/palmsave.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/backends/PalmOS/Src/palmsave.cpp b/backends/PalmOS/Src/palmsave.cpp index 44e4260300..97a3518829 100644 --- a/backends/PalmOS/Src/palmsave.cpp +++ b/backends/PalmOS/Src/palmsave.cpp @@ -32,10 +32,10 @@ class PalmSaveFile : public SaveFile { public: - PalmSaveFile(const char *filename, const char *mode); + PalmSaveFile(const char *filename, bool saveOrLoad); ~PalmSaveFile(); - bool is_open() { return file != NULL; } + bool isOpen() const { return file != NULL; } protected: int fread(void *buf, int size, int cnt); int fwrite(const void *buf, int size, int cnt); @@ -47,12 +47,12 @@ private : bool _needDump; }; -PalmSaveFile::PalmSaveFile(const char *filename, const char *mode) { +PalmSaveFile::PalmSaveFile(const char *filename, bool saveOrLoad) { _readWriteData = NULL; _readWritePos = 0; _needDump = false; - file = ::fopen(filename, mode); + file = ::fopen(filename, (saveOrLoad ? "wb" : "rb")); } PalmSaveFile::~PalmSaveFile() { @@ -97,25 +97,12 @@ int PalmSaveFile::fwrite(const void *buf, int size, int cnt) { // SaveFileManager class class PalmSaveFileManager : public SaveFileManager { - public: - SaveFile *open_savefile(const char *filename, const char *dirname, bool saveOrLoad); void list_savefiles(const char *prefix, const char *directory, bool *marks, int num); -}; - -SaveFile *PalmSaveFileManager::open_savefile(const char *filename, const char *dirname, bool saveOrLoad) { - char buf[256]; - - join_paths(filename, dirname, buf, sizeof(buf)); - PalmSaveFile *sf = new PalmSaveFile(buf, (saveOrLoad? "wb":"rb")); - - if(!sf->is_open()) { - delete sf; - sf = NULL; - } - return sf; -} +protected: + SaveFile *makeSaveFile(const char *filename, bool saveOrLoad); +}; void PalmSaveFileManager::list_savefiles(const char *prefix, const char *directory, bool *marks, int num) { FileRef fileRef; @@ -156,6 +143,10 @@ void PalmSaveFileManager::list_savefiles(const char *prefix, const char *directo VFSFileClose(fileRef); } +SaveFile *SaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) { + return new PalmSaveFile(filename, saveOrLoad); +} + // OSystem SaveFileManager *OSystem_PALMOS::get_savefile_manager() { return new PalmSaveFileManager(); |