[Scummvm-cvs-logs] CVS: scummvm/backends/dc vmsave.cpp,1.16,1.17

Max Horn fingolfin at users.sourceforge.net
Fri Jun 25 15:12:04 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/dc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8728/backends/dc

Modified Files:
	vmsave.cpp 
Log Message:
Cleaned up SaveFileManager stuff a little bit

Index: vmsave.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/vmsave.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- vmsave.cpp	6 Jan 2004 12:45:26 -0000	1.16
+++ vmsave.cpp	25 Jun 2004 22:11:47 -0000	1.17
@@ -222,9 +222,8 @@
   int pos, size;
   char filename[16];
 
-protected:
-  virtual int fread(void *buf, int size, int cnt);
-  virtual int fwrite(const void *buf, int size, int cnt);
+  uint32 read(void *buf, uint32 cnt);
+  uint32 write(const void *buf, uint32 cnt);
 
 public:
   VMSave(const char *_filename, bool _saveOrLoad) 
@@ -258,6 +257,7 @@
 };
 
 class VMSaveManager : public SaveFileManager {
+public:
   virtual SaveFile *open_savefile(const char *filename, const char *directory, bool saveOrLoad);
   virtual void list_savefiles(const char *prefix, const char *directory, bool *marks, int num);
 };
@@ -299,15 +299,15 @@
   delete buffer;
 }
 
-int VMSave::fread(void *buf, int sz, int cnt)
+uint32 VMSave::read(void *buf, uint32 cnt)
 {
   if (issave)
     return -1; 
 
-  int nbyt = sz*cnt;
+  int nbyt = cnt;
   if (pos + nbyt > size) {
-    cnt = (size - pos)/sz;
-    nbyt = sz*cnt;
+    cnt = (size - pos);
+    nbyt = cnt;
   }
   if (nbyt)
     memcpy(buf, buffer + pos, nbyt);
@@ -315,15 +315,15 @@
   return cnt;
 }
 
-int VMSave::fwrite(const void *buf, int sz, int cnt)
+uint32 VMSave::write(const void *buf, uint32 cnt)
 {
   if (!issave)
     return -1;
 
-  int nbyt = sz*cnt;
+  int nbyt = cnt;
   if (pos + nbyt > size) {
-    cnt = (size - pos)/sz;
-    nbyt = sz*cnt;
+    cnt = (size - pos);
+    nbyt = cnt;
   }
   if (nbyt)
     memcpy(buffer + pos, buf, nbyt);





More information about the Scummvm-git-logs mailing list