diff options
-rw-r--r-- | common/xmlparser.cpp | 186 | ||||
-rw-r--r-- | gui/ThemeEngine.cpp | 52 |
2 files changed, 119 insertions, 119 deletions
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 1385af795b..534007b03d 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -276,126 +276,126 @@ bool XMLParser::parse() { continue; switch (_state) { - case kParserNeedHeader: - case kParserNeedKey: - if (_char != '<') { - parserError("Parser expecting key start."); - break; - } + case kParserNeedHeader: + case kParserNeedKey: + if (_char != '<') { + parserError("Parser expecting key start."); + break; + } + + if ((_char = _stream->readByte()) == 0) { + parserError("Unexpected end of file."); + break; + } - if ((_char = _stream->readByte()) == 0) { - parserError("Unexpected end of file."); + if (_state == kParserNeedHeader) { + if (_char != '?') { + parserError("Expecting XML header."); break; } - if (_state == kParserNeedHeader) { - if (_char != '?') { - parserError("Expecting XML header."); - break; - } + _char = _stream->readByte(); + activeHeader = true; + } else if (_char == '/') { + _char = _stream->readByte(); + activeClosure = true; + } else if (_char == '?') { + parserError("Unexpected header. There may only be one XML header per file."); + break; + } - _char = _stream->readByte(); - activeHeader = true; - } else if (_char == '/') { - _char = _stream->readByte(); - activeClosure = true; - } else if (_char == '?') { - parserError("Unexpected header. There may only be one XML header per file."); - break; - } + _state = kParserNeedKeyName; + break; - _state = kParserNeedKeyName; + case kParserNeedKeyName: + if (!parseToken()) { + parserError("Invalid key name."); break; + } - case kParserNeedKeyName: - if (!parseToken()) { - parserError("Invalid key name."); + if (activeClosure) { + if (_activeKey.empty() || _token != _activeKey.top()->name) { + parserError("Unexpected closure."); break; } - - if (activeClosure) { - if (_activeKey.empty() || _token != _activeKey.top()->name) { - parserError("Unexpected closure."); - break; - } - } else { - ParserNode *node = allocNode(); //new ParserNode; - node->name = _token; - node->ignore = false; - node->header = activeHeader; - node->depth = _activeKey.size(); - node->layout = 0; - _activeKey.push(node); + } else { + ParserNode *node = allocNode(); //new ParserNode; + node->name = _token; + node->ignore = false; + node->header = activeHeader; + node->depth = _activeKey.size(); + node->layout = 0; + _activeKey.push(node); + } + + _state = kParserNeedPropertyName; + break; + + case kParserNeedPropertyName: + if (activeClosure) { + if (!closeKey()) { + parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); + break; } - _state = kParserNeedPropertyName; - break; - - case kParserNeedPropertyName: - if (activeClosure) { - if (!closeKey()) { - parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); - break; - } + activeClosure = false; - activeClosure = false; + if (_char != '>') + parserError("Invalid syntax in key closure."); + else + _state = kParserNeedKey; - if (_char != '>') - parserError("Invalid syntax in key closure."); - else - _state = kParserNeedKey; + _char = _stream->readByte(); + break; + } - _char = _stream->readByte(); - break; - } + selfClosure = false; - selfClosure = false; + if (_char == '/' || (_char == '?' && activeHeader)) { + selfClosure = true; + _char = _stream->readByte(); + } - if (_char == '/' || (_char == '?' && activeHeader)) { - selfClosure = true; + if (_char == '>') { + if (activeHeader && !selfClosure) { + parserError("XML Header must be self-closed."); + } else if (parseActiveKey(selfClosure)) { _char = _stream->readByte(); + _state = kParserNeedKey; } - if (_char == '>') { - if (activeHeader && !selfClosure) { - parserError("XML Header must be self-closed."); - } else if (parseActiveKey(selfClosure)) { - _char = _stream->readByte(); - _state = kParserNeedKey; - } + activeHeader = false; + break; + } - activeHeader = false; - break; - } + if (selfClosure) + parserError("Expecting key closure after '/' symbol."); + else if (!parseToken()) + parserError("Error when parsing key value."); + else + _state = kParserNeedPropertyOperator; - if (selfClosure) - parserError("Expecting key closure after '/' symbol."); - else if (!parseToken()) - parserError("Error when parsing key value."); - else - _state = kParserNeedPropertyOperator; + break; - break; + case kParserNeedPropertyOperator: + if (_char != '=') + parserError("Syntax error after key name."); + else + _state = kParserNeedPropertyValue; - case kParserNeedPropertyOperator: - if (_char != '=') - parserError("Syntax error after key name."); - else - _state = kParserNeedPropertyValue; - - _char = _stream->readByte(); - break; + _char = _stream->readByte(); + break; - case kParserNeedPropertyValue: - if (!parseKeyValue(_token)) - parserError("Invalid key value."); - else - _state = kParserNeedPropertyName; + case kParserNeedPropertyValue: + if (!parseKeyValue(_token)) + parserError("Invalid key value."); + else + _state = kParserNeedPropertyName; - break; + break; - default: - break; + default: + break; } } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index d1516d0f86..49ea2e19f3 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -912,21 +912,21 @@ void ThemeEngine::drawDialogBackground(const Common::Rect &r, DialogBackground b return; switch (bgtype) { - case kDialogBackgroundMain: - queueDD(kDDMainDialogBackground, r); - break; + case kDialogBackgroundMain: + queueDD(kDDMainDialogBackground, r); + break; - case kDialogBackgroundSpecial: - queueDD(kDDSpecialColorBackground, r); - break; + case kDialogBackgroundSpecial: + queueDD(kDDSpecialColorBackground, r); + break; - case kDialogBackgroundPlain: - queueDD(kDDPlainColorBackground, r); - break; + case kDialogBackgroundPlain: + queueDD(kDDPlainColorBackground, r); + break; - case kDialogBackgroundDefault: - queueDD(kDDDefaultBackground, r); - break; + case kDialogBackgroundDefault: + queueDD(kDDDefaultBackground, r); + break; } } @@ -1039,26 +1039,26 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid } switch (font) { - case kFontStyleNormal: - queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kFontStyleNormal: + queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; - default: - break; + default: + break; } switch (state) { - case kStateDisabled: - queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kStateDisabled: + queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; - case kStateHighlight: - queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kStateHighlight: + queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; - case kStateEnabled: - queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kStateEnabled: + queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; } } |