aboutsummaryrefslogtreecommitdiff
path: root/common/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/file.cpp')
-rw-r--r--common/file.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/common/file.cpp b/common/file.cpp
index ee741a8990..7836a7d4a8 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -58,10 +58,8 @@ bool File::open(const String &filename, Archive &archive) {
assert(!filename.empty());
assert(!_handle);
- clearIOFailed();
-
SeekableReadStream *stream = 0;
-
+
if ((stream = archive.createReadStreamForMember(filename))) {
debug(3, "Opening hashed: %s", filename.c_str());
} else if ((stream = archive.createReadStreamForMember(filename + "."))) {
@@ -90,7 +88,6 @@ bool File::open(const FSNode &node) {
bool File::open(SeekableReadStream *stream, const Common::String &name) {
assert(!_handle);
- clearIOFailed();
if (stream) {
_handle = stream;
@@ -124,13 +121,12 @@ bool File::isOpen() const {
}
bool File::ioFailed() const {
- // TODO/FIXME: Just use ferror() here?
- return !_handle || _handle->ioFailed();
+ return !_handle || (eos() || err());
}
void File::clearIOFailed() {
if (_handle)
- _handle->clearIOFailed();
+ _handle->clearErr();
}
bool File::err() const {
@@ -211,12 +207,12 @@ bool DumpFile::isOpen() const {
bool DumpFile::err() const {
assert(_handle);
- return _handle->ioFailed();
+ return _handle->err();
}
void DumpFile::clearErr() {
assert(_handle);
- _handle->clearIOFailed();
+ _handle->clearErr();
}
uint32 DumpFile::write(const void *ptr, uint32 len) {