summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose <83477269+AtariDreams@users.noreply.github.com>2021-10-21 20:47:39 (GMT)
committerRose <83477269+AtariDreams@users.noreply.github.com>2021-10-23 15:30:27 (GMT)
commitdd918c517dc32002f44e74b0cdc6fb32cd7bee34 (patch)
treefba67b4be872eca2a515046b2e7aa12f2d3b1957
parent46bd57d2450e450da4f46f5cb45cb8d1dc617d96 (diff)
downloadCMake-dd918c517dc32002f44e74b0cdc6fb32cd7bee34.zip
CMake-dd918c517dc32002f44e74b0cdc6fb32cd7bee34.tar.gz
CMake-dd918c517dc32002f44e74b0cdc6fb32cd7bee34.tar.bz2
Source: Simplify some boolean expressions
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx9
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx5
-rw-r--r--Source/CursesDialog/form/fty_enum.c4
-rw-r--r--Source/cmMachO.cxx5
4 files changed, 11 insertions, 12 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
index f6b8a8a..5d995c3 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.cxx
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -29,19 +29,18 @@ cmValue cmCPackIFWCommon::GetOption(const std::string& op) const
bool cmCPackIFWCommon::IsOn(const std::string& op) const
{
- return this->Generator ? this->Generator->cmCPackGenerator::IsOn(op) : false;
+ return this->Generator && this->Generator->cmCPackGenerator::IsOn(op);
}
bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
{
- return this->Generator ? this->Generator->cmCPackGenerator::IsSetToOff(op)
- : false;
+ return this->Generator && this->Generator->cmCPackGenerator::IsSetToOff(op);
}
bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
{
- return this->Generator ? this->Generator->cmCPackGenerator::IsSetToEmpty(op)
- : false;
+ return this->Generator &&
+ this->Generator->cmCPackGenerator::IsSetToEmpty(op);
}
bool cmCPackIFWCommon::IsVersionLess(const char* version) const
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 57b1dda..b16d4d0 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -49,9 +49,8 @@ public:
}
~cmCTestRunProcess()
{
- if (!(this->PipeState == -1) &&
- !(this->PipeState == cmsysProcess_Pipe_None) &&
- !(this->PipeState == cmsysProcess_Pipe_Timeout)) {
+ if (this->PipeState != -1 && this->PipeState != cmsysProcess_Pipe_None &&
+ this->PipeState != cmsysProcess_Pipe_Timeout) {
this->WaitForExit();
}
cmsysProcess_Delete(this->Process);
diff --git a/Source/CursesDialog/form/fty_enum.c b/Source/CursesDialog/form/fty_enum.c
index 59058a9..f1059b1 100644
--- a/Source/CursesDialog/form/fty_enum.c
+++ b/Source/CursesDialog/form/fty_enum.c
@@ -116,7 +116,7 @@ static int Compare(const unsigned char *s, const unsigned char *buf,
if (*buf=='\0')
{
- return (((*s)!='\0') ? NOMATCH : EXACT);
+ return (((*s)=='\0') ? EXACT : NOMATCH);
}
else
{
@@ -144,7 +144,7 @@ static int Compare(const unsigned char *s, const unsigned char *buf,
/* If it happens that the reference buffer is at its end, the partial
match is actually an exact match. */
- return ((s[-1]!='\0') ? PARTIAL : EXACT);
+ return ((s[-1]=='\0') ? EXACT : PARTIAL);
}
/*---------------------------------------------------------------------------
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index 53112e0..72dd055 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -56,7 +56,7 @@ bool peek(cmsys::ifstream& fin, T& v)
template <typename T>
bool read(cmsys::ifstream& fin, T& v)
{
- return !!fin.read(reinterpret_cast<char*>(&v), sizeof(T));
+ return static_cast<bool>(fin.read(reinterpret_cast<char*>(&v), sizeof(T)));
}
// read from the file and fill multiple data structures where
@@ -68,7 +68,8 @@ bool read(cmsys::ifstream& fin, std::vector<T>& v)
if (v.empty()) {
return true;
}
- return !!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size());
+ return static_cast<bool>(
+ fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size()));
}
}