diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 2 | ||||
-rw-r--r-- | Source/cmDocumentation.cxx | 17 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 2 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 29 |
6 files changed, 27 insertions, 39 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 57b47f1..5e5f066 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -171,17 +171,17 @@ 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) { + // Setting the user value in any case + WizardStyle = option; + // Check known values + if (WizardStyle != "Modern" && WizardStyle != "Aero" && + WizardStyle != "Mac" && WizardStyle != "Classic") { cmCPackLogger( cmCPackLog::LOG_WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \"" << option << "\". Expected values are: Modern, Aero, Mac, Classic." << std::endl); } - - WizardStyle = option; } // WizardDefaultWidth 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 c24aecb..d73811b 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1735,7 +1735,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/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 5f25113..c6286b3 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -129,28 +129,19 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) this->CurrentArgument = i->Argument; // If a file name was given, use it. Otherwise, default to the // given stream. - cmsys::ofstream* fout = CM_NULLPTR; + cmsys::ofstream fout; std::ostream* s = &os; if (!i->Filename.empty()) { - fout = new cmsys::ofstream(i->Filename.c_str()); - if (fout) { - s = fout; - } else { - result = false; - } + fout.open(i->Filename.c_str()); + s = &fout; } else if (++count > 1) { os << "\n\n"; } // Print this documentation type to the stream. - if (!this->PrintDocumentation(i->HelpType, *s) || !*s) { + if (!this->PrintDocumentation(i->HelpType, *s) || s->fail()) { result = false; } - - // Close the file if we wrote one. - if (fout) { - delete fout; - } } return result; } 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<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); diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 8227ab7..11ee897 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -50,9 +50,8 @@ std::vector<std::string> getConfigurations(const cmake* cm) bool hasString(const Json::Value& v, const std::string& s) { return !v.isNull() && - std::find_if(v.begin(), v.end(), [s](const Json::Value& i) { - return i.asString() == s; - }) != v.end(); + std::any_of(v.begin(), v.end(), + [s](const Json::Value& i) { return i.asString() == s; }); } template <class T> @@ -493,16 +492,14 @@ cmServerResponse cmServerProtocol1_0::ProcessCache( if (keys.empty()) { keys = allKeys; } else { - for (auto i : keys) { - if (std::find_if(allKeys.begin(), allKeys.end(), - [i](const std::string& j) { return i == j; }) == - allKeys.end()) { + for (const auto& i : keys) { + if (std::find(allKeys.begin(), allKeys.end(), i) == allKeys.end()) { return request.ReportError("Key \"" + i + "\" not found in cache."); } } } std::sort(keys.begin(), keys.end()); - for (auto key : keys) { + for (const auto& key : keys) { Json::Value entry = Json::objectValue; entry[kKEY_KEY] = key; entry[kTYPE_KEY] = @@ -511,7 +508,7 @@ cmServerResponse cmServerProtocol1_0::ProcessCache( Json::Value props = Json::objectValue; bool haveProperties = false; - for (auto prop : state->GetCacheEntryPropertyList(key)) { + for (const auto& prop : state->GetCacheEntryPropertyList(key)) { haveProperties = true; props[prop] = state->GetCacheEntryProperty(key, prop); } @@ -598,7 +595,7 @@ bool LanguageData::operator==(const LanguageData& other) const void LanguageData::SetDefines(const std::set<std::string>& defines) { std::vector<std::string> result; - for (auto i : defines) { + for (const auto& i : defines) { result.push_back(i); } std::sort(result.begin(), result.end()); @@ -615,11 +612,11 @@ struct hash<LanguageData> using std::hash; size_t result = hash<std::string>()(in.Language) ^ hash<std::string>()(in.Flags); - for (auto i : in.IncludePathList) { + for (const auto& i : in.IncludePathList) { result = result ^ (hash<std::string>()(i.first) ^ (i.second ? std::numeric_limits<size_t>::max() : 0)); } - for (auto i : in.Defines) { + for (const auto& i : in.Defines) { result = result ^ hash<std::string>()(i); } result = @@ -643,7 +640,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data, } if (!data.IncludePathList.empty()) { Json::Value includes = Json::arrayValue; - for (auto i : data.IncludePathList) { + for (const auto& i : data.IncludePathList) { Json::Value tmp = Json::objectValue; tmp[kPATH_KEY] = i.first; if (i.second) { @@ -661,7 +658,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data, result[kIS_GENERATED_KEY] = data.IsGenerated; Json::Value sourcesValue = Json::arrayValue; - for (auto i : files) { + for (const auto& i : files) { const std::string relPath = cmSystemTools::RelativePath(baseDir.c_str(), i.c_str()); sourcesValue.append(relPath.size() < i.size() ? relPath : i); @@ -819,7 +816,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, std::set<std::string> languages; target->GetLanguages(languages, config); std::map<std::string, LanguageData> languageDataMap; - for (auto lang : languages) { + for (const auto& lang : languages) { LanguageData& ld = languageDataMap[lang]; ld.Language = lang; lg->GetTargetCompileFlags(target, config, lang, ld.Flags); @@ -1095,7 +1092,7 @@ cmServerResponse cmServerProtocol1_0::ProcessSetGlobalSettings( kWARN_UNINITIALIZED_KEY, kWARN_UNUSED_KEY, kWARN_UNUSED_CLI_KEY, kCHECK_SYSTEM_VARS_KEY }; - for (auto i : boolValues) { + for (const auto& i : boolValues) { if (!request.Data[i].isNull() && !request.Data[i].isBool()) { return request.ReportError("\"" + i + "\" must be unset or a bool value."); |