[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src palmsave.cpp,1.6,1.7
Max Horn
fingolfin at users.sourceforge.net
Sat Nov 29 16:36:03 CET 2003
Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src
In directory sc8-pr-cvs1:/tmp/cvs-serv2650/backends/PalmOS/Src
Modified Files:
palmsave.cpp
Log Message:
cleanup; added (currently commented out) zlib/gzip code
Index: palmsave.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palmsave.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- palmsave.cpp 18 Sep 2003 02:07:14 -0000 1.6
+++ palmsave.cpp 30 Nov 2003 00:35:12 -0000 1.7
@@ -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 @@
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 @@
// 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;
@@ -154,6 +141,10 @@
}
VFSFileClose(fileRef);
+}
+
+SaveFile *SaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
+ return new PalmSaveFile(filename, saveOrLoad);
}
// OSystem
More information about the Scummvm-git-logs
mailing list