diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/decompressor.cpp | 4 | ||||
-rw-r--r-- | engines/sci/resource.cpp | 8 | ||||
-rw-r--r-- | engines/tinsel/handle.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/music.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/pcode.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/sound.cpp | 14 | ||||
-rw-r--r-- | engines/tinsel/strres.cpp | 2 |
8 files changed, 19 insertions, 19 deletions
diff --git a/engines/sci/decompressor.cpp b/engines/sci/decompressor.cpp index 4731c87427..c213fca1ed 100644 --- a/engines/sci/decompressor.cpp +++ b/engines/sci/decompressor.cpp @@ -36,13 +36,13 @@ namespace Sci { int Decompressor::unpack(Common::ReadStream *src, byte *dest, uint32 nPacked, uint32 nUnpacked) { uint32 chunk; - while (nPacked && !src->ioFailed()) { + while (nPacked && !(src->eos() || src->err())) { chunk = MIN<uint32>(1024, nPacked); src->read(dest, chunk); nPacked -= chunk; dest += chunk; } - return src->ioFailed() ? 1 : 0; + return (src->eos() || src->err()) ? 1 : 0; } void Decompressor::init(Common::ReadStream *src, byte *dest, uint32 nPacked, diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index f610252f27..1a8f819926 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1016,7 +1016,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) { id = file.readUint16LE(); offset = file.readUint32LE(); - if (file.ioFailed()) { + if (file.eos() || file.err()) { warning("Error while reading %s", map->location_name.c_str()); return SCI_ERROR_RESMAP_NOT_FOUND; } @@ -1095,7 +1095,7 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) { // in SCI32 it's a plain offset } } - if (file.ioFailed()) { + if (file.eos() || file.err()) { warning("Error while reading %s", map->location_name.c_str()); return SCI_ERROR_RESMAP_NOT_FOUND; } @@ -1278,7 +1278,7 @@ int ResourceManager::readAudioMapSCI1(ResourceSource *map, bool unload) { uint32 offset = file.readUint32LE(); uint32 size = file.readUint32LE(); - if (file.ioFailed()) { + if (file.eos() || file.err()) { warning("Error while reading %s", map->location_name.c_str()); return SCI_ERROR_RESMAP_NOT_FOUND; } @@ -1405,7 +1405,7 @@ int ResourceManager::readResourceInfo(Resource *res, Common::File *file, return SCI_ERROR_INVALID_RESMAP_ENTRY; } // check if there were errors while reading - if (file->ioFailed()) + if ((file->eos() || file->err())) return SCI_ERROR_IO_ERROR; res->id = ResourceId(type, number); res->size = szUnpacked; diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index 82d77a2904..9366d06be6 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -133,7 +133,7 @@ void SetupHandleTable() { handleTable[i].flags2 = t2Flag ? f.readUint32LE() : 0; } - if (f.ioFailed()) { + if (f.eos() || f.err()) { // index file is corrupt error(FILE_IS_CORRUPT, (TinselV1PSX? PSX_INDEX_FILENAME : INDEX_FILENAME)); } diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index a231c42013..6a50295afd 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -370,7 +370,7 @@ void OpenMidiFiles() { // gen length of the largest sequence midiBuffer.size = midiStream.readUint32LE(); - if (midiStream.ioFailed()) + if (midiStream.eos() || midiStream.err()) error(FILE_IS_CORRUPT, MIDI_FILE); if (midiBuffer.size) { @@ -860,7 +860,7 @@ bool PCMMusicPlayer::getNextChunk() { error(CANNOT_FIND_FILE, _fileName); file.seek(sampleOffset); - if (file.ioFailed() || (uint32)file.pos() != sampleOffset) + if (file.eos() || file.err() || (uint32)file.pos() != sampleOffset) error(FILE_IS_CORRUPT, _fileName); buffer = (byte *) malloc(sampleCLength); diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 29f1753249..9cdec86d8f 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -406,7 +406,7 @@ void RegisterGlobals(int num) { for (int i = 0; i < length; ++i) pGlobals[i] = f.readSint32LE(); - if (f.ioFailed()) + if (f.eos() || f.err()) error(FILE_IS_CORRUPT, GLOBALS_FILENAME); f.close(); diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 0e529cb3cc..6072bbca12 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -467,7 +467,7 @@ static bool DoRestore() { if (id != (uint32)0xFEEDFACE) error("Incompatible saved game"); - bool failed = f->ioFailed(); + bool failed = (f->eos() || f->err()); delete f; diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index d8ed39006a..ece054138a 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -98,12 +98,12 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound // move to correct position in the sample file _sampleStream.seek(dwSampleIndex); - if (_sampleStream.ioFailed() || (uint32)_sampleStream.pos() != dwSampleIndex) + if (_sampleStream.eos() || _sampleStream.err() || (uint32)_sampleStream.pos() != dwSampleIndex) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); // read the length of the sample uint32 sampleLen = _sampleStream.readUint32LE(); - if (_sampleStream.ioFailed()) + if (_sampleStream.eos() || _sampleStream.err()) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); if (TinselV1PSX) { @@ -244,12 +244,12 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p // move to correct position in the sample file _sampleStream.seek(dwSampleIndex); - if (_sampleStream.ioFailed() || (uint32)_sampleStream.pos() != dwSampleIndex) + if (_sampleStream.eos() || _sampleStream.err() || (uint32)_sampleStream.pos() != dwSampleIndex) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); // read the length of the sample uint32 sampleLen = _sampleStream.readUint32LE(); - if (_sampleStream.ioFailed()) + if (_sampleStream.eos() || _sampleStream.err()) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); if (sampleLen & 0x80000000) { @@ -263,11 +263,11 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p for (int32 i = 0; i < sub; i++) { sampleLen = _sampleStream.readUint32LE(); _sampleStream.skip(sampleLen); - if (_sampleStream.ioFailed()) + if (_sampleStream.eos() || _sampleStream.err()) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); } sampleLen = _sampleStream.readUint32LE(); - if (_sampleStream.ioFailed()) + if (_sampleStream.eos() || _sampleStream.err()) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); } @@ -553,7 +553,7 @@ void SoundManager::openSampleFiles() { /* // gen length of the largest sample sampleBuffer.size = _sampleStream.readUint32LE(); - if (_sampleStream.ioFailed()) + if (_sampleStream.eos() || _sampleStream.err()) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); */ } diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp index 570c30d84c..8f9f72f446 100644 --- a/engines/tinsel/strres.cpp +++ b/engines/tinsel/strres.cpp @@ -112,7 +112,7 @@ void ChangeLanguage(LANGUAGE newLang) { // first long is the filelength and for uncompressed files it is the chunk // identifier textLen = f.readUint32LE(); - if (f.ioFailed()) + if (f.eos() || f.err()) error(FILE_IS_CORRUPT, _vm->getTextFile(newLang)); if (textLen == CHUNK_STRING || textLen == CHUNK_MBSTRING) { |