From b694a78f62a02253bca2a5611314599ae7fce725 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Thu, 23 Jun 2011 05:42:48 -0400 Subject: ANALYSIS: Add static casts to is* functions This fixes a potential problem with passing char values that would be sign-extended and yield unexpected results. See http://msdn.microsoft.com/en-us/library/ms245348.aspx --- common/xmlparser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'common/xmlparser.cpp') diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 5217c4e82c..623619914a 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -263,7 +263,7 @@ bool XMLParser::vparseIntegerKey(const char *key, int count, va_list args) { int *num_ptr; while (count--) { - while (isspace(*key)) + while (isspace(static_cast(*key))) key++; num_ptr = va_arg(args, int*); @@ -271,7 +271,7 @@ bool XMLParser::vparseIntegerKey(const char *key, int count, va_list args) { key = parseEnd; - while (isspace(*key)) + while (isspace(static_cast(*key))) key++; if (count && *key++ != ',') @@ -463,10 +463,10 @@ bool XMLParser::parse() { } bool XMLParser::skipSpaces() { - if (!isspace(_char)) + if (!isspace(static_cast(_char))) return false; - while (_char && isspace(_char)) + while (_char && isspace(static_cast(_char))) _char = _stream->readByte(); return true; @@ -516,7 +516,7 @@ bool XMLParser::parseToken() { _char = _stream->readByte(); } - return isspace(_char) != 0 || _char == '>' || _char == '=' || _char == '/'; + return isspace(static_cast(_char)) != 0 || _char == '>' || _char == '=' || _char == '/'; } } // End of namespace Common -- cgit v1.2.3 From 84220d2ca05707f22a0242b1745caf0b657237a3 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sat, 6 Aug 2011 09:47:19 +0200 Subject: COMMON: Remove superfluous Common:: qualifiers. --- common/xmlparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/xmlparser.cpp') diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 623619914a..f768e44382 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -81,7 +81,7 @@ void XMLParser::close() { _stream = 0; } -bool XMLParser::parserError(const Common::String &errStr) { +bool XMLParser::parserError(const String &errStr) { _state = kParserError; const int startPosition = _stream->pos(); -- cgit v1.2.3