mirror of
https://github.com/Kitware/CMake.git
synced 2025-06-12 16:52:44 +08:00
Source: Simplify some boolean expressions
This commit is contained in:
parent
46bd57d245
commit
dd918c517d
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user