summaryrefslogtreecommitdiff
path: root/Source/cmOutputConverter.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-07-28 15:13:38 +0200
committerSebastian Holtermann <sebholt@xwmw.org>2019-07-28 17:47:26 +0200
commit49117623581f8f154adcf92820dce48a4dfbe71d (patch)
tree9282667cd0edfa5d991a78e09a4c1234a06f677e /Source/cmOutputConverter.cxx
parenta929255dec9e46ccc27d7b44d000a2e568cbfd99 (diff)
downloadcmake-49117623581f8f154adcf92820dce48a4dfbe71d.tar.gz
cmOutputConverter: Return bool instead of int in utility functions
Diffstat (limited to 'Source/cmOutputConverter.cxx')
-rw-r--r--Source/cmOutputConverter.cxx32
1 files changed, 16 insertions, 16 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index bd5dffe129..fd64cf599d 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -213,12 +213,12 @@ use the caret character itself (^), use two in a row (^^).
*/
/* Some helpers to identify character classes */
-static int Shell__CharIsWhitespace(char c)
+static bool Shell__CharIsWhitespace(char c)
{
return ((c == ' ') || (c == '\t'));
}
-static int Shell__CharNeedsQuotesOnUnix(char c)
+static bool Shell__CharNeedsQuotesOnUnix(char c)
{
return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
(c == '&') || (c == '$') || (c == '(') || (c == ')') || (c == '~') ||
@@ -226,41 +226,41 @@ static int Shell__CharNeedsQuotesOnUnix(char c)
(c == '\\'));
}
-static int Shell__CharNeedsQuotesOnWindows(char c)
+static bool Shell__CharNeedsQuotesOnWindows(char c)
{
return ((c == '\'') || (c == '#') || (c == '&') || (c == '<') ||
(c == '>') || (c == '|') || (c == '^'));
}
-static int Shell__CharIsMakeVariableName(char c)
+static bool Shell__CharIsMakeVariableName(char c)
{
return c && (c == '_' || isalpha((static_cast<int>(c))));
}
-int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
+bool cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
{
/* On Windows the built-in command shell echo never needs quotes. */
if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) {
- return 0;
+ return false;
}
/* On all platforms quotes are needed to preserve whitespace. */
if (Shell__CharIsWhitespace(c)) {
- return 1;
+ return true;
}
if (flags & Shell_Flag_IsUnix) {
/* On UNIX several special characters need quotes to preserve them. */
if (Shell__CharNeedsQuotesOnUnix(c)) {
- return 1;
+ return true;
}
} else {
/* On Windows several special characters need quotes to preserve them. */
if (Shell__CharNeedsQuotesOnWindows(c)) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
const char* cmOutputConverter::Shell__SkipMakeVariables(const char* c)
@@ -302,11 +302,11 @@ flag later when we understand applications of this better.
*/
#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
-int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
+bool cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
{
/* The empty string needs quotes. */
if (!*in) {
- return 1;
+ return true;
}
/* Scan the string for characters that require quoting. */
@@ -320,7 +320,7 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
if (skip != c) {
/* We need to quote make variable references to preserve the
string with contents substituted in its place. */
- return 1;
+ return true;
}
#else
/* Skip over the make variable references if any are present. */
@@ -335,7 +335,7 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
/* Check whether this character needs quotes. */
if (Shell__CharNeedsQuotes(*c, flags)) {
- return 1;
+ return true;
}
}
}
@@ -344,11 +344,11 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
if (flags & Shell_Flag_IsUnix && *in && !*(in + 1)) {
char c = *in;
if ((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)