diff options
author | Brad King <brad.king@kitware.com> | 2018-08-09 11:59:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-08-09 11:59:23 (GMT) |
commit | 34334c098f85004242f109857193f5f8cdce697d (patch) | |
tree | 4dee809ad1bbd9a3e22bb3c0c74c0891b5fb3ae4 /Source/CPack | |
parent | a9badfa6f470452f830f95db77e1ccc8eb65ce93 (diff) | |
parent | b6802cd506cd459f94fae7e4cadc8b94daa09d59 (diff) | |
download | CMake-34334c098f85004242f109857193f5f8cdce697d.zip CMake-34334c098f85004242f109857193f5f8cdce697d.tar.gz CMake-34334c098f85004242f109857193f5f8cdce697d.tar.bz2 |
Merge topic 'cmGeneratedFileStream_string'
b6802cd506 cmGeneratedFileStream: clang-tidy applied to remove redundant ``c_str`` calls
a688defcc6 cmGeneratedFileStream: Use ``std::string const&`` instead of ``const char*``
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2266
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWRepository.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackArchiveGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 18 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 8 |
8 files changed, 21 insertions, 21 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index cf8334a..180c92e 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -90,7 +90,7 @@ int cmCPackIFWGenerator::PackageFiles() ifwCmd.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { - cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + cmGeneratedFileStream ofs(ifwTmpFile); ofs << "# Run command: " << ifwCmd << std::endl << "# Output:" << std::endl << output << std::endl; @@ -203,7 +203,7 @@ int cmCPackIFWGenerator::PackageFiles() ifwCmd.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { - cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + cmGeneratedFileStream ofs(ifwTmpFile); ofs << "# Run command: " << ifwCmd << std::endl << "# Output:" << std::endl << output << std::endl; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 36cf08c..8f492af 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -306,7 +306,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() } // Output stream - cmGeneratedFileStream fout((this->Directory + "/config/config.xml").data()); + cmGeneratedFileStream fout(this->Directory + "/config/config.xml"); cmXMLWriter xout(fout); xout.StartDocument(); diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index f24ab69..67e279c 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -528,7 +528,7 @@ void cmCPackIFWPackage::GeneratePackageFile() } // Output stream - cmGeneratedFileStream fout((this->Directory + "/meta/package.xml").data()); + cmGeneratedFileStream fout(this->Directory + "/meta/package.xml"); cmXMLWriter xout(fout); xout.StartDocument(); diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index a01fc4e..987cad8 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -183,7 +183,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() this->Directory + "/repository/UpdatesPatch.xml"; // Output stream - cmGeneratedFileStream fout(updatesPatchXml.data()); + cmGeneratedFileStream fout(updatesPatchXml); cmXMLWriter xout(fout); xout.StartDocument(); diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 593b4bf..ee1070f 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -103,7 +103,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( */ #define DECLARE_AND_OPEN_ARCHIVE(filename, archive) \ cmGeneratedFileStream gf; \ - gf.Open((filename).c_str(), false, true); \ + gf.Open((filename), false, true); \ if (!GenerateHeader(&gf)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ "Problem to generate Header for archive <" \ diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index c53dd32..972fe6f 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -238,7 +238,7 @@ int cmCPackDebGenerator::createDeb() const std::string strGenWDIR(this->GetOption("GEN_WDIR")); const std::string dbfilename = strGenWDIR + "/debian-binary"; { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(dbfilename.c_str()); + cmGeneratedFileStream out(dbfilename); out << "2.0"; out << std::endl; // required for valid debian package } @@ -287,7 +287,7 @@ int cmCPackDebGenerator::createDeb() this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE"); { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(ctlfilename.c_str()); + cmGeneratedFileStream out(ctlfilename); out << "Package: " << debian_pkg_name << "\n"; out << "Version: " << debian_pkg_version << "\n"; out << "Section: " << debian_pkg_section << "\n"; @@ -347,7 +347,7 @@ int cmCPackDebGenerator::createDeb() const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") && debian_pkg_shlibs && *debian_pkg_shlibs; if (gen_shibs) { - cmGeneratedFileStream out(shlibsfilename.c_str()); + cmGeneratedFileStream out(shlibsfilename); out << debian_pkg_shlibs; out << std::endl; } @@ -355,7 +355,7 @@ int cmCPackDebGenerator::createDeb() const std::string postinst = strGenWDIR + "/postinst"; const std::string postrm = strGenWDIR + "/postrm"; if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) { - cmGeneratedFileStream out(postinst.c_str()); + cmGeneratedFileStream out(postinst); out << "#!/bin/sh\n\n" "set -e\n\n" "if [ \"$1\" = \"configure\" ]; then\n" @@ -363,7 +363,7 @@ int cmCPackDebGenerator::createDeb() "fi\n"; } if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTRM")) { - cmGeneratedFileStream out(postrm.c_str()); + cmGeneratedFileStream out(postrm); out << "#!/bin/sh\n\n" "set -e\n\n" "if [ \"$1\" = \"remove\" ]; then\n" @@ -412,7 +412,7 @@ int cmCPackDebGenerator::createDeb() // atomic file generation for data.tar { cmGeneratedFileStream fileStream_data_tar; - fileStream_data_tar.Open(filename_data_tar.c_str(), false, true); + fileStream_data_tar.Open(filename_data_tar, false, true); if (!fileStream_data_tar) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error opening the file \"" @@ -493,7 +493,7 @@ int cmCPackDebGenerator::createDeb() std::string md5filename = strGenWDIR + "/md5sums"; { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(md5filename.c_str()); + cmGeneratedFileStream out(md5filename); std::string topLevelWithTrailingSlash = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); @@ -528,7 +528,7 @@ int cmCPackDebGenerator::createDeb() // atomic file generation for control.tar { cmGeneratedFileStream fileStream_control_tar; - fileStream_control_tar.Open(filename_control_tar.c_str(), false, true); + fileStream_control_tar.Open(filename_control_tar, false, true); if (!fileStream_control_tar) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error opening the file \"" << filename_control_tar @@ -662,7 +662,7 @@ int cmCPackDebGenerator::createDeb() std::string const outputPath = outputDir + "/" + outputName; std::string const tlDir = strGenWDIR + "/"; cmGeneratedFileStream debStream; - debStream.Open(outputPath.c_str(), false, true); + debStream.Open(outputPath, false, true); cmArchiveWrite deb(debStream, cmArchiveWrite::CompressNone, "arbsd"); // uid/gid should be the one of the root user, and this root user has diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 7014676..78af622 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -288,7 +288,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( if (!resB || retVal) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/InstallOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << ic << std::endl << "# Output:" << std::endl << output << std::endl; @@ -660,7 +660,7 @@ int cmCPackGenerator::RunPreinstallTarget( if (!resB || retVal) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/PreinstallOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << buildCommand << std::endl << "# Directory: " << installDirectory << std::endl << "# Output:" << std::endl diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index e46b2cf..f75a750 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -305,7 +305,7 @@ int cmCPackNSISGenerator::PackageFiles() nsisCmd.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl << output << std::endl; @@ -416,7 +416,7 @@ int cmCPackNSISGenerator::InitializeInternal() const char* topDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpFile = topDir ? topDir : "."; tmpFile += "/NSISOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl << output << std::endl; @@ -726,7 +726,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( cmSystemTools::IsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES")); unsigned long totalSize = 0; { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(zipListFileName.c_str()); + cmGeneratedFileStream out(zipListFileName); for (std::string const& file : component->Files) { if (needQuotesInFile) { out << "\""; @@ -754,7 +754,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( if (!res || retVal) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/CompressZip.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << cmd << std::endl << "# Output:" << std::endl << output << std::endl; |