diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 20:58:11 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 21:22:20 (GMT) |
commit | 5cec953e6aafd4c132a7b6c0a929d95c1dee79ea (patch) | |
tree | 09cf2f4a8f28c5ca8a7e648486fc10e1ae5e2d89 /Source/CPack | |
parent | 2a1a2033afe73da08af46e12ed77a8f55a89417f (diff) | |
download | CMake-5cec953e6aafd4c132a7b6c0a929d95c1dee79ea.zip CMake-5cec953e6aafd4c132a7b6c0a929d95c1dee79ea.tar.gz CMake-5cec953e6aafd4c132a7b6c0a929d95c1dee79ea.tar.bz2 |
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"
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/cmCPackRPMGenerator.cxx | 4 |
2 files changed, 7 insertions, 7 deletions
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(); |