aboutsummaryrefslogtreecommitdiff
path: root/common/xmlparser.cpp
diff options
context:
space:
mode:
authorLittleboy2011-06-23 05:42:48 -0400
committerLittleboy2011-06-23 08:52:52 -0400
commitb694a78f62a02253bca2a5611314599ae7fce725 (patch)
tree115573b00e3b025ed334f9eadeadfb6161286089 /common/xmlparser.cpp
parent7a96e0bfb67e9b5b8c0aa9bdae8415fb98214c3f (diff)
downloadscummvm-rg350-b694a78f62a02253bca2a5611314599ae7fce725.tar.gz
scummvm-rg350-b694a78f62a02253bca2a5611314599ae7fce725.tar.bz2
scummvm-rg350-b694a78f62a02253bca2a5611314599ae7fce725.zip
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
Diffstat (limited to 'common/xmlparser.cpp')
-rw-r--r--common/xmlparser.cpp10
1 files changed, 5 insertions, 5 deletions
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<unsigned char>(*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<unsigned char>(*key)))
key++;
if (count && *key++ != ',')
@@ -463,10 +463,10 @@ bool XMLParser::parse() {
}
bool XMLParser::skipSpaces() {
- if (!isspace(_char))
+ if (!isspace(static_cast<unsigned char>(_char)))
return false;
- while (_char && isspace(_char))
+ while (_char && isspace(static_cast<unsigned char>(_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<unsigned char>(_char)) != 0 || _char == '>' || _char == '=' || _char == '/';
}
} // End of namespace Common