From e9cd07e582d27d1e329269d4e3d544eea03f0131 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 29 Jul 2009 21:39:34 +0000 Subject: SWORD1 & SWORD2: Replaced ioFailed by err+eos svn-id: r42912 --- engines/sword1/control.cpp | 2 +- engines/sword1/resman.cpp | 6 +++--- engines/sword2/resman.cpp | 6 +++--- engines/sword2/startup.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index 756ce3a5cc..09d2197f2a 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -1207,7 +1207,7 @@ bool Control::restoreGameFromFile(uint8 slot) { for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++) playerBuf[cnt2] = inf->readUint32LE(); - if (inf->ioFailed()) { + if (inf->err() || inf->eos()) { displayMessage(0, "Can't read from file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); delete inf; free(_restoreBuf); diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp index 979bd3210a..90ea5fe677 100644 --- a/engines/sword1/resman.cpp +++ b/engines/sword1/resman.cpp @@ -263,9 +263,9 @@ void ResMan::resOpen(uint32 id) { // load resource ID into memory _memMan->alloc(memHandle, size); Common::File *clusFile = resFile(id); assert(clusFile); - clusFile->seek( resOffset(id) ); - clusFile->read( memHandle->data, size); - if (clusFile->ioFailed()) { + clusFile->seek(resOffset(id)); + clusFile->read(memHandle->data, size); + if (clusFile->err() || clusFile->eos()) { error("Can't read %d bytes from offset %d from cluster file %s\nResource ID: %d (%08X)", size, resOffset(id), _prj.clu[(id >> 24) - 1].label, id, id); } } else diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp index 6741be33f1..c49fb8e786 100644 --- a/engines/sword2/resman.cpp +++ b/engines/sword2/resman.cpp @@ -151,7 +151,7 @@ bool ResourceManager::init() { for (i = 0; i < size / 2; i++) _resConvTable[i] = file.readUint16LE(); - if (file.ioFailed()) { + if (file.eos() || file.err()) { file.close(); GUIErrorMessage("Broken Sword 2: Cannot read resource.tab"); return false; @@ -178,7 +178,7 @@ bool ResourceManager::init() { cdInf[i].cd = file.readByte(); - if (file.ioFailed()) { + if (file.eos() || file.err()) { delete cdInf; file.close(); GUIErrorMessage("Broken Sword 2: Cannot read cd.inf"); @@ -477,7 +477,7 @@ void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) { _resFiles[fileNum].entryTab = (uint32*)malloc(tableSize); _resFiles[fileNum].numEntries = tableSize / 8; file->read(_resFiles[fileNum].entryTab, tableSize); - if (file->ioFailed()) + if (file->eos() || file->err()) error("unable to read index table from file %s", _resFiles[fileNum].fileName); #ifdef SCUMM_BIG_ENDIAN diff --git a/engines/sword2/startup.cpp b/engines/sword2/startup.cpp index 09bf65bf75..e4572d3c1a 100644 --- a/engines/sword2/startup.cpp +++ b/engines/sword2/startup.cpp @@ -66,7 +66,7 @@ bool Sword2Engine::initStartMenu() { int start_ids[MAX_starts]; int lineno = 0; - while (!fp.eos() && !fp.ioFailed()) { + while (!fp.eos() && !fp.err()) { Common::String line = fp.readLine(); // Skip empty lines or, more likely, the end of the stream. @@ -103,7 +103,7 @@ bool Sword2Engine::initStartMenu() { } // An I/O error before EOS? That's bad, but this is not a vital file. - if (fp.ioFailed() && !fp.eos()) + if (fp.err() && !fp.eos()) warning("I/O error while reading startup.inf"); fp.close(); -- cgit v1.2.3