diff options
author | Max Horn | 2010-10-15 12:19:13 +0000 |
---|---|---|
committer | Max Horn | 2010-10-15 12:19:13 +0000 |
commit | 36cd5caf956c087995a62983ad09c15250f29475 (patch) | |
tree | 39dc6b202fb711fef28bc7f7c49bb7611232af83 /engines | |
parent | f52b31a05f9b234a367dd83b89cceaa3d9848204 (diff) | |
download | scummvm-rg350-36cd5caf956c087995a62983ad09c15250f29475.tar.gz scummvm-rg350-36cd5caf956c087995a62983ad09c15250f29475.tar.bz2 scummvm-rg350-36cd5caf956c087995a62983ad09c15250f29475.zip |
COMMON: Add XMLParser::parseIntegerKey variant accepting a Common::String
Almost all places where we used XMLParser::parseIntegerKey were using
it like this:
XMLParser::parseIntegerKey(str.c_str(), ...)
Since this makes the code harder to read, I overloaded the method to
also accept Commmon::String directly.
Also removed all .c_str() invocations where necessary.
svn-id: r53479
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword25/gfx/animationresource.cpp | 2 | ||||
-rw-r--r-- | engines/sword25/gfx/fontresource.cpp | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp index 96a93f1890..6609725c1b 100644 --- a/engines/sword25/gfx/animationresource.cpp +++ b/engines/sword25/gfx/animationresource.cpp @@ -116,7 +116,7 @@ bool AnimationResource::parseBooleanKey(Common::String s, bool &result) { } bool AnimationResource::parserCallback_animation(ParserNode *node) { - if (!parseIntegerKey(node->values["fps"].c_str(), 1, &_FPS) || (_FPS < MIN_FPS) || (_FPS > MAX_FPS)) { + if (!parseIntegerKey(node->values["fps"], 1, &_FPS) || (_FPS < MIN_FPS) || (_FPS > MAX_FPS)) { return parserError("Illegal or missing fps attribute in <animation> tag in \"%s\". Assuming default (\"%d\").", getFileName().c_str(), DEFAULT_FPS); } diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp index f7d37e8bdd..cdece041db 100644 --- a/engines/sword25/gfx/fontresource.cpp +++ b/engines/sword25/gfx/fontresource.cpp @@ -93,13 +93,13 @@ bool FontResource::parserCallback_font(ParserNode *node) { // Get the attributes of the font Common::String bitmapFilename = node->values["bitmap"]; - if (!parseIntegerKey(node->values["lineheight"].c_str(), 1, &_LineHeight)) { + if (!parseIntegerKey(node->values["lineheight"], 1, &_LineHeight)) { BS_LOG_WARNINGLN("Illegal or missing lineheight attribute in <font> tag in \"%s\". Assuming default (\"%d\").", getFileName().c_str(), DEFAULT_LINEHEIGHT); _LineHeight = DEFAULT_LINEHEIGHT; } - if (!parseIntegerKey(node->values["gap"].c_str(), 1, &_GapWidth)) { + if (!parseIntegerKey(node->values["gap"], 1, &_GapWidth)) { BS_LOG_WARNINGLN("Illegal or missing gap attribute in <font> tag in \"%s\". Assuming default (\"%d\").", getFileName().c_str(), DEFAULT_GAPWIDTH); _GapWidth = DEFAULT_GAPWIDTH; @@ -131,20 +131,20 @@ bool FontResource::parserCallback_character(ParserNode *node) { // Get the attributes of the character int charCode, top, left, right, bottom; - if (!parseIntegerKey(node->values["code"].c_str(), 1, &charCode) || (charCode < 0) || (charCode >= 256)) { + if (!parseIntegerKey(node->values["code"], 1, &charCode) || (charCode < 0) || (charCode >= 256)) { return parserError("Illegal or missing code attribute in <character> tag in \"%s\".", getFileName().c_str()); } - if (!parseIntegerKey(node->values["top"].c_str(), 1, &top) || (top < 0)) { + if (!parseIntegerKey(node->values["top"], 1, &top) || (top < 0)) { return parserError("Illegal or missing top attribute in <character> tag in \"%s\".", getFileName().c_str()); } - if (!parseIntegerKey(node->values["left"].c_str(), 1, &left) || (left < 0)) { + if (!parseIntegerKey(node->values["left"], 1, &left) || (left < 0)) { return parserError("Illegal or missing left attribute in <character> tag in \"%s\".", getFileName().c_str()); } - if (!parseIntegerKey(node->values["right"].c_str(), 1, &right) || (right < 0)) { + if (!parseIntegerKey(node->values["right"], 1, &right) || (right < 0)) { return parserError("Illegal or missing right attribute in <character> tag in \"%s\".", getFileName().c_str()); } - if (!parseIntegerKey(node->values["bottom"].c_str(), 1, &bottom) || (bottom < 0)) { + if (!parseIntegerKey(node->values["bottom"], 1, &bottom) || (bottom < 0)) { return parserError("Illegal or missing bottom attribute in <character> tag in \"%s\".", getFileName().c_str()); } |