[Scummvm-cvs-logs] SF.net SVN: scummvm:[35233] scummvm/trunk/engines/parallaction/parser.cpp
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Thu Dec 4 10:33:38 CET 2008
Revision: 35233
http://scummvm.svn.sourceforge.net/scummvm/?rev=35233&view=rev
Author: peres001
Date: 2008-12-04 09:33:37 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
Made readLineIntern() return a zero-length string when no printable text is read out of a script. This makes life easier for the parser, and also makes the introduction fully viewable.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/parser.cpp
Modified: scummvm/trunk/engines/parallaction/parser.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser.cpp 2008-12-04 08:10:32 UTC (rev 35232)
+++ scummvm/trunk/engines/parallaction/parser.cpp 2008-12-04 09:33:37 UTC (rev 35233)
@@ -40,9 +40,16 @@
delete _input;
}
+/*
+ * readLineIntern read a text line and prepares it for
+ * parsing, by stripping the leading whitespace and
+ * changing tabs to spaces. It will stop on a CR or LF,
+ * and return an empty string (length = 0) when a line
+ * has no printable text in it.
+ */
char *Script::readLineIntern(char *buf, size_t bufSize) {
- uint16 i;
- for (i = 0; i < bufSize; i++) {
+ uint i = 0;
+ for ( ; i < bufSize; ) {
char c = _input->readSByte();
if (_input->eos())
break;
@@ -51,7 +58,10 @@
if (c == '\t')
c = ' ';
- buf[i] = c;
+ if ((c != ' ') || (i > 0)) {
+ buf[i] = c;
+ i++;
+ }
}
_line++;
if (i == bufSize) {
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