Commit f2c651ae authored by Brad King's avatar Brad King 💬 Committed by Kitware Robot
Browse files

Merge topic 'file-STRINGS-isprint'

b872f5b3

 file(STRINGS): Use isprint() to test character type
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2198
parents cd7fad9c b872f5b3
......@@ -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...
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment