Got rid of Stream::readLine_OLD calls in two places (mostly untested, please check/test for regressions)

svn-id: r35198
This commit is contained in:
Max Horn 2008-12-01 21:13:02 +00:00
parent 5212c3ea03
commit 4b7d455580
3 changed files with 13 additions and 10 deletions

View file

@ -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);
}
}

View file

@ -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++;

View file

@ -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);