mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ALL: sync with scummvm
This commit is contained in:
+8
-15
@@ -22,9 +22,7 @@
|
||||
|
||||
// FIXME: Avoid using fprintf
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
|
||||
|
||||
// FIXME: Avoid using vfprintf
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_vfprintf
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_stderr
|
||||
|
||||
|
||||
#include "common/xmlparser.h"
|
||||
@@ -83,7 +81,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 +132,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 +174,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 +198,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 +388,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user