From 655ce26b3f09628d9408a4d82efe3a26116999fe Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 13 Sep 2008 16:51:46 +0000 Subject: Big patch changing the signature of various Stream methods (some ports may need to be slightly tweaked to fix overloading errors/warnings) svn-id: r34514 --- backends/platform/ds/arm9/source/gbampsave.cpp | 10 +++++----- backends/platform/ds/arm9/source/gbampsave.h | 8 ++++---- backends/platform/ds/arm9/source/ramsave.cpp | 10 ++++++---- backends/platform/ds/arm9/source/ramsave.h | 8 ++++---- 4 files changed, 19 insertions(+), 17 deletions(-) (limited to 'backends/platform/ds') diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index 9c8af81a6e..8209b783fa 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -54,8 +54,8 @@ bool GBAMPSaveFile::eos() const { return DS::std_feof(handle); } -void GBAMPSaveFile::skip(uint32 bytes) { - DS::std_fseek(handle, bytes, SEEK_CUR); +bool GBAMPSaveFile::skip(uint32 bytes) { + return DS::std_fseek(handle, bytes, SEEK_CUR) == 0; } void GBAMPSaveFile::flushSaveBuffer() { @@ -67,11 +67,11 @@ void GBAMPSaveFile::flushSaveBuffer() { } } -uint32 GBAMPSaveFile::pos() const { +int32 GBAMPSaveFile::pos() const { return DS::std_ftell(handle); } -uint32 GBAMPSaveFile::size() const { +int32 GBAMPSaveFile::size() const { int position = pos(); DS::std_fseek(handle, 0, SEEK_END); int size = DS::std_ftell(handle); @@ -80,7 +80,7 @@ uint32 GBAMPSaveFile::size() const { } void GBAMPSaveFile::seek(int32 pos, int whence) { - DS::std_fseek(handle, pos, whence); + return DS::std_fseek(handle, pos, whence) == 0; } diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index d0cbc68bfd..6ddc4fd964 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -43,11 +43,11 @@ public: virtual uint32 write(const void *buf, uint32 size); virtual bool eos() const; - virtual void skip(uint32 bytes); + virtual bool skip(uint32 bytes); - virtual uint32 pos() const; - virtual uint32 size() const; - virtual void seek(int32 pos, int whence); + virtual int32 pos() const; + virtual int32 size() const; + virtual bool seek(int32 pos, int whence); void flushSaveBuffer(); diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp index be355ce76f..8442fd6b88 100644 --- a/backends/platform/ds/arm9/source/ramsave.cpp +++ b/backends/platform/ds/arm9/source/ramsave.cpp @@ -181,15 +181,15 @@ uint32 DSSaveFile::read(void *buf, uint32 size) { return size; } -uint32 DSSaveFile::pos() const { +int32 DSSaveFile::pos() const { return ptr; } -uint32 DSSaveFile::size() const { +int32 DSSaveFile::size() const { return save.size; } -void DSSaveFile::seek(int32 pos, int whence) { +bool DSSaveFile::seek(int32 pos, int whence) { switch (whence) { case SEEK_SET: { ptr = pos; @@ -204,15 +204,17 @@ void DSSaveFile::seek(int32 pos, int whence) { break; } } + return true; } bool DSSaveFile::eos() const { return ptr >= (int) save.size; } -void DSSaveFile::skip(uint32 bytes) { +bool DSSaveFile::skip(uint32 bytes) { ptr = ptr + bytes; if (ptr > (int) save.size) ptr = save.size; + return true; } uint32 DSSaveFile::write(const void *buf, uint32 size) { diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h index f919da18db..e276775b66 100644 --- a/backends/platform/ds/arm9/source/ramsave.h +++ b/backends/platform/ds/arm9/source/ramsave.h @@ -62,11 +62,11 @@ public: bool isOpen() const { return isOpenFlag; } virtual bool eos() const; - virtual void skip(uint32 size); + virtual bool skip(uint32 size); - virtual uint32 pos() const; - virtual uint32 size() const; - virtual void seek(int32 pos, int whence); + virtual int32 pos() const; + virtual int32 size() const; + virtual bool seek(int32 pos, int whence); uint32 read(void *buf, uint32 size); uint32 write(const void *buf, uint32 size); -- cgit v1.2.3