clang-tidy: use operators for string comparison

This commit is contained in:
Daniel Pfeifer
2017-04-21 19:19:29 +02:00
parent 8985c1dfd7
commit ba8571ff2d
4 changed files with 7 additions and 8 deletions

View File

@@ -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 \""

View File

@@ -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;

View File

@@ -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 == "") {

View File

@@ -3153,7 +3153,7 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
langs.reserve(lang.size());
for (std::vector<std::string>::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);