diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/xmlparser.cpp | 22 | ||||
-rw-r--r-- | common/xmlparser.h | 2 |
2 files changed, 8 insertions, 16 deletions
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 9bd052fb3d..ea36f0bb4a 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -23,9 +23,6 @@ // FIXME: Avoid using fprintf #define FORBIDDEN_SYMBOL_EXCEPTION_fprintf -// FIXME: Avoid using vfprintf -#define FORBIDDEN_SYMBOL_EXCEPTION_vfprintf - #include "common/xmlparser.h" #include "common/archive.h" @@ -83,7 +80,7 @@ void XMLParser::close() { _stream = 0; } -bool XMLParser::parserError(const char *errorString, ...) { +bool XMLParser::parserError(const Common::String &errStr) { _state = kParserError; const int startPosition = _stream->pos(); @@ -134,12 +131,7 @@ bool XMLParser::parserError(const char *errorString, ...) { fprintf(stderr, "%c", _stream->readByte()); fprintf(stderr, "\n\nParser error: "); - - va_list args; - va_start(args, errorString); - vfprintf(stderr, errorString, args); - va_end(args); - + fprintf(stderr, "%s", errStr.c_str()); fprintf(stderr, "\n\n"); return false; @@ -181,16 +173,16 @@ bool XMLParser::parseActiveKey(bool closed) { for (List<XMLKeyLayout::XMLKeyProperty>::const_iterator i = key->layout->properties.begin(); i != key->layout->properties.end(); ++i) { if (i->required && !localMap.contains(i->name)) - return parserError("Missing required property '%s' inside key '%s'", i->name.c_str(), key->name.c_str()); + return parserError("Missing required property '" + i->name + "' inside key '" + key->name + "'"); else if (localMap.contains(i->name)) keyCount--; } if (keyCount > 0) - return parserError("Unhandled property inside key '%s'.", key->name.c_str()); + return parserError("Unhandled property inside key '" + key->name + "'."); } else { - return parserError("Unexpected key in the active scope ('%s').", key->name.c_str()); + return parserError("Unexpected key in the active scope ('" + key->name + "')."); } // check if any of the parents must be ignored. @@ -205,7 +197,7 @@ bool XMLParser::parseActiveKey(bool closed) { // when keyCallback() fails, a parserError() must be set. // We set it manually in that case. if (_state != kParserError) - parserError("Unhandled exception when parsing '%s' key.", key->name.c_str()); + parserError("Unhandled exception when parsing '" + key->name + "' key."); return false; } @@ -395,7 +387,7 @@ bool XMLParser::parse() { case kParserNeedPropertyName: if (activeClosure) { if (!closeKey()) { - parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); + parserError("Missing data when closing key '" + _activeKey.top()->name + "'."); break; } diff --git a/common/xmlparser.h b/common/xmlparser.h index 84fca294a0..7923e43a37 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -274,7 +274,7 @@ protected: * Parser error always returns "false" so we can pass the return value * directly and break down the parsing. */ - bool parserError(const char *errorString, ...) GCC_PRINTF(2, 3); + bool parserError(const Common::String &errStr); /** * Skips spaces/whitelines etc. |