summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmExecuteProcessCommand.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index e764545..483a601 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -35,7 +35,11 @@
namespace {
bool cmExecuteProcessCommandIsWhitespace(char c)
{
- return (isspace(static_cast<int>(c)) || c == '\n' || c == '\r');
+ // isspace takes 'int' but documents that the value must be representable
+ // by 'unsigned char', or EOF. Cast to 'unsigned char' to avoid sign
+ // extension while casting to 'int'.
+ return (isspace(static_cast<int>(static_cast<unsigned char>(c))) ||
+ c == '\n' || c == '\r');
}
void cmExecuteProcessCommandFixText(std::vector<char>& output,