diff options
author | Littleboy | 2011-06-23 05:42:48 -0400 |
---|---|---|
committer | Littleboy | 2011-06-23 08:52:52 -0400 |
commit | b694a78f62a02253bca2a5611314599ae7fce725 (patch) | |
tree | 115573b00e3b025ed334f9eadeadfb6161286089 /engines/agi | |
parent | 7a96e0bfb67e9b5b8c0aa9bdae8415fb98214c3f (diff) | |
download | scummvm-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 'engines/agi')
-rw-r--r-- | engines/agi/wagparser.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp index 14159c0147..39f9e0dd92 100644 --- a/engines/agi/wagparser.cpp +++ b/engines/agi/wagparser.cpp @@ -112,11 +112,11 @@ WagFileParser::~WagFileParser() { bool WagFileParser::checkAgiVersionProperty(const WagProperty &version) const { if (version.getCode() == WagProperty::PC_INTVERSION && // Must be AGI interpreter version property version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y" - isdigit(version.getData()[0]) && // And the first character must be a digit + isdigit(static_cast<unsigned char>(version.getData()[0])) && // And the first character must be a digit (version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period for (int i = 2; i < version.getSize(); i++) // And the rest must all be digits - if (!isdigit(version.getData()[i])) + if (!isdigit(static_cast<unsigned char>(version.getData()[i]))) return false; // Bail out if found a non-digit after the decimal point return true; |