Commit 7f6b8d33 authored by Daniel Pfeifer's avatar Daniel Pfeifer Committed by Brad King

Simplify boolean expressions

Use clang-tidy's readability-simplify-boolean-expr checker.
After applying the fix-its, revise all changes *very* carefully.
Be aware of false positives and invalid changes.
parent d6754d37
......@@ -45,16 +45,16 @@ bool cmCPackIFWRepository::IsValid() const
switch (Update) {
case None:
valid = Url.empty() ? false : true;
valid = !Url.empty();
break;
case Add:
valid = Url.empty() ? false : true;
valid = !Url.empty();
break;
case Remove:
valid = Url.empty() ? false : true;
valid = !Url.empty();
break;
case Replace:
valid = (OldUrl.empty() || NewUrl.empty()) ? false : true;
valid = !OldUrl.empty() && !NewUrl.empty();
break;
}
......@@ -244,11 +244,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
fout.Close();
if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) {
return false;
}
return true;
return cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data());
}
void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
......
......@@ -269,9 +269,5 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const
// The Component installation support should only
// be activated if explicitly requested by the user
// (for backward compatibility reason)
if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) {
return true;
} else {
return false;
}
return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL");
}
......@@ -675,11 +675,7 @@ int cmCPackDebGenerator::createDeb()
bool cmCPackDebGenerator::SupportsComponentInstallation() const
{
if (IsOn("CPACK_DEB_COMPONENT_INSTALL")) {
return true;
} else {
return false;
}
return IsOn("CPACK_DEB_COMPONENT_INSTALL");
}
std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
......
......@@ -228,11 +228,7 @@ int cmCPackRPMGenerator::PackageFiles()
bool cmCPackRPMGenerator::SupportsComponentInstallation() const
{
if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) {
return true;
} else {
return false;
}
return IsOn("CPACK_RPM_COMPONENT_INSTALL");
}
std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
......
......@@ -209,11 +209,7 @@ int main(int argc, char const* const* argv)
* should launch cpack using "cpackConfigFile" if it exists
* in the current directory.
*/
if ((doc.CheckOptions(argc, argv, "-G")) && !(argc == 1)) {
help = true;
} else {
help = false;
}
help = doc.CheckOptions(argc, argv, "-G") && argc != 1;
// This part is used for cpack documentation lookup as well.
cminst.AddCMakePaths();
......
......@@ -90,11 +90,8 @@ public:
cmsysProcess_Execute(this->Process);
this->PipeState = cmsysProcess_GetState(this->Process);
// if the process is running or exited return true
if (this->PipeState == cmsysProcess_State_Executing ||
this->PipeState == cmsysProcess_State_Exited) {
return true;
}
return false;
return this->PipeState == cmsysProcess_State_Executing ||
this->PipeState == cmsysProcess_State_Exited;
}
void SetStdoutFile(const char* fname)
{
......@@ -705,13 +702,8 @@ bool IsFileInDir(const std::string& infile, const std::string& indir)
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);
if (file.size() > dir.size() &&
(fnc(file.substr(0, dir.size())) == fnc(dir)) &&
file[dir.size()] == '/') {
return true;
}
return false;
return file.size() > dir.size() &&
fnc(file.substr(0, dir.size())) == fnc(dir) && file[dir.size()] == '/';
}
int cmCTestCoverageHandler::HandlePHPCoverage(
......
......@@ -594,12 +594,8 @@ bool cmCTestLaunch::Match(std::string const& line,
bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const
{
if (!this->OptionFilterPrefix.empty() &&
cmSystemTools::StringStartsWith(line.c_str(),
this->OptionFilterPrefix.c_str())) {
return true;
}
return false;
return !this->OptionFilterPrefix.empty() &&
cmSystemTools::StringStartsWith(line, this->OptionFilterPrefix.c_str());
}
int cmCTestLaunch::Main(int argc, const char* const argv[])
......
......@@ -722,10 +722,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
ostr << *i << std::endl;
}
log = ostr.str();
if (defects) {
return false;
}
return true;
return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
const std::string& str, std::string& log, std::vector<int>& results)
......@@ -766,10 +763,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
log = ostr.str();
if (defects) {
return false;
}
return true;
return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
......@@ -904,10 +898,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
<< (cmSystemTools::GetTime() - sttime) << std::endl,
this->Quiet);
log = ostr.str();
if (defects) {
return false;
}
return true;
return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
......
......@@ -845,10 +845,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
}
}
cmsysProcess_Delete(cp);
if (problems) {
return false;
}
return true;
return problems == 0;
}
bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
......@@ -870,7 +867,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
}
cmCTest::SetOfStrings::const_iterator file;
bool problems = false;
for (file = files.begin(); file != files.end(); ++file) {
std::string lfname = localprefix;
cmSystemTools::ConvertToUnixSlashes(lfname);
......@@ -883,9 +879,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
}
std::string tagDoneFile = destination + "/" + remoteprefix + "DONE";
cmSystemTools::Touch(tagDoneFile, true);
if (problems) {
return false;
}
return true;
}
......
......@@ -1406,7 +1406,7 @@ void cmCTestTestHandler::UseIncludeRegExp()
void cmCTestTestHandler::UseExcludeRegExp()
{
this->UseExcludeRegExpFlag = true;
this->UseExcludeRegExpFirst = this->UseIncludeRegExpFlag ? false : true;
this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag;
}
const char* cmCTestTestHandler::GetTestStatus(int status)
......
......@@ -27,10 +27,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until)
char c = 0;
while (in.get(c) && c != until) {
}
if (c != until) {
return false;
}
return true;
return c == until;
}
bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in,
std::string const& fileName)
......
......@@ -54,9 +54,5 @@ void cmCursesBoolWidget::SetValueAsBool(bool value)
bool cmCursesBoolWidget::GetValueAsBool()
{
if (this->Value == "ON") {
return true;
} else {
return false;
}
return this->Value == "ON";
}
......@@ -642,5 +642,5 @@ void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v)
bool cmCacheManager::CacheIterator::PropertyExists(
const std::string& prop) const
{
return this->GetProperty(prop) ? true : false;
return this->GetProperty(prop) != NULL;
}
......@@ -274,8 +274,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Check whether we should use an import library for linking a target.
this->UseImportLibrary =
this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX") ? true
: false;
this->Makefile->IsDefinitionSet("CMAKE_IMPORT_LIBRARY_SUFFIX");
// Check whether we should skip dependencies on shared library files.
this->LinkDependsNoShared =
......
......@@ -38,7 +38,7 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
, Backtrace()
, Comment(comment ? comment : "")
, WorkingDirectory(workingDirectory ? workingDirectory : "")
, HaveComment(comment ? true : false)
, HaveComment(comment != NULL)
, EscapeAllowMakeVars(false)
, EscapeOldStyle(true)
{
......
......@@ -278,21 +278,21 @@ void cmDependsC::ReadCacheFile()
continue;
}
// the first line after an empty line is the name of the parsed file
if (haveFileName == false) {
if (!haveFileName) {
haveFileName = true;
int newer = 0;
cmFileTimeComparison comp;
bool res = comp.FileTimeCompare(this->CacheFileName.c_str(),
line.c_str(), &newer);
if ((res == true) && (newer == 1)) // cache is newer than the parsed file
if (res && newer == 1) // cache is newer than the parsed file
{
cacheEntry = new cmIncludeLines;
this->FileCache[line] = cacheEntry;
}
// file doesn't exist, check that the regular expressions
// haven't changed
else if (res == false) {
else if (!res) {
if (line.find(INCLUDE_REGEX_LINE_MARKER) == 0) {
if (line != this->IncludeRegexLineString) {
return;
......
......@@ -654,10 +654,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
// but also do not include a date so we can fall through to
// compare them without skipping any prefix.
unsigned char hdr[2];
bool okay =
finModFile.read(reinterpret_cast<char*>(hdr), 2) ? true : false;
bool okay = !finModFile.read(reinterpret_cast<char*>(hdr), 2).fail();
finModFile.seekg(0);
if (!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b)) {
if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) {
const char seq[1] = { '\n' };
const int seqlen = 1;
......
......@@ -143,7 +143,7 @@ public:
{
this->Stream.seekg(pos);
this->Stream.read(buf, size);
return this->Stream ? true : false;
return !this->Stream.fail();
}
// Lookup the SONAME in the DYNAMIC section.
......@@ -497,7 +497,7 @@ private:
this->NeedSwap) {
ByteSwap(x);
}
return this->Stream ? true : false;
return !this->Stream.fail();
}
bool Read(ELF_Dyn& x)
{
......@@ -505,7 +505,7 @@ private:
this->NeedSwap) {
ByteSwap(x);
}
return this->Stream ? true : false;
return !this->Stream.fail();
}
bool LoadSectionHeader(ELF_Half i)
......
......@@ -655,11 +655,11 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
// projects with C/C++ and Fortran are handled as C/C++ projects
bool pureFortran = false;
std::string compilerIdVar;
if (this->GlobalGenerator->GetLanguageEnabled("CXX") == true) {
if (this->GlobalGenerator->GetLanguageEnabled("CXX")) {
compilerIdVar = "CMAKE_CXX_COMPILER_ID";
} else if (this->GlobalGenerator->GetLanguageEnabled("C") == true) {
} else if (this->GlobalGenerator->GetLanguageEnabled("C")) {
compilerIdVar = "CMAKE_C_COMPILER_ID";
} else if (this->GlobalGenerator->GetLanguageEnabled("Fortran") == true) {
} else if (this->GlobalGenerator->GetLanguageEnabled("Fortran")) {
compilerIdVar = "CMAKE_Fortran_COMPILER_ID";
pureFortran = true;
}
......@@ -667,7 +667,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
std::string compilerId = mf->GetSafeDefinition(compilerIdVar);
std::string compiler = "gcc"; // default to gcc
if (compilerId == "MSVC") {
if (mf->IsDefinitionSet("MSVC10") == true) {
if (mf->IsDefinitionSet("MSVC10")) {
compiler = "msvc10";
} else {
compiler = "msvc8";
......
......@@ -407,7 +407,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(
// figure out which language to use
// for now care only for C and C++
std::string compilerIdVar = "CMAKE_CXX_COMPILER_ID";
if (this->GlobalGenerator->GetLanguageEnabled("CXX") == false) {
if (!this->GlobalGenerator->GetLanguageEnabled("CXX")) {
compilerIdVar = "CMAKE_C_COMPILER_ID";
}
......
......@@ -129,7 +129,7 @@ void cmExtraEclipseCDT4Generator::Generate()
(this->IsOutOfSourceBuild &&
mf->IsOn("CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT"));
if ((this->GenerateSourceProject == false) &&
if (!this->GenerateSourceProject &&
(mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"))) {
mf->IssueMessage(
cmake::WARNING,
......
......@@ -42,7 +42,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream()
// stream will be destroyed which will close the temporary file.
// Finally the base destructor will be called to replace the
// destination file.
this->Okay = (*this) ? true : false;
this->Okay = !this->fail();
}
cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
......@@ -71,7 +71,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
bool cmGeneratedFileStream::Close()
{
// Save whether the temporary output file is valid before closing.
this->Okay = (*this) ? true : false;
this->Okay = !this->fail();
// Close the temporary output file.
this->Stream::close();
......
......@@ -1306,11 +1306,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
this->GetName());
}
if (cmp0042 == cmPolicies::NEW) {
return true;
}
return false;
return cmp0042 == cmPolicies::NEW;
}
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
......
......@@ -180,8 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
} else {
path = name;
}
if ((path.empty() || !cmSystemTools::FileExists(path.c_str())) &&
(optional == false)) {
if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
return;
}
const char* cname =
......
......@@ -1227,9 +1227,9 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const
bool cmGlobalNinjaGenerator::SupportsConsolePool() const
{
return cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
RequiredNinjaVersionForConsolePool().c_str()) == false;
return !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
RequiredNinjaVersionForConsolePool().c_str());
}
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
......
......@@ -140,7 +140,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
// which other targets depend on it.
void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
{
if (this->GenerateDependers == false) {
if (!this->GenerateDependers) {
return;
}
......@@ -153,7 +153,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
continue;
}
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
......@@ -184,7 +184,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
// on which targets it depends.
void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
{
if (this->GeneratePerTarget == false) {
if (!this->GeneratePerTarget) {
return;
}
......@@ -197,7 +197,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
continue;
}
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
......@@ -243,7 +243,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
continue;
}
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
......@@ -344,7 +344,7 @@ void cmGraphVizWriter::WriteDependerConnections(
continue;
}
if (this->GenerateForTargetType(dependerIt->second->GetType()) == false) {
if (!this->GenerateForTargetType(dependerIt->second->GetType())) {
continue;
}
......@@ -403,7 +403,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName,
void cmGraphVizWriter::CollectTargetsAndLibs()
{
if (this->HaveTargetsAndLibs == false) {
if (!this->HaveTargetsAndLibs) {
this->HaveTargetsAndLibs = true;
int cnt = this->CollectAllTargets();
if (this->GenerateForExternals) {
......
......@@ -202,10 +202,7 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
this->Functions.insert(this->Functions.begin(), project);
}
}
if (parseError) {
return false;
}
return true;
return !parseError;
}
bool cmListFileParser::ParseFunction(const char* name, long line)
......
......@@ -1322,7 +1322,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
// not be considered.
std::map<std::string, cmDepends::DependencyVector> validDependencies;
bool needRescanDependencies = false;
if (needRescanDirInfo == false) {
if (!needRescanDirInfo) {
cmDependsC checker;
checker.SetVerbose(verbose);
checker.SetFileComparison(ftc);
......
......@@ -2124,20 +2124,11 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const
// If we are doing an in-source build, then the test will always fail
if (cmSystemTools::SameFile(this->GetHomeDirectory(),
this->GetHomeOutputDirectory())) {
if (this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD")) {
return false;
}
return true;
return !this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD");
}
// Check if this is a subdirectory of the source tree but not a
// subdirectory of the build tree
if (cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) &&
!cmSystemTools::IsSubDirectory(fileName,
this->GetHomeOutputDirectory())) {
return false;
}
return true;
return !cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) ||
cmSystemTools::IsSubDirectory(fileName, this->GetHomeOutputDirectory());
}
const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
......@@ -2166,7 +2157,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
}
}
#endif
return def ? true : false;
return def != NULL;
}
const char* cmMakefile::GetDefinition(const std::string& name) const
......
......@@ -454,8 +454,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
haveStaticLibraryRule =
this->Makefile->GetDefinition(linkRuleVar) ? true : false;
haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar);
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
arCreateVar += "_ARCHIVE_CREATE";
......
......@@ -130,8 +130,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
// Add include directory flags.
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, language,
language == "RC" ? true : false, // full include paths for RC
// needed by cmcldeps
language == "RC", // full include paths for RC needed by cmcldeps
false, this->GetConfigName());
if (this->GetGlobalGenerator()->IsGCCOnWindows())
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
......
......@@ -31,12 +31,7 @@ void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
{
cmPropertyDefinitionMap::const_iterator it = this->find(name);
if (it == this->end()) {
return false;
}
return true;
return this->find(name) != this->end();
}
bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
......
......@@ -636,14 +636,14 @@ void cmQtAutoGenerators::ParseCppFile(
}
} else {
std::string fileToMoc = absFilename;
if ((basename != scannedFileBasename) || (requiresMoc == false)) {
if (!requiresMoc || basename != scannedFileBasename) {
std::string mocSubDir = extractSubDir(absPath, currentMoc);
std::string headerToMoc =
findMatchingHeader(absPath, mocSubDir, basename, headerExtensions);
if (!headerToMoc.empty()) {
// this is for KDE4 compatibility:
fileToMoc = headerToMoc;
if ((requiresMoc == false) && (basename == scannedFileBasename)) {
if (!requiresMoc && basename == scannedFileBasename) {
std::stringstream err;
err << "AUTOGEN: warning: " << absFilename
<< ": The file "
......@@ -696,8 +696,8 @@ void cmQtAutoGenerators::ParseCppFile(
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
if ((dotMocIncluded == false) && (requiresMoc == true)) {
if (mocUnderscoreIncluded == true) {
if (!dotMocIncluded && requiresMoc) {
if (mocUnderscoreIncluded) {
// this is for KDE4 compatibility:
std::stringstream err;
err << "AUTOGEN: warning: " << absFilename << ": The file "
......@@ -833,8 +833,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
std::string macroName;
if ((dotMocIncluded == false) &&
(requiresMocing(contentsString, macroName))) {
if (!dotMocIncluded && requiresMocing(contentsString, macroName)) {
// otherwise always error out since it will not compile:
std::stringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file "
......
......@@ -177,10 +177,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension(
}
std::vector<std::string> hdrExts =
mf->GetCMakeInstance()->GetHeaderExtensions();
if (std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) {
return true;
}
return false;
return std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end();
}
bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
......
......@@ -86,11 +86,7 @@ bool cmSourceGroup::MatchesRegex(const char* name)
bool cmSourceGroup::MatchesFiles(const char* name)
{
std::set<std::string>::const_iterator i = this->GroupFiles.find(name);
if (i != this->GroupFiles.end()) {
return true;
}
return false;
return this->GroupFiles.find(name) != this->GroupFiles.end();
}
void cmSourceGroup::AssignSource(const cmSourceFile* sf)
......
......@@ -2108,11 +2108,8 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
// If the symlink points at an extended version of the same name
// assume it is the soname.
std::string name = cmSystemTools::GetFilenameName(fullPath);
if (soname.length() > name.length() &&
soname.substr(0, name.length()) == name) {
return true;
}
return false;
return soname.length() > name.length() &&
soname.compare(0, name.length(), name) == 0;
}
bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
......
......@@ -1027,11 +1027,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
// Enable or disable color based on the switch value.
std::string value = args[i].substr(9);
if (!value.empty()) {
if (cmSystemTools::IsOn(value.c_str())) {
enabled = true;
} else {
enabled = false;
}
enabled = cmSystemTools::IsOn(value.c_str());
}
} else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) {
progressDir = args[i].substr(15);
......@@ -1226,7 +1222,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
if (args.size() < 2) {
return -1;
}
bool verbose = cmSystemTools::GetEnv("VERBOSE") ? true : false;
bool verbose = cmSystemTools::GetEnv("VERBOSE") != NULL;
std::vector<std::string> expandedArgs;
for (std::vector<std::string>::iterator i = args.begin(); i != args.end();
++i) {
......
Markdown is supported
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