summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-11 11:22:25 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-07-11 11:22:35 (GMT)
commitf2c651aec9782e5913db7ad21b88d2dcde5c359d (patch)
tree6445d0fa4638ce4584ff23c9352a7cca8c94543a
parentcd7fad9cf36af521191f59cc3a9fcf6916703ca8 (diff)
parentb872f5b303efab154d740168fe9dd995850559d2 (diff)
downloadCMake-f2c651aec9782e5913db7ad21b88d2dcde5c359d.zip
CMake-f2c651aec9782e5913db7ad21b88d2dcde5c359d.tar.gz
CMake-f2c651aec9782e5913db7ad21b88d2dcde5c359d.tar.bz2
Merge topic 'file-STRINGS-isprint'
b872f5b303 file(STRINGS): Use isprint() to test character type Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2198
-rw-r--r--Source/cmFileCommand.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index e39630e..4c288f5 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -10,6 +10,7 @@
#include <algorithm>
#include <assert.h>
+#include <ctype.h>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
@@ -609,8 +610,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
continue;
}
- if ((c >= 0x20 && c < 0x7F) || c == '\t' ||
- (c == '\n' && newline_consume)) {
+ if (c >= 0 && c <= 0xFF &&
+ (isprint(c) || c == '\t' || (c == '\n' && newline_consume))) {
// This is an ASCII character that may be part of a string.
// Cast added to avoid compiler warning. Cast is ok because
// c is guaranteed to fit in char by the above if...