summaryrefslogtreecommitdiffstats
path: root/Source/cmStringAlgorithms.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmStringAlgorithms.h')
-rw-r--r--Source/cmStringAlgorithms.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 4a9840b..55a1e46 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -44,7 +44,10 @@ private:
/** Returns true if the character @a ch is a whitespace character. **/
inline bool cmIsSpace(char ch)
{
- return ((ch & 0x80) == 0) && std::isspace(ch);
+ // isspace takes 'int' but documents that the value must be representable
+ // by 'unsigned char', or be EOF. Cast to 'unsigned char' to avoid sign
+ // extension while converting to 'int'.
+ return std::isspace(static_cast<unsigned char>(ch));
}
/** Returns a string that has whitespace removed from the start and the end. */