From 249b4eb4c35b2f7cea8811bbdc7b13eaaaae68fc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 18:08:54 +0000 Subject: [PATCH] Fix formatting of some switch statements. svn-id: r42513 --- common/xmlparser.cpp | 196 +++++++++++++++++++++---------------------- gui/ThemeEngine.cpp | 52 ++++++------ 2 files changed, 124 insertions(+), 124 deletions(-) diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 1385af795bc..534007b03dc 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; - } - - if ((_char = _stream->readByte()) == 0) { - parserError("Unexpected end of file."); - 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; - } - - _state = kParserNeedKeyName; + case kParserNeedHeader: + case kParserNeedKey: + if (_char != '<') { + parserError("Parser expecting key start."); break; + } - case kParserNeedKeyName: - if (!parseToken()) { - parserError("Invalid key name."); - 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); - } - - _state = kParserNeedPropertyName; + if ((_char = _stream->readByte()) == 0) { + parserError("Unexpected end of file."); break; + } - case kParserNeedPropertyName: - if (activeClosure) { - if (!closeKey()) { - parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); - break; - } - - activeClosure = false; - - if (_char != '>') - parserError("Invalid syntax in key closure."); - else - _state = kParserNeedKey; - - _char = _stream->readByte(); + if (_state == kParserNeedHeader) { + if (_char != '?') { + parserError("Expecting XML header."); break; } - selfClosure = false; + _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; + } - if (_char == '/' || (_char == '?' && activeHeader)) { - selfClosure = true; - _char = _stream->readByte(); + _state = kParserNeedKeyName; + break; + + case kParserNeedKeyName: + if (!parseToken()) { + parserError("Invalid key name."); + 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); + } - if (_char == '>') { - if (activeHeader && !selfClosure) { - parserError("XML Header must be self-closed."); - } else if (parseActiveKey(selfClosure)) { - _char = _stream->readByte(); - _state = kParserNeedKey; - } + _state = kParserNeedPropertyName; + break; - activeHeader = false; + case kParserNeedPropertyName: + if (activeClosure) { + if (!closeKey()) { + parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); break; } - if (selfClosure) - parserError("Expecting key closure after '/' symbol."); - else if (!parseToken()) - parserError("Error when parsing key value."); + activeClosure = false; + + if (_char != '>') + parserError("Invalid syntax in key closure."); else - _state = kParserNeedPropertyOperator; - - break; - - case kParserNeedPropertyOperator: - if (_char != '=') - parserError("Syntax error after key name."); - else - _state = kParserNeedPropertyValue; + _state = kParserNeedKey; _char = _stream->readByte(); break; + } - case kParserNeedPropertyValue: - if (!parseKeyValue(_token)) - parserError("Invalid key value."); - else - _state = kParserNeedPropertyName; + selfClosure = false; + if (_char == '/' || (_char == '?' && activeHeader)) { + selfClosure = true; + _char = _stream->readByte(); + } + + if (_char == '>') { + if (activeHeader && !selfClosure) { + parserError("XML Header must be self-closed."); + } else if (parseActiveKey(selfClosure)) { + _char = _stream->readByte(); + _state = kParserNeedKey; + } + + activeHeader = false; break; + } - default: - break; + if (selfClosure) + parserError("Expecting key closure after '/' symbol."); + else if (!parseToken()) + parserError("Error when parsing key value."); + else + _state = kParserNeedPropertyOperator; + + break; + + case kParserNeedPropertyOperator: + if (_char != '=') + parserError("Syntax error after key name."); + else + _state = kParserNeedPropertyValue; + + _char = _stream->readByte(); + break; + + case kParserNeedPropertyValue: + if (!parseKeyValue(_token)) + parserError("Invalid key value."); + else + _state = kParserNeedPropertyName; + + break; + + default: + break; } } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index d1516d0f866..49ea2e19f39 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; } }