From 4b7d45558033eb03bf9b6dad382aa849b64bdee4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 1 Dec 2008 21:13:02 +0000 Subject: Got rid of Stream::readLine_OLD calls in two places (mostly untested, please check/test for regressions) svn-id: r35198 --- engines/queen/resource.cpp | 8 +++++--- engines/sword1/animation.cpp | 13 +++++++------ engines/sword1/animation.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp index 38d841e96a..7c15d7884a 100644 --- a/engines/queen/resource.cpp +++ b/engines/queen/resource.cpp @@ -130,10 +130,12 @@ void Resource::loadTextFile(const char *filename, Common::StringList &stringList ResourceEntry *re = resourceEntry(filename); assert(re != NULL); seekResourceFile(re->bundle, re->offset); - char buf[512]; Common::SeekableSubReadStream stream(&_resourceFile, re->offset, re->offset + re->size); - while (stream.readLine_OLD(buf, 512)) { - stringList.push_back(buf); + while (true) { + Common::String tmp = stream.readLine(); + if (stream.eos() || stream.err()) + break; + stringList.push_back(tmp); } } diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 592cc2e565..a0072455ba 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -184,22 +184,23 @@ bool MoviePlayer::load(uint32 id) { if (SwordEngine::_systemVars.showText) { sprintf(fileName, "%s.txt", sequenceList[id]); if (f.open(fileName)) { - char line[240]; + Common::String line; int lineNo = 0; int lastEnd = -1; _movieTexts.clear(); - while (f.readLine_OLD(line, sizeof(line))) { + while (!f.eos() && !f.err()) { + line = f.readLine(); lineNo++; - if (line[0] == '#' || line[0] == 0) { + if (line.empty() || line[0] == '#') { continue; } - char *ptr = line; + const char *ptr = line.c_str(); // TODO: Better error handling - int startFrame = strtoul(ptr, &ptr, 10); - int endFrame = strtoul(ptr, &ptr, 10); + int startFrame = strtoul(ptr, (char **)&ptr, 10); + int endFrame = strtoul(ptr, (char **)&ptr, 10); while (*ptr && isspace(*ptr)) ptr++; diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h index 6b74eb5833..2f38b197fe 100644 --- a/engines/sword1/animation.h +++ b/engines/sword1/animation.h @@ -66,7 +66,7 @@ public: uint16 _startFrame; uint16 _endFrame; char *_text; - MovieText(int startFrame, int endFrame, char *text) { + MovieText(int startFrame, int endFrame, const char *text) { _startFrame = startFrame; _endFrame = endFrame; _text = strdup(text); -- cgit v1.2.3