diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/drascula/drascula.cpp | 4 | ||||
-rw-r--r-- | engines/gob/dataio.cpp | 2 | ||||
-rw-r--r-- | engines/m4/converse.cpp | 41 | ||||
-rw-r--r-- | engines/m4/globals.cpp | 14 | ||||
-rw-r--r-- | engines/m4/mads_anim.cpp | 14 | ||||
-rw-r--r-- | engines/made/redreader.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/parser.h | 2 | ||||
-rw-r--r-- | engines/saga/animation.cpp | 2 | ||||
-rw-r--r-- | engines/saga/sprite.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/file.cpp | 2 |
11 files changed, 58 insertions, 30 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index af32a0c2e5..34f3701f31 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -598,8 +598,10 @@ char *DrasculaEngine::getLine(char *buf, int len) { for (;;) { b = buf; - while (!_arj.eos()) { + while (true) { c = ~_arj.readByte(); + if (_arj.eos()) break; + if (c == '\r') continue; if (c == '\n' || b - buf >= (len - 1)) diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp index 0a3f317ada..d154a01de9 100644 --- a/engines/gob/dataio.cpp +++ b/engines/gob/dataio.cpp @@ -95,7 +95,7 @@ bool DataStream::eos() const { if (_stream) return _stream->eos(); - return pos() >= size(); + return pos() >= size(); // FIXME (eos definition change) } uint32 DataStream::read(void *dataPtr, uint32 dataSize) { diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 47d84f6a28..11131783e2 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -406,10 +406,12 @@ void Converse::loadConversation(const char *convName) { convS->read(buffer, 8); if (debugFlag) printf("Conversation name: %s\n", buffer); - while(!convS->eos()) { + while(true) { chunkPos = convS->pos(); - if (debugFlag) printf("***** Pos: %i -> ", chunkPos); chunk = convS->readUint32LE(); // read chunk + if (convS->eos()) break; + + if (debugFlag) printf("***** Pos: %i -> ", chunkPos); switch(chunk) { case CHUNK_DECL: // Declare if (debugFlag) printf("DECL chunk\n"); @@ -714,7 +716,7 @@ void Converse::loadConversationMads(const char *convName) { printf("Chunk 0\n"); printf("Conv stream size: %i\n", convS->size()); - while(!convS->eos()) { + while(!convS->eos()) { // FIXME (eos changed) printf("%i ", convS->readByte()); } printf("\n"); @@ -725,7 +727,7 @@ void Converse::loadConversationMads(const char *convName) { printf("Chunk 1\n"); printf("Conv stream size: %i\n", convS->size()); - while(!convS->eos()) { + while(!convS->eos()) { // FIXME (eos changed) printf("%i ", convS->readByte()); } printf("\n"); @@ -736,7 +738,7 @@ void Converse::loadConversationMads(const char *convName) { printf("Chunk 2\n"); printf("Conv stream size: %i\n", convS->size()); - while(!convS->eos()) { + while(!convS->eos()) { // FIXME (eos changed) printf("%i ", convS->readByte()); } printf("\n"); @@ -790,7 +792,7 @@ void Converse::loadConversationMads(const char *convName) { convS->read(buffer, 14); // speech file printf("Speech file: %s\n", buffer); - while(!convS->eos()) { + while(!convS->eos()) { // FIXME: eos changed printf("%i ", convS->readByte()); } printf("\n"); @@ -803,9 +805,12 @@ void Converse::loadConversationMads(const char *convName) { printf("Chunk 1: conversation nodes\n"); printf("Conv stream size: %i\n", convS->size()); - while(!convS->eos()) { + while(true) { + uint16 id = convS->readUint16LE(); + if (convS->eos()) break; + curEntry = new ConvEntry(); - curEntry->id = convS->readUint16LE(); + curEntry->id = id; curEntry->entryCount = convS->readUint16LE(); curEntry->flags = convS->readUint16LE(); if (curEntry->entryCount == 1 && curEntry->flags != 65535) { @@ -839,10 +844,13 @@ void Converse::loadConversationMads(const char *convName) { *buffer = 0; - while(!convS->eos()) { + while(true) { //if (curPos == 0) // printf("%i: Offset %i: ", _convStrings.size(), convS->pos()); - buffer[curPos++] = convS->readByte(); + uint8 b = convS->readByte(); + if (convS->eos()) break; + + buffer[curPos++] = b; if (buffer[curPos - 1] == '~') { // filter out special characters curPos--; continue; @@ -892,9 +900,12 @@ void Converse::loadConversationMads(const char *convName) { //printf("Chunk 3 - MESG chunk data\n"); //printf("Conv stream size: %i\n", convS->size()); - while(!convS->eos()) { + while(true) { + uint16 index = convS->readUint16LE(); + if (convS->eos()) break; + curMessage = new MessageEntry(); - stringIndex = convS->readUint16LE(); + stringIndex = index; stringCount = convS->readUint16LE(); *buffer = 0; //printf("Message: %i\n", _madsMessageList.size()); @@ -915,7 +926,7 @@ void Converse::loadConversationMads(const char *convName) { convS = convData.getItemStream(6); printf("Chunk 6\n"); printf("Conv stream size: %i\n", convS->size()); - /*while(!convS->eos()) { + /*while(!convS->eos()) { // FIXME (eos changed) printf("%i ", convS->readByte()); printf("%i ", convS->readByte()); printf("%i ", convS->readByte()); @@ -954,8 +965,10 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur int messageIndex = 0; int unk = 0; - while(!convS->eos()) { + while(true) { chunk = convS->readByte(); + if (convS->eos()) break; + type = convS->readByte(); switch (chunk) { diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp index 58c68979d1..98d007f67e 100644 --- a/engines/m4/globals.cpp +++ b/engines/m4/globals.cpp @@ -295,8 +295,11 @@ void Globals::loadMadsVocab() { char buffer[30]; strcpy(buffer, ""); - while(!vocabS->eos()) { - buffer[curPos++] = vocabS->readByte(); + while(true) { + uint8 b = vocabS->readByte(); + if (vocabS->eos()) break; + + buffer[curPos++] = b; if (buffer[curPos - 1] == '\0') { // end of string, add it to the strings list _madsVocab.push_back(strdup(buffer)); @@ -315,8 +318,11 @@ void Globals::loadMadsQuotes() { char buffer[128]; strcpy(buffer, ""); - while(!quoteS->eos()) { - buffer[curPos++] = quoteS->readByte(); + while(true) { + uint8 b = quoteS->readByte(); + if (quoteS->eos()) break; + + buffer[curPos++] = b; if (buffer[curPos - 1] == '\0') { // end of string, add it to the strings list _madsQuotes.push_back(strdup(buffer)); diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index e028f5e0f1..71b45ca77c 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -247,15 +247,16 @@ void TextviewView::scriptDone() { } void TextviewView::processLines() { + _script->readLine_OLD(_currentLine, 79); if (_script->eos()) error("Attempted to read past end of response file"); while (!_script->eos()) { - _script->readLine_OLD(_currentLine, 79); - // Commented out line, so go loop for another - if (_currentLine[0] == '#') + if (_currentLine[0] == '#') { + _script->readLine_OLD(_currentLine, 79); continue; + } // Process the line char *cStart = strchr(_currentLine, '['); @@ -284,6 +285,8 @@ void TextviewView::processLines() { processText(); break; } + + _script->readLine_OLD(_currentLine, 79); } } @@ -594,6 +597,7 @@ void AnimviewView::scriptDone() { } void AnimviewView::processLines() { + _script->readLine_OLD(_currentLine, 79); if (_script->eos()) { // end of script, end animation scriptDone(); @@ -601,8 +605,6 @@ void AnimviewView::processLines() { } while (!_script->eos()) { - _script->readLine_OLD(_currentLine, 79); - // Process the line char *cStart = strchr(_currentLine, '-'); if (cStart) { @@ -635,6 +637,8 @@ void AnimviewView::processLines() { //printf("File: %s\n", _currentLine); break; } + + _script->readLine_OLD(_currentLine, 79); } } diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp index 5d0721bc1f..a61d122041 100644 --- a/engines/made/redreader.cpp +++ b/engines/made/redreader.cpp @@ -55,9 +55,11 @@ Common::MemoryReadStream *RedReader::loadFromRed(const char *redFilename, const bool RedReader::seekFile(Common::File &fd, FileEntry &fileEntry, const char *filename) { char arcFilename[13]; - while (!fd.eos()) { + while (true) { fd.skip(8); // skip unknown fileEntry.compSize = fd.readUint32LE(); + if (fd.eos()) break; + fileEntry.origSize = fd.readUint32LE(); fd.skip(10); // skip unknown fd.read(arcFilename, 13); diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index c50373aba1..54d4d1e5da 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -165,7 +165,7 @@ int32 Archive::pos() const { } bool Archive::eos() const { - return (_file == true ? _fileCursor == _fileEndOffset : true ); + return (_file == true ? _fileCursor == _fileEndOffset : true ); // FIXME (eos definition change) } bool Archive::seek(int32 offs, int whence) { diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index 7bf41b2bea..f0cc448518 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -456,7 +456,7 @@ public: } bool eos() const { - return _pos == _size; + return _pos == _size; // FIXME (eos definition change) } }; diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 9fffb0f8bf..e9e146013f 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -866,7 +866,7 @@ int Anim::fillFrameOffsets(AnimationData *anim, bool reallyFill) { readS._bigEndian = !_vm->isBigEndian(); // RLE has inversion BE<>LE - while (!readS.eos()) { + while (readS.pos() != readS.size()) { if (reallyFill) { anim->frameOffsets[currentFrame] = readS.pos(); diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index d9c7b446ba..ee2e2b922f 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -423,6 +423,7 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou } for (c = 0; c < fg_runcount && !readS.eos(); c++) { + // FIXME: eos changed; error handling? *outPointer = readS.readByte(); if (outPointer < outPointerEnd) outPointer++; 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() { |