aboutsummaryrefslogtreecommitdiff
path: root/common/xmlparser.h
diff options
context:
space:
mode:
authorVicent Marti2008-10-15 13:34:18 +0000
committerVicent Marti2008-10-15 13:34:18 +0000
commit0cd49391103a4d7ea33c2a8d61f5c93ab3af0155 (patch)
tree1ebfa43f34dc14727ea4c7157e162387de60b780 /common/xmlparser.h
parent9ad49cf983ee4486a2d95db67e9c7662d48178c6 (diff)
downloadscummvm-rg350-0cd49391103a4d7ea33c2a8d61f5c93ab3af0155.tar.gz
scummvm-rg350-0cd49391103a4d7ea33c2a8d61f5c93ab3af0155.tar.bz2
scummvm-rg350-0cd49391103a4d7ea33c2a8d61f5c93ab3af0155.zip
Changed XMLParser comment syntax to conform to XML standards (<!-- * -->)
Changed STX version string to 0.2. svn-id: r34807
Diffstat (limited to 'common/xmlparser.h')
-rw-r--r--common/xmlparser.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/common/xmlparser.h b/common/xmlparser.h
index 89df048395..f7a3c664e9 100644
--- a/common/xmlparser.h
+++ b/common/xmlparser.h
@@ -349,32 +349,35 @@ protected:
* or to change the commenting syntax.
*/
virtual bool skipComments() {
- char endComment1 = 0, endComment2 = 0;
-
- if (_char == '/') {
+ if (_char == '<') {
_char = _stream->readByte();
- if (_char != '*') {
+ if (_char != '!') {
_stream->seek(-1, SEEK_CUR);
- _char = '/';
+ _char = '<';
return false;
}
+ if (_stream->readByte() != '-' || _stream->readByte() != '-')
+ return parserError("Malformed comment syntax.");
+
_char = _stream->readByte();
+ bool dash = false;
while (_char) {
- endComment1 = endComment2;
- endComment2 = _char;
+ if (_char == '-') {
+ if (dash && _stream->readByte() == '>') {
+ _char = _stream->readByte();
+ return true;
+ }
+
+ dash = !dash;
+ }
+
_char = _stream->readByte();
-
- if (endComment1 == '*' && endComment2 == '/')
- break;
-
- if (_char == 0)
- return parserError("Comment has no closure.");
}
- _char = _stream->readByte();
- return true;
+
+ return parserError("Comment has no closure.");
}
return false;