From 088a1c0806d808ed12b88efd51a35768b700e8d8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 6 Sep 2008 20:34:21 +0000 Subject: ScummFile: Don't use the File::_ioFailed flag, rather track the io status separately; also, changed eof() -> eos() svn-id: r34389 --- engines/scumm/file.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/scumm/file.cpp') diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index bf13308a0c..075b44d24d 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -125,8 +125,8 @@ bool ScummFile::openSubFile(const Common::String &filename) { } -bool ScummFile::eof() { - return _subFileLen ? (pos() >= _subFileLen) : File::eof(); +bool ScummFile::eos() { + return _subFileLen ? (pos() >= _subFileLen) : File::eos(); } uint32 ScummFile::pos() { @@ -167,7 +167,7 @@ uint32 ScummFile::read(void *dataPtr, uint32 dataSize) { uint32 newPos = curPos + dataSize; if (newPos > _subFileLen) { dataSize = _subFileLen - curPos; - _ioFailed = true; + _myIoFailed = true; } } -- cgit v1.2.3 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 --- engines/scumm/file.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/scumm/file.cpp') diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 075b44d24d..22079332e4 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -42,9 +42,9 @@ void ScummFile::setEnc(byte value) { _encbyte = value; } -void ScummFile::setSubfileRange(uint32 start, uint32 len) { +void ScummFile::setSubfileRange(int32 start, int32 len) { // TODO: Add sanity checks - const uint32 fileSize = File::size(); + const int32 fileSize = File::size(); assert(start <= fileSize); assert(start + len <= fileSize); _subFileStart = start; @@ -129,15 +129,15 @@ bool ScummFile::eos() { return _subFileLen ? (pos() >= _subFileLen) : File::eos(); } -uint32 ScummFile::pos() { +int32 ScummFile::pos() { return File::pos() - _subFileStart; } -uint32 ScummFile::size() { +int32 ScummFile::size() { return _subFileLen ? _subFileLen : File::size(); } -void ScummFile::seek(int32 offs, int whence) { +bool ScummFile::seek(int32 offs, int whence) { if (_subFileLen) { // Constrain the seek to the subfile switch (whence) { @@ -154,7 +154,7 @@ void ScummFile::seek(int32 offs, int whence) { assert((int32)_subFileStart <= offs && offs <= (int32)(_subFileStart + _subFileLen)); whence = SEEK_SET; } - File::seek(offs, whence); + return File::seek(offs, whence); } uint32 ScummFile::read(void *dataPtr, uint32 dataSize) { @@ -162,9 +162,9 @@ uint32 ScummFile::read(void *dataPtr, uint32 dataSize) { if (_subFileLen) { // Limit the amount we read by the subfile boundaries. - const uint32 curPos = pos(); + const int32 curPos = pos(); assert(_subFileLen >= curPos); - uint32 newPos = curPos + dataSize; + int32 newPos = curPos + dataSize; if (newPos > _subFileLen) { dataSize = _subFileLen - curPos; _myIoFailed = true; -- cgit v1.2.3 From c8eeae8d4dffa5849a23cf963884027a7789504b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 14 Sep 2008 22:28:53 +0000 Subject: 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 --- engines/scumm/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/file.cpp') diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 22079332e4..f258ddd420 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -126,7 +126,7 @@ bool ScummFile::openSubFile(const Common::String &filename) { bool ScummFile::eos() { - return _subFileLen ? (pos() >= _subFileLen) : File::eos(); + return _subFileLen ? (pos() >= _subFileLen) : File::eos(); // FIXME } int32 ScummFile::pos() { -- cgit v1.2.3