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/dc | |
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/dc')
-rw-r--r-- | backends/platform/dc/vmsave.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index 5fe532e1f1..d17e1f6213 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -269,6 +269,7 @@ class InVMSave : public Common::InSaveFile { private: char *buffer; int _pos, _size; + bool _eos; uint32 read(void *buf, uint32 cnt); bool skip(uint32 offset); @@ -276,7 +277,7 @@ private: public: InVMSave() - : _pos(0), buffer(NULL) + : _pos(0), buffer(NULL), _eos(false) { } ~InVMSave() @@ -285,7 +286,8 @@ public: delete[] buffer; } - bool eos() const { return _pos >= _size; } + bool eos() const { return _eos; } + void clearErr() { _eos = false; } int32 pos() const { return _pos; } int32 size() const { return _size; } @@ -312,8 +314,8 @@ public: ~OutVMSave(); - bool ioFailed() const { return iofailed; } - void clearIOFailed() { iofailed = false; } + bool err() const { return iofailed; } + void clearErr() { iofailed = false; } void finalize(); }; @@ -370,6 +372,7 @@ uint32 InVMSave::read(void *buf, uint32 cnt) int nbyt = cnt; if (_pos + nbyt > _size) { cnt = (_size - _pos); + _eos = true; nbyt = cnt; } if (nbyt) @@ -404,6 +407,7 @@ bool InVMSave::seek(int32 offs, int whence) _pos = 0; else if (_pos > _size) _pos = _size; + _eos = false; return true; } |