aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2008-09-04 21:40:32 +0000
committerTorbjörn Andersson2008-09-04 21:40:32 +0000
commitba07d1dd0a2babc27e50ff9b8ea3b77943bd9f09 (patch)
tree644dd29f3e8bf36fac55f3afcb3a68e21d91f490 /engines
parent5409b2b456974418a5b99eaf914bc11188ad7cdb (diff)
downloadscummvm-rg350-ba07d1dd0a2babc27e50ff9b8ea3b77943bd9f09.tar.gz
scummvm-rg350-ba07d1dd0a2babc27e50ff9b8ea3b77943bd9f09.tar.bz2
scummvm-rg350-ba07d1dd0a2babc27e50ff9b8ea3b77943bd9f09.zip
Use readLine() instead of readLine_OLD().
svn-id: r34336
Diffstat (limited to 'engines')
-rw-r--r--engines/sword2/startup.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/engines/sword2/startup.cpp b/engines/sword2/startup.cpp
index 2d19ed6bf9..09bf65bf75 100644
--- a/engines/sword2/startup.cpp
+++ b/engines/sword2/startup.cpp
@@ -64,19 +64,23 @@ bool Sword2Engine::initStartMenu() {
// extract the filenames
int start_ids[MAX_starts];
- char buf[10];
-
int lineno = 0;
- while (fp.readLine_OLD(buf, sizeof(buf))) {
+ while (!fp.eos() && !fp.ioFailed()) {
+ Common::String line = fp.readLine();
+
+ // Skip empty lines or, more likely, the end of the stream.
+ if (line.size() == 0)
+ continue;
+
char *errptr;
int id;
lineno++;
- id = strtol(buf, &errptr, 10);
+ id = strtol(line.c_str(), &errptr, 10);
if (*errptr) {
- warning("startup.inf:%d: Invalid string '%s'", lineno, buf);
+ warning("startup.inf:%d: Invalid string '%s'", lineno, line.c_str());
continue;
}
@@ -98,6 +102,10 @@ bool Sword2Engine::initStartMenu() {
}
}
+ // An I/O error before EOS? That's bad, but this is not a vital file.
+ if (fp.ioFailed() && !fp.eos())
+ warning("I/O error while reading startup.inf");
+
fp.close();
// Using this method the Gode generated resource.inf must have #0d0a