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 /common/config-manager.cpp | |
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 'common/config-manager.cpp')
-rw-r--r-- | common/config-manager.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 3941e27cc1..a9d8c89035 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -31,7 +31,7 @@ DECLARE_SINGLETON(Common::ConfigManager); static bool isValidDomainName(const Common::String &domName) { const char *p = domName.c_str(); - while (*p && (isalnum(*p) || *p == '-' || *p == '_')) + while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_')) p++; return *p == 0; } @@ -187,7 +187,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) { // Get the domain name, and check whether it's valid (that // is, verify that it only consists of alphanumerics, // dashes and underscores). - while (*p && (isalnum(*p) || *p == '-' || *p == '_')) + while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_')) p++; if (*p == '\0') @@ -205,7 +205,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) { // Skip leading whitespaces const char *t = line.c_str(); - while (isspace(*t)) + while (isspace(static_cast<unsigned char>(*t))) t++; // Skip empty lines / lines with only whitespace |