diff options
author | Vicent Marti | 2008-09-29 10:27:16 +0000 |
---|---|---|
committer | Vicent Marti | 2008-09-29 10:27:16 +0000 |
commit | c8f42a39737dbd50cbdc4cad7c6a6c89ca0efe69 (patch) | |
tree | 0f49057fc5f141635c0658f5feef56331349b9e9 /common | |
parent | f267d42080357b4ab697e04f325fe628a1f62c1f (diff) | |
download | scummvm-rg350-c8f42a39737dbd50cbdc4cad7c6a6c89ca0efe69.tar.gz scummvm-rg350-c8f42a39737dbd50cbdc4cad7c6a6c89ca0efe69.tar.bz2 scummvm-rg350-c8f42a39737dbd50cbdc4cad7c6a6c89ca0efe69.zip |
Reduced memory usage by closing theme files after parsing. Could make things a tad slower.
svn-id: r34677
Diffstat (limited to 'common')
-rw-r--r-- | common/xmlparser.cpp | 5 | ||||
-rw-r--r-- | common/xmlparser.h | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index b93a5205be..6c1aa7d0e4 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -43,7 +43,7 @@ bool XMLParser::parserError(const char *errorString, ...) { int lineStart = 0; if (_fileName == "Memory Stream") { - lineStart = MAX(0, _pos - 35); + lineStart = MAX(0, original_pos - 35); lineCount = 0; } else { do { @@ -51,7 +51,7 @@ bool XMLParser::parserError(const char *errorString, ...) { lineCount++; if (lineStart == 0) - lineStart = MAX(pos + 1, _pos - 60); + lineStart = MAX(pos + 1, original_pos - 60); } _stream->seek(-1, SEEK_CUR); @@ -210,7 +210,6 @@ bool XMLParser::parse() { bool selfClosure = false; _state = kParserNeedKey; - _pos = 0; _activeKey.clear(); _char = _stream->readByte(); diff --git a/common/xmlparser.h b/common/xmlparser.h index 7edabf62f3..967b73535b 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -222,6 +222,13 @@ public: _fileName = "Compressed File Stream"; return true; } + + void close() { + if (_stream) { + delete _stream; + _stream = 0; + } + } /** * The actual parsing function. @@ -361,7 +368,7 @@ protected: break; if (_char == 0) - parserError("Comment has no closure."); + return parserError("Comment has no closure."); } _char = _stream->readByte(); return true; @@ -449,7 +456,6 @@ protected: Common::List<XMLKeyLayout*> _layoutList; private: - int _pos; /** Current position on the XML buffer. */ char _char; SeekableReadStream *_stream; Common::String _fileName; |