mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
Merge topic 'fix-isspace-usage-for-signed-char'
5e8c176e2a cmExecuteProcessCommand: Cast c to unsigned char before cast to int
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9132
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user