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/agos | |
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/agos')
-rw-r--r-- | engines/agos/script_pn.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index bde59b71b8..3bd8ce19a3 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -465,8 +465,8 @@ void AGOSEngine_PN::opn_opcode35() { void AGOSEngine_PN::opn_opcode36() { for (int i = 0; i < _dataBase[57] + 1; ++i) _wordcp[i] = 0; - if (isspace(*_inpp)) - while ((*_inpp) && (isspace(*_inpp))) + if (isspace(static_cast<unsigned char>(*_inpp))) + while ((*_inpp) && (isspace(static_cast<unsigned char>(*_inpp)))) _inpp++; if (*_inpp == 0) { setScriptReturn(false); @@ -480,7 +480,7 @@ void AGOSEngine_PN::opn_opcode36() { } int ct = 1; - while ((*_inpp != '.') && (*_inpp != ',') && (!isspace(*_inpp)) && (*_inpp != '\0') && + while ((*_inpp != '.') && (*_inpp != ',') && (!isspace(static_cast<unsigned char>(*_inpp))) && (*_inpp != '\0') && (*_inpp!='"')) { if (ct < _dataBase[57]) _wordcp[ct++] = *_inpp; @@ -580,7 +580,7 @@ void AGOSEngine_PN::opn_opcode46() { return; } x++; - while ((*x != '.') && (*x != ',') && (*x != '"') && (!isspace(*x)) && (*x != '\0')) + while ((*x != '.') && (*x != ',') && (*x != '"') && (!isspace(static_cast<unsigned char>(*x))) && (*x != '\0')) pcf(*x++); setScriptReturn(true); } |