diff options
author | Willem Jan Palenstijn | 2008-09-14 22:28:53 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2008-09-14 22:28:53 +0000 |
commit | c8eeae8d4dffa5849a23cf963884027a7789504b (patch) | |
tree | 1f2a0de23851cb7e7d1d77114c8379aa27f4fb85 /backends/platform/ds | |
parent | fbfe30bf861af9b83325e0c7fecd4b0a68da5af9 (diff) | |
download | scummvm-rg350-c8eeae8d4dffa5849a23cf963884027a7789504b.tar.gz scummvm-rg350-c8eeae8d4dffa5849a23cf963884027a7789504b.tar.bz2 scummvm-rg350-c8eeae8d4dffa5849a23cf963884027a7789504b.zip |
Big patch changing semantics of ReadStream::eos():
eos() now only returns true _after_ trying to read past the end of the stream.
This has a large potential for regressions. Please test!
svn-id: r34549
Diffstat (limited to 'backends/platform/ds')
-rw-r--r-- | backends/platform/ds/arm9/source/ramsave.cpp | 10 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/ramsave.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp index 8442fd6b88..30c3a06721 100644 --- a/backends/platform/ds/arm9/source/ramsave.cpp +++ b/backends/platform/ds/arm9/source/ramsave.cpp @@ -64,6 +64,7 @@ DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) { } isTempFile = false; + eosReached = false; } DSSaveFile::~DSSaveFile() { @@ -167,11 +168,13 @@ int DSSaveFile::saveToSaveRAM(vu8* address) { void DSSaveFile::reset() { ptr = 0; + eosReached = false; } uint32 DSSaveFile::read(void *buf, uint32 size) { if (ptr + size > save.size) { size = save.size - ptr; + eosReached = true; if (size < 0) size = 0; } memcpy(buf, saveData + ptr, size); @@ -204,11 +207,16 @@ bool DSSaveFile::seek(int32 pos, int whence) { break; } } + eosReached = false; return true; } bool DSSaveFile::eos() const { - return ptr >= (int) save.size; + return eosReached; +} + +void DSSaveFile::clearErr() { + eosReached = false; } bool DSSaveFile::skip(uint32 bytes) { diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h index e276775b66..98430b9d11 100644 --- a/backends/platform/ds/arm9/source/ramsave.h +++ b/backends/platform/ds/arm9/source/ramsave.h @@ -52,6 +52,7 @@ class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile { SCUMMSave* origHeader; bool isOpenFlag; bool isTempFile; + bool eosReached; public: DSSaveFile(); @@ -62,6 +63,7 @@ public: bool isOpen() const { return isOpenFlag; } virtual bool eos() const; + virtual void clearErr(); virtual bool skip(uint32 size); virtual int32 pos() const; |