This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 03655800e9142fd2e0b8a1db025fb5751a9009b3 (commit) via 5784747d1b0404a0c1cb0223b15b823476023fba (commit) via 5cec953e6aafd4c132a7b6c0a929d95c1dee79ea (commit) via 2a1a2033afe73da08af46e12ed77a8f55a89417f (commit) via 34bc6e1f3b2564abfcc79e7724697c2657a56129 (commit) from e35490d722241d1646b25642b80187b4d658fea9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=03655800e9142fd2e0b8a1db025fb5751a9009b3 commit 03655800e9142fd2e0b8a1db025fb5751a9009b3 Merge: e35490d 5784747 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Tue May 24 17:31:33 2016 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue May 24 17:31:33 2016 -0400 Merge topic 'improve-character-find-and-replace' into next 5784747d Improve string find: prefer character overloads. 5cec953e Use std::replace for replacing chars in strings. 2a1a2033 cmExtraEclipseCDT4Generator: use std::replace. 34bc6e1f cmCTestScriptHandler: don't call find repeatedly. diff --cc Source/cmLocalUnixMakefileGenerator3.cxx index 8d4955b,46891b7..653ea40 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@@ -960,11 -949,11 +960,11 @@@ void cmLocalUnixMakefileGenerator3::App cmSystemTools::ReplaceString(cmd, "/./", "/"); // Convert the command to a relative path only if the current // working directory will be the start-output directory. - bool had_slash = cmd.find("/") != cmd.npos; + bool had_slash = cmd.find('/') != cmd.npos; if (workingDir.empty()) { - cmd = this->Convert(cmd, START_OUTPUT); + cmd = this->Convert(cmd, cmOutputConverter::START_OUTPUT); } - bool has_slash = cmd.find("/") != cmd.npos; + bool has_slash = cmd.find('/') != cmd.npos; if (had_slash && !has_slash) { // This command was specified as a path to a file in the // current directory. Add a leading "./" so it can run https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5784747d1b0404a0c1cb0223b15b823476023fba commit 5784747d1b0404a0c1cb0223b15b823476023fba Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Tue May 24 21:24:10 2016 +0200 Commit: Daniel Pfeifer <dan...@pfeifer-mail.de> CommitDate: Tue May 24 23:22:24 2016 +0200 Improve string find: prefer character overloads. Apply fix-its from clang-tidy's performance-faster-string-find checker. Ignore findings in kwsys. diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index df612e5..ad153d1 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -56,13 +56,13 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( } else if ((pos = dependence.find(">=")) != std::string::npos) { Compare.Type = CompareGreaterOrEqual; Compare.Value = dependence.substr(pos + 2); - } else if ((pos = dependence.find("<")) != std::string::npos) { + } else if ((pos = dependence.find('<')) != std::string::npos) { Compare.Type = CompareLess; Compare.Value = dependence.substr(pos + 1); - } else if ((pos = dependence.find("=")) != std::string::npos) { + } else if ((pos = dependence.find('=')) != std::string::npos) { Compare.Type = CompareEqual; Compare.Value = dependence.substr(pos + 1); - } else if ((pos = dependence.find(">")) != std::string::npos) { + } else if ((pos = dependence.find('>')) != std::string::npos) { Compare.Type = CompareGreater; Compare.Value = dependence.substr(pos + 1); } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index e54be2c..10f60b2 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -68,7 +68,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, (void)argument; cpackDefinitions* def = static_cast<cpackDefinitions*>(call_data); std::string value = cValue; - size_t pos = value.find_first_of("="); + size_t pos = value.find_first_of('='); if (pos == std::string::npos) { cmCPack_Log(def->Log, cmCPackLog::LOG_ERROR, "Please specify CPack definitions as: KEY=VALUE" << std::endl); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 20b0e9c..7141daf 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -617,7 +617,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) cmSystemTools::ConvertToUnixSlashes(cm->SourceFile); if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) { cmSystemTools::ReplaceString(cm->SourceFile, "/.../", ""); - std::string::size_type p = cm->SourceFile.find("/"); + std::string::size_type p = cm->SourceFile.find('/'); if (p != cm->SourceFile.npos) { cm->SourceFile = cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 550a774..51456ed 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1238,7 +1238,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // Initially all entries are -1 (not used). If we get coverage // information, increment it to 0 first. if (vec[lineIdx] < 0) { - if (cov > 0 || prefix.find("#") != prefix.npos) { + if (cov > 0 || prefix.find('#') != prefix.npos) { vec[lineIdx] = 0; } } @@ -1543,7 +1543,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // Initially all entries are -1 (not used). If we get coverage // information, increment it to 0 first. if (vec[lineIdx] < 0) { - if (cov > 0 || prefix.find("#") != prefix.npos) { + if (cov > 0 || prefix.find('#') != prefix.npos) { vec[lineIdx] = 0; } } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index bbc6b37..f373348 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -417,7 +417,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } } std::string upload_as = url + - ((url.find("?", 0) == std::string::npos) ? "?" : "&") + "FileName=" + + ((url.find('?') == std::string::npos) ? '?' : '&') + "FileName=" + ofile; upload_as += "&MD5="; @@ -706,7 +706,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, } } std::string turl = url + - ((url.find("?", 0) == std::string::npos) ? "?" : "&") + "xmlfile=" + + ((url.find('?') == std::string::npos) ? '?' : '&') + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl << std::endl; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 4935f11..20ef693 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1869,7 +1869,7 @@ bool cmCTestTestHandler::SetTestsProperties( cmSystemTools::ExpandListArgument(val, rtit->Labels); } if (key == "MEASUREMENT") { - size_t pos = val.find_first_of("="); + size_t pos = val.find_first_of('='); if (pos != val.npos) { std::string mKey = val.substr(0, pos); const char* mVal = val.c_str() + pos + 1; diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index d20b16a..2e06078 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -171,7 +171,7 @@ public: } lastoffset = line.find("class="); - endcovpos = line.find(">", lastoffset); + endcovpos = line.find('>', lastoffset); lineresult = line.substr(lastoffset + 7, (endcovpos - 8) - lastoffset); if (lineresult == "covered") { diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 7368560..b740eb0 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -729,7 +729,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() void cmCursesMainForm::FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const { - out = in.substr(0, in.find_last_not_of(" ") + 1); + out = in.substr(0, in.find_last_not_of(' ') + 1); if (type == cmState::PATH || type == cmState::FILEPATH) { cmSystemTools::ConvertToUnixSlashes(out); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7e5d966..64e8078 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -721,7 +721,7 @@ bool cmCTest::UpdateCTestConfiguration() if (line[0] == '#') { continue; } - std::string::size_type cpos = line.find_first_of(":"); + std::string::size_type cpos = line.find_first_of(':'); if (cpos == line.npos) { continue; } @@ -2480,7 +2480,7 @@ void cmCTest::AddSubmitFile(Part part, const char* name) void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) { - size_t epos = overStr.find("="); + size_t epos = overStr.find('='); if (epos == overStr.npos) { cmCTestLog(this, ERROR_MESSAGE, "CTest configuration overwrite specified in the wrong format." diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index b8af178..c595ada 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -77,7 +77,7 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg) for (std::vector<std::string>::const_iterator it = definitions.begin(); it != definitions.end(); ++it) { std::string def = *it; - std::string::size_type assignment = def.find("="); + std::string::size_type assignment = def.find('='); if (assignment != std::string::npos) { def = it->substr(0, assignment); } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 2d645da..736c7da 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -608,8 +608,8 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression( while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos) { std::string::size_type nameStartPos = pos + sizeof("$<TARGET_PROPERTY:") - 1; - std::string::size_type closePos = input.find(">", nameStartPos); - std::string::size_type commaPos = input.find(",", nameStartPos); + std::string::size_type closePos = input.find('>', nameStartPos); + std::string::size_type commaPos = input.find(',', nameStartPos); std::string::size_type nextOpenPos = input.find("$<", nameStartPos); if (commaPos == input.npos // Implied 'this' target || closePos == input.npos // Imcomplete expression. @@ -634,7 +634,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression( lastPos = pos; while ((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos) { std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1; - std::string::size_type endPos = input.find(">", nameStartPos); + std::string::size_type endPos = input.find('>', nameStartPos); if (endPos == input.npos) { errorString = "$<TARGET_NAME:...> expression incomplete"; break; @@ -659,7 +659,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression( while (errorString.empty() && (pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos) { std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1; - std::string::size_type endPos = input.find(">", nameStartPos); + std::string::size_type endPos = input.find('>', nameStartPos); if (endPos == input.npos) { errorString = "$<LINK_ONLY:...> expression incomplete"; break; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 002f9ec..53243b8 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -300,7 +300,7 @@ void cmGeneratorExpression::Split(const std::string& input, std::string part = input.substr(lastPos, pos - lastPos); std::string preGenex; if (!part.empty()) { - std::string::size_type startPos = input.rfind(";", pos); + std::string::size_type startPos = input.rfind(';', pos); if (startPos == std::string::npos) { preGenex = part; part = ""; @@ -364,7 +364,7 @@ std::string::size_type cmGeneratorExpression::Find(const std::string& input) { const std::string::size_type openpos = input.find("$<"); if (openpos != std::string::npos && - input.find(">", openpos) != std::string::npos) { + input.find('>', openpos) != std::string::npos) { return openpos; } return std::string::npos; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 31fff9f..f30bb8b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -145,7 +145,7 @@ struct DoAccept<true> // where the user supplied the file name and Visual Studio // appended the suffix. std::string resx = f->GetFullPath(); - std::string hFileName = resx.substr(0, resx.find_last_of(".")) + ".h"; + std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h"; data.ExpectedResxHeaders.insert(hFileName); data.ResxSources.push_back(f); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4a52f51..2648bf4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -640,7 +640,7 @@ std::string cmLocalGenerator::ExpandRuleVariable( if (variable == "TARGET_BASE") { // Strip the last extension off the target name. std::string targetBase = replaceValues.Target; - std::string::size_type pos = targetBase.rfind("."); + std::string::size_type pos = targetBase.rfind('.'); if (pos != targetBase.npos) { return targetBase.substr(0, pos); } else { @@ -2306,7 +2306,7 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName( std::string ssin = sin; // Avoid full paths by removing leading slashes. - ssin.erase(0, ssin.find_first_not_of("/")); + ssin.erase(0, ssin.find_first_not_of('/')); // Avoid full paths by removing colons. std::replace(ssin.begin(), ssin.end(), ':', '_'); @@ -2464,7 +2464,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( // Remove the source extension if it is to be replaced. if (replaceExt) { keptSourceExtension = false; - std::string::size_type dot_pos = objectName.rfind("."); + std::string::size_type dot_pos = objectName.rfind('.'); if (dot_pos != std::string::npos) { objectName = objectName.substr(0, dot_pos); } @@ -2603,7 +2603,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const } // Many compilers do not support # in the value so we disable it. - if (define.find_first_of("#") != define.npos) { + if (define.find_first_of('#') != define.npos) { std::ostringstream e; /* clang-format off */ e << "WARNING: Preprocessor definitions containing '#' may not be " diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index c7e1a90f8..d0b667f 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -205,7 +205,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os) cmSystemTools::ExpandListArgument(jobpools, pools); for (size_t i = 0; i < pools.size(); ++i) { const std::string pool = pools[i]; - const std::string::size_type eq = pool.find("="); + const std::string::size_type eq = pool.find('='); unsigned int jobs; if (eq != std::string::npos && sscanf(pool.c_str() + eq, "=%u", &jobs) == 1) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index defac95..46891b7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -71,7 +71,7 @@ private: static std::string cmSplitExtension(std::string const& in, std::string& base) { std::string ext; - std::string::size_type dot_pos = in.rfind("."); + std::string::size_type dot_pos = in.rfind('.'); if (dot_pos != std::string::npos) { // Remove the extension first in case &base == &in. ext = in.substr(dot_pos, std::string::npos); @@ -949,11 +949,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( cmSystemTools::ReplaceString(cmd, "/./", "/"); // Convert the command to a relative path only if the current // working directory will be the start-output directory. - bool had_slash = cmd.find("/") != cmd.npos; + bool had_slash = cmd.find('/') != cmd.npos; if (workingDir.empty()) { cmd = this->Convert(cmd, START_OUTPUT); } - bool has_slash = cmd.find("/") != cmd.npos; + bool has_slash = cmd.find('/') != cmd.npos; if (had_slash && !has_slash) { // This command was specified as a path to a file in the // current directory. Add a leading "./" so it can run @@ -975,9 +975,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( // must be written {{} instead of just {. Otherwise some // curly braces are removed. The hack can be skipped if the // first curly brace is the last character. - std::string::size_type lcurly = cmd.find("{"); + std::string::size_type lcurly = cmd.find('{'); if (lcurly != cmd.npos && lcurly < (cmd.size() - 1)) { - std::string::size_type rcurly = cmd.find("}"); + std::string::size_type rcurly = cmd.find('}'); if (rcurly == cmd.npos || rcurly > lcurly) { // The first curly is a left curly. Use the hack. std::string hack_cmd = cmd.substr(0, lcurly); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e480140..c67170d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -661,9 +661,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( if (do_preprocess_rules || do_assembly_rules) { std::vector<std::string> force_depends; force_depends.push_back("cmake_force"); - std::string::size_type dot_pos = relativeObj.rfind("."); + std::string::size_type dot_pos = relativeObj.rfind('.'); std::string relativeObjBase = relativeObj.substr(0, dot_pos); - dot_pos = obj.rfind("."); + dot_pos = obj.rfind('.'); std::string objBase = obj.substr(0, dot_pos); if (do_preprocess_rules) { @@ -1479,7 +1479,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs( useResponseFile, useWatcomQuote); linkLibs = frameworkPath + linkPath + linkLibs; - if (useResponseFile && linkLibs.find_first_not_of(" ") != linkLibs.npos) { + if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) { // Lookup the response file reference flag. std::string responseFlagVar = "CMAKE_"; responseFlagVar += diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ed83069..52278d0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1298,7 +1298,7 @@ cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment() eit != currentEnv.end(); ++eit) { std::string var(*eit); - std::string::size_type pos = var.find("="); + std::string::size_type pos = var.find('='); if (pos != std::string::npos) { var = var.substr(0, pos); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 891b291..a7718d2 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -386,7 +386,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::cerr << "cmake -E env: unknown option '" << a << "'" << std::endl; return 1; - } else if (a.find("=") != a.npos) { + } else if (a.find('=') != a.npos) { // Set environment variable. cmSystemTools::PutEnv(a); } else { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cec953e6aafd4c132a7b6c0a929d95c1dee79ea commit 5cec953e6aafd4c132a7b6c0a929d95c1dee79ea Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Tue May 24 22:58:11 2016 +0200 Commit: Daniel Pfeifer <dan...@pfeifer-mail.de> CommitDate: Tue May 24 23:22:20 2016 +0200 Use std::replace for replacing chars in strings. Find uses of `cmSystemTools::ReplaceString` where both `replace` and `with` are string literals with a size of one. Automate with: git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g" diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 4d48cb5..9fa588d 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -74,7 +74,7 @@ int cmCPackNSISGenerator::PackageFiles() // Strip off the component part of the path. fileN = fileN.substr(fileN.find('/') + 1, std::string::npos); } - cmSystemTools::ReplaceString(fileN, "/", "\\"); + std::replace(fileN.begin(), fileN.end(), '/', '\\'); str << " Delete \"$INSTDIR\\" << fileN << "\"" << std::endl; } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Files: " << str.str() @@ -104,7 +104,7 @@ int cmCPackNSISGenerator::PackageFiles() fileN = fileN.substr(slash + 1, std::string::npos); } } - cmSystemTools::ReplaceString(fileN, "/", "\\"); + std::replace(fileN.begin(), fileN.end(), '/', '\\'); dstr << " RMDir \"$INSTDIR\\" << fileN << "\"" << std::endl; if (!componentName.empty()) { this->Components[componentName].Directories.push_back(fileN); @@ -548,7 +548,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostringstream& str, // Convert / to \ in filenames, but not in urls: // if (!url) { - cmSystemTools::ReplaceString(sourceName, "/", "\\"); + std::replace(sourceName.begin(), sourceName.end(), '/', '\\'); } ++it; @@ -790,13 +790,13 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( for (pathIt = component->Files.begin(); pathIt != component->Files.end(); ++pathIt) { path = *pathIt; - cmSystemTools::ReplaceString(path, "/", "\\"); + std::replace(path.begin(), path.end(), '/', '\\'); macrosOut << " Delete \"$INSTDIR\\" << path << "\"\n"; } for (pathIt = component->Directories.begin(); pathIt != component->Directories.end(); ++pathIt) { path = *pathIt; - cmSystemTools::ReplaceString(path, "/", "\\"); + std::replace(path.begin(), path.end(), '/', '\\'); macrosOut << " RMDir \"$INSTDIR\\" << path << "\"\n"; } macrosOut << " noremove_" << component->Name << ":\n"; diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index fc6603a..a4b9a47 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -34,13 +34,13 @@ int cmCPackRPMGenerator::InitializeInternal() */ if (this->GetOption("CPACK_PACKAGE_NAME")) { std::string packageName = this->GetOption("CPACK_PACKAGE_NAME"); - cmSystemTools::ReplaceString(packageName, " ", "-"); + std::replace(packageName.begin(), packageName.end(), ' ', '-'); this->SetOption("CPACK_PACKAGE_NAME", packageName.c_str()); } /* same for CPACK_PACKAGE_FILE_NAME */ if (this->GetOption("CPACK_PACKAGE_FILE_NAME")) { std::string packageName = this->GetOption("CPACK_PACKAGE_FILE_NAME"); - cmSystemTools::ReplaceString(packageName, " ", "-"); + std::replace(packageName.begin(), packageName.end(), ' ', '-'); this->SetOption("CPACK_PACKAGE_FILE_NAME", packageName.c_str()); } return this->Superclass::InitializeInternal(); diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 7ed96ab..27234d7 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -32,9 +32,9 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args, cmsys::RegularExpression reg("[()/]"); if (reg.find(cacheValue)) { std::string cv = cacheValue; - cmSystemTools::ReplaceString(cv, "/", "_"); - cmSystemTools::ReplaceString(cv, "(", "_"); - cmSystemTools::ReplaceString(cv, ")", "_"); + std::replace(cv.begin(), cv.end(), '/', '_'); + std::replace(cv.begin(), cv.end(), '(', '_'); + std::replace(cv.begin(), cv.end(), ')', '_'); this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", cmState::STRING); } @@ -57,9 +57,9 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->ExpandVariablesInString(compiler); buildname += "-"; buildname += cmSystemTools::GetFilenameName(compiler); - cmSystemTools::ReplaceString(buildname, "/", "_"); - cmSystemTools::ReplaceString(buildname, "(", "_"); - cmSystemTools::ReplaceString(buildname, ")", "_"); + std::replace(buildname.begin(), buildname.end(), '/', '_'); + std::replace(buildname.begin(), buildname.end(), '(', '_'); + std::replace(buildname.begin(), buildname.end(), ')', '_'); this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), "Name of build.", cmState::STRING); diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 6f7cfbe..d8c629c 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -95,9 +95,9 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args, func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i); } cmSystemTools::ConvertToUnixSlashes(func_name); - cmSystemTools::ReplaceString(func_name, " ", "_"); - cmSystemTools::ReplaceString(func_name, "/", "_"); - cmSystemTools::ReplaceString(func_name, ":", "_"); + std::replace(func_name.begin(), func_name.end(), ' ', '_'); + std::replace(func_name.begin(), func_name.end(), '/', '_'); + std::replace(func_name.begin(), func_name.end(), ':', '_'); tests_func_name.push_back(func_name); forwardDeclareCode += "int "; forwardDeclareCode += func_name; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 8a80f46..0ae913e 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -214,7 +214,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR"); } std::string fOSDir(this->trimQuotes(osDir)); - cmSystemTools::ReplaceString(fOSDir, "\\", "/"); + std::replace(fOSDir.begin(), fOSDir.end(), '\\', '/'); if (!fOSDir.empty() && ('c' == fOSDir[0] || 'C' == fOSDir[0])) { this->OSDirRelative = false; } else { @@ -230,7 +230,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); } std::string fBspName(this->trimQuotes(bspName)); - cmSystemTools::ReplaceString(fBspName, "\\", "/"); + std::replace(fBspName.begin(), fBspName.end(), '\\', '/'); this->WriteMacros(); this->WriteHighLevelDirectives(); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index d65b463..af6e88c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -113,9 +113,9 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path) std::string result = path; #ifdef _WIN32 if (this->IsGCCOnWindows()) - cmSystemTools::ReplaceString(result, "\\", "/"); + std::replace(result.begin(), result.end(), '\\', '/'); else - cmSystemTools::ReplaceString(result, "/", "\\"); + std::replace(result.begin(), result.end(), '/', '\\'); #endif return EncodeLiteral(result); } @@ -742,7 +742,7 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path) std::string convPath = ng->Convert(path, cmOutputConverter::HOME_OUTPUT); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 - cmSystemTools::ReplaceString(convPath, "/", "\\"); + std::replace(convPath.begin(), convPath.end(), '/', '\\'); #endif return convPath; } @@ -755,7 +755,7 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule( std::string convPath = ng->Convert(path + "/all", cmOutputConverter::HOME); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 - cmSystemTools::ReplaceString(convPath, "/", "\\"); + std::replace(convPath.begin(), convPath.end(), '/', '\\'); #endif return convPath; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index cfe5e49..3f2dd17 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -457,7 +457,7 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout) std::string fullName = iter->first; std::string guid = this->GetGUID(fullName.c_str()); - cmSystemTools::ReplaceString(fullName, "/", "\\"); + std::replace(fullName.begin(), fullName.end(), '/', '\\'); if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix)) { fullName = fullName.substr(skip_prefix); } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 8066201..1bec581 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -622,7 +622,7 @@ void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName, DWORD dw = 0; std::string s(macrosFile); - cmSystemTools::ReplaceString(s, "/", "\\"); + std::replace(s.begin(), s.end(), '/', '\\'); std::wstring ws = cmsys::Encoding::ToWide(s); result = diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index efc239e..727df36 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -367,7 +367,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget( std::string const& tName, std::string const& configName) { std::string target = tName; - cmSystemTools::ReplaceString(target, " ", "_"); + std::replace(target.begin(), target.end(), ' ', '_'); std::string out = "PostBuild." + target; if (this->XcodeVersion > 20) { out += "." + configName; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 31fd91a..2fef3a8 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -93,11 +93,11 @@ void cmInstallExportGenerator::ComputeTempDir() dest[0] = '_'; } // Avoid windows full paths by removing colons. - cmSystemTools::ReplaceString(dest, ":", "_"); + std::replace(dest.begin(), dest.end(), ':', '_'); // Avoid relative paths that go up the tree. cmSystemTools::ReplaceString(dest, "../", "__/"); // Avoid spaces. - cmSystemTools::ReplaceString(dest, " ", "_"); + std::replace(dest.begin(), dest.end(), ' ', '_'); this->TempDir += dest; } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0ff13d9..4a52f51 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2309,13 +2309,13 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName( ssin.erase(0, ssin.find_first_not_of("/")); // Avoid full paths by removing colons. - cmSystemTools::ReplaceString(ssin, ":", "_"); + std::replace(ssin.begin(), ssin.end(), ':', '_'); // Avoid relative paths that go up the tree. cmSystemTools::ReplaceString(ssin, "../", "__/"); // Avoid spaces. - cmSystemTools::ReplaceString(ssin, " ", "_"); + std::replace(ssin.begin(), ssin.end(), ' ', '_'); // Mangle the name if necessary. if (this->Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES")) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 88c6d61..defac95 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1190,7 +1190,7 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable( // if this there is no value for this->MakefileVariableSize then // the string must have bad characters in it if (!this->MakefileVariableSize) { - cmSystemTools::ReplaceString(ret, ".", "_"); + std::replace(ret.begin(), ret.end(), '.', '_'); cmSystemTools::ReplaceString(ret, "-", "__"); cmSystemTools::ReplaceString(ret, "+", "___"); int ni = 0; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4d58242..4a252f3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -134,7 +134,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, // needed by cmcldeps false, this->GetConfigName()); if (this->GetGlobalGenerator()->IsGCCOnWindows()) - cmSystemTools::ReplaceString(includeFlags, "\\", "/"); + std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/'); this->LocalGenerator->AppendFlags(languageFlags, includeFlags); } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index cb1801f..ac64397 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1303,7 +1303,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile, const std::string& qrcOutputFile) { std::string relName = this->SourceRelativePath(qrcInputFile); - cmSystemTools::ReplaceString(relName, "/", "_"); + std::replace(relName.begin(), relName.end(), '/', '_'); relName += cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile); const ::std::string qrcBuildFile = this->Builddir + qrcOutputFile; diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx index 3438321..440b635 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -62,7 +62,7 @@ bool cmSeparateArgumentsCommand::InitialPass( // Original space-replacement version of command. if (const char* def = this->Makefile->GetDefinition(var)) { std::string value = def; - cmSystemTools::ReplaceString(value, " ", ";"); + std::replace(value.begin(), value.end(), ' ', ';'); this->Makefile->AddDefinition(var, value.c_str()); } } else { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 3d93e69..7dd642a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2207,7 +2207,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( libs = libs.substr(0, pos + 1); } // Replace spaces in libs with ; - cmSystemTools::ReplaceString(libs, " ", ";"); + std::replace(libs.begin(), libs.end(), ' ', ';'); std::vector<std::string> libVec; cmSystemTools::ExpandListArgument(libs, libVec); diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index 4f5e7c0..bc6b0bf 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -141,8 +141,8 @@ std::string cmVisualStudioWCEPlatformParser::FixPaths( cmSystemTools::ReplaceString(ret, "$(PATH)", "%PATH%"); cmSystemTools::ReplaceString(ret, "$(VCInstallDir)", VcInstallDir.c_str()); cmSystemTools::ReplaceString(ret, "$(VSInstallDir)", VsInstallDir.c_str()); - cmSystemTools::ReplaceString(ret, "\\", "/"); + std::replace(ret.begin(), ret.end(), '\\', '/'); cmSystemTools::ReplaceString(ret, "//", "/"); - cmSystemTools::ReplaceString(ret, "/", "\\"); + std::replace(ret.begin(), ret.end(), '/', '\\'); return ret; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a1a2033afe73da08af46e12ed77a8f55a89417f commit 2a1a2033afe73da08af46e12ed77a8f55a89417f Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Tue May 24 23:06:56 2016 +0200 Commit: Daniel Pfeifer <dan...@pfeifer-mail.de> CommitDate: Tue May 24 23:22:16 2016 +0200 cmExtraEclipseCDT4Generator: use std::replace. diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index a8f2e3f..e8a04e8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -435,11 +435,7 @@ void cmExtraEclipseCDT4Generator::WriteGroups( linkName3 += "/"; linkName3 += sgIt->GetFullName(); - size_t pos = 0; - while ((pos = linkName3.find("\\", pos)) != std::string::npos) { - linkName3.replace(pos, 1, "/"); - pos++; - } + std::replace(linkName3.begin(), linkName3.end(), '\\', '/'); this->AppendLinkedResource(xml, linkName3, "virtual:/virtual", VirtualFolder); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34bc6e1f3b2564abfcc79e7724697c2657a56129 commit 34bc6e1f3b2564abfcc79e7724697c2657a56129 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Tue May 24 23:10:21 2016 +0200 Commit: Daniel Pfeifer <dan...@pfeifer-mail.de> CommitDate: Tue May 24 23:22:08 2016 +0200 cmCTestScriptHandler: don't call find repeatedly. Also, prefer the character overload. diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0c09cc7..ba0e816 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -330,9 +330,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) // passed into the scripts as S_ARG std::string script = total_script_arg; std::string script_arg; - if (total_script_arg.find(",") != std::string::npos) { - script = total_script_arg.substr(0, total_script_arg.find(",")); - script_arg = total_script_arg.substr(total_script_arg.find(",") + 1); + const std::string::size_type comma_pos = total_script_arg.find(','); + if (comma_pos != std::string::npos) { + script = total_script_arg.substr(0, comma_pos); + script_arg = total_script_arg.substr(comma_pos + 1); } // make sure the file exists if (!cmSystemTools::FileExists(script.c_str())) { ----------------------------------------------------------------------- Summary of changes: Source/CPack/IFW/cmCPackIFWPackage.cxx | 6 +++--- Source/CPack/cmCPackNSISGenerator.cxx | 10 +++++----- Source/CPack/cmCPackRPMGenerator.cxx | 4 ++-- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 4 ++-- Source/CTest/cmCTestScriptHandler.cxx | 7 ++++--- Source/CTest/cmCTestSubmitHandler.cxx | 4 ++-- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/CTest/cmParseDelphiCoverage.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/cmBuildNameCommand.cxx | 12 ++++++------ Source/cmCTest.cxx | 4 ++-- Source/cmCreateTestSourceList.cxx | 6 +++--- Source/cmDependsFortran.cxx | 2 +- Source/cmExportFileGenerator.cxx | 8 ++++---- Source/cmExtraEclipseCDT4Generator.cxx | 6 +----- Source/cmGeneratorExpression.cxx | 4 ++-- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGlobalGhsMultiGenerator.cxx | 4 ++-- Source/cmGlobalNinjaGenerator.cxx | 8 ++++---- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmInstallExportGenerator.cxx | 4 ++-- Source/cmLocalGenerator.cxx | 12 ++++++------ Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 12 ++++++------ Source/cmMakefileTargetGenerator.cxx | 6 +++--- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmSeparateArgumentsCommand.cxx | 2 +- Source/cmSystemTools.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Source/cmVisualStudioWCEPlatformParser.cxx | 4 ++-- Source/cmcmd.cxx | 2 +- 36 files changed, 78 insertions(+), 81 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits