[Scummvm-cvs-logs] SF.net SVN: scummvm:[34336] scummvm/trunk/engines/sword2/startup.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Sep 4 23:40:33 CEST 2008


Revision: 34336
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34336&view=rev
Author:   eriktorbjorn
Date:     2008-09-04 21:40:32 +0000 (Thu, 04 Sep 2008)

Log Message:
-----------
Use readLine() instead of readLine_OLD().

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/startup.cpp

Modified: scummvm/trunk/engines/sword2/startup.cpp
===================================================================
--- scummvm/trunk/engines/sword2/startup.cpp	2008-09-04 20:09:58 UTC (rev 34335)
+++ scummvm/trunk/engines/sword2/startup.cpp	2008-09-04 21:40:32 UTC (rev 34336)
@@ -64,19 +64,23 @@
 	// 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 @@
 		}
 	}
 
+	// 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list