From ba8571ff2deb3a29bb980e109abef0e7290de56a Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 21 Apr 2017 19:19:29 +0200 Subject: clang-tidy: use operators for string comparison --- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 5 ++--- Source/CPack/IFW/cmCPackIFWPackage.cxx | 6 +++--- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmMakefile.cxx | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 57b47f1..664048d 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -171,9 +171,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // WizardStyle if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { - if (WizardStyle.compare("Modern") == 0 && - WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 && - WizardStyle.compare("Classic") == 0) { + if (WizardStyle == "Modern" && WizardStyle == "Aero" && + WizardStyle == "Mac" && WizardStyle == "Classic") { cmCPackLogger( cmCPackLog::LOG_WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \"" diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 99e8b9e..eda383f 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -514,11 +514,11 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) Default.clear(); } else if (const char* value = GetOption(option)) { std::string lowerValue = cmsys::SystemTools::LowerCase(value); - if (lowerValue.compare("true") == 0) { + if (lowerValue == "true") { Default = "true"; - } else if (lowerValue.compare("false") == 0) { + } else if (lowerValue == "false") { Default = "false"; - } else if (lowerValue.compare("script") == 0) { + } else if (lowerValue == "script") { Default = "script"; } else { Default = value; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 167fecf..c5a4faa 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1727,7 +1727,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() // bcc crashes if we attempt a normal substring comparison, // hence the following workaround std::string fileNameSubstring = fileName.substr(0, pattern.length()); - if (fileNameSubstring.compare(pattern) != 0) { + if (fileNameSubstring != pattern) { continue; } if (logName == "") { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b8a5293..cb11060 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3153,7 +3153,7 @@ void cmMakefile::EnableLanguage(std::vector const& lang, langs.reserve(lang.size()); for (std::vector::const_iterator i = lang.begin(); i != lang.end(); ++i) { - if (i->compare("RC") == 0) { + if (*i == "RC") { langsRC.push_back(*i); } else { langs.push_back(*i); -- cgit v0.12