diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-11 12:35:32 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-11 14:03:50 (GMT) |
commit | af8a1643c1a42aa3b276a50bca10a4faab176764 (patch) | |
tree | e43581126113bdad071f92dbe531b5d7d1009660 /Source/CPack | |
parent | 21c573f682f9eafbc8d4402f7febbb1bec1cb86a (diff) | |
download | CMake-af8a1643c1a42aa3b276a50bca10a4faab176764.zip CMake-af8a1643c1a42aa3b276a50bca10a4faab176764.tar.gz CMake-af8a1643c1a42aa3b276a50bca10a4faab176764.tar.bz2 |
Remove c_str calls when using stream APIs.
Use an ad-hoc clang tool for matching the calls which should be
ported.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 32 | ||||
-rw-r--r-- | Source/CPack/cmCPackLog.cxx | 12 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 42 | ||||
-rw-r--r-- | Source/CPack/cmCPackSTGZGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 10 |
6 files changed, 58 insertions, 58 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 9ae5839..27e9d9f 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -444,13 +444,13 @@ int cmCPackDebGenerator::createDeb() std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/Deb.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl + ofs << "# Run command: " << cmd << std::endl << "# Working directory: " << toplevel << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << cmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -528,13 +528,13 @@ int cmCPackDebGenerator::createDeb() std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/Deb.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl + ofs << "# Run command: " << cmd << std::endl << "# Working directory: " << toplevel << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << cmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index cf514aa..9cdf5aa 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -285,7 +285,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( it != installCommandsVector.end(); ++it ) { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << it->c_str() + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << *it << std::endl); std::string output; int retVal = 1; @@ -296,12 +296,12 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/InstallOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << it->c_str() << std::endl + ofs << "# Run command: " << *it << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << it->c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" + "Problem running install command: " << *it << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -329,7 +329,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ++it ) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Create ignore files regex for: " << it->c_str() << std::endl); + "Create ignore files regex for: " << *it << std::endl); ignoreFilesRegex.push_back(it->c_str()); } } @@ -385,7 +385,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( if ( regIt->find(inFile.c_str()) ) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Ignore file: " - << inFile.c_str() << std::endl); + << inFile << std::endl); skip = true; } } @@ -397,7 +397,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(top.c_str(), gfit->c_str()); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " - << inFile.c_str() << " -> " << filePath.c_str() << std::endl); + << inFile << " -> " << filePath << std::endl); /* If the file is a symlink we will have to re-create it */ if ( cmSystemTools::FileIsSymlink(inFile.c_str())) { @@ -416,7 +416,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " - << inFile.c_str() << " -> " << filePath.c_str() << std::endl); + << inFile << " -> " << filePath << std::endl); return 0; } } @@ -663,14 +663,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/PreinstallOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommandStr.c_str() << std::endl - << "# Directory: " << installDirectory.c_str() << std::endl + ofs << "# Run command: " << buildCommandStr << std::endl + << "# Directory: " << installDirectory << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << buildCommandStr.c_str() + "Problem running install command: " << buildCommandStr << std::endl - << "Please check " << tmpFile.c_str() << " for errors" + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -1001,7 +1001,7 @@ void cmCPackGenerator::SetOption(const std::string& op, const char* value) int cmCPackGenerator::DoPackage() { cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "Create package using " << this->Name.c_str() << std::endl); + "Create package using " << this->Name << std::endl); // Prepare CPack internal name and check // values for many CPACK_xxx vars @@ -1269,7 +1269,7 @@ std::string cmCPackGenerator::FindTemplate(const char* name) << (name ? name : "(NULL)") << std::endl); std::string ffile = this->MakefileMap->GetModulesFile(name); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " - << ffile.c_str() << std::endl); + << ffile << std::endl); return ffile; } diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 4e8bf0f..7befca0 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -169,27 +169,27 @@ void cmCPackLog::Log(int tag, const char* file, int line, { if ( error && !this->ErrorPrefix.empty() ) { - *this->DefaultError << this->ErrorPrefix.c_str(); + *this->DefaultError << this->ErrorPrefix; } else if ( warning && !this->WarningPrefix.empty() ) { - *this->DefaultError << this->WarningPrefix.c_str(); + *this->DefaultError << this->WarningPrefix; } else if ( output && !this->OutputPrefix.empty() ) { - *this->DefaultOutput << this->OutputPrefix.c_str(); + *this->DefaultOutput << this->OutputPrefix; } else if ( verbose && !this->VerbosePrefix.empty() ) { - *this->DefaultOutput << this->VerbosePrefix.c_str(); + *this->DefaultOutput << this->VerbosePrefix; } else if ( debug && !this->DebugPrefix.empty() ) { - *this->DefaultOutput << this->DebugPrefix.c_str(); + *this->DefaultOutput << this->DebugPrefix; } else if ( !this->Prefix.empty() ) { - *this->DefaultOutput << this->Prefix.c_str(); + *this->DefaultOutput << this->Prefix; } if ( useFileAndLine ) { diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index f433834..0113698 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -83,10 +83,10 @@ int cmCPackNSISGenerator::PackageFiles() fileN = fileN.substr(fileN.find('/')+1, std::string::npos); } cmSystemTools::ReplaceString(fileN, "/", "\\"); - str << " Delete \"$INSTDIR\\" << fileN.c_str() << "\"" << std::endl; + str << " Delete \"$INSTDIR\\" << fileN << "\"" << std::endl; } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Files: " - << str.str().c_str() << std::endl); + << str.str() << std::endl); this->SetOptionIfNotSet("CPACK_NSIS_DELETE_FILES", str.str().c_str()); std::vector<std::string> dirs; this->GetListOfSubdirectories(toplevel.c_str(), dirs); @@ -117,14 +117,14 @@ int cmCPackNSISGenerator::PackageFiles() } } cmSystemTools::ReplaceString(fileN, "/", "\\"); - dstr << " RMDir \"$INSTDIR\\" << fileN.c_str() << "\"" << std::endl; + dstr << " RMDir \"$INSTDIR\\" << fileN << "\"" << std::endl; if (!componentName.empty()) { this->Components[componentName].Directories.push_back(fileN); } } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Dirs: " - << dstr.str().c_str() << std::endl); + << dstr.str() << std::endl); this->SetOptionIfNotSet("CPACK_NSIS_DELETE_DIRECTORIES", dstr.str().c_str()); @@ -320,7 +320,7 @@ int cmCPackNSISGenerator::PackageFiles() std::string nsisCmd = "\""; nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM"); nsisCmd += "\" \"" + nsisFileName + "\""; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd.c_str() + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl); std::string output; int retVal = 1; @@ -329,12 +329,12 @@ int cmCPackNSISGenerator::PackageFiles() if ( !res || retVal ) { cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << nsisCmd.c_str() << std::endl + ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running NSIS command: " - << nsisCmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << nsisCmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } return 1; @@ -427,7 +427,7 @@ int cmCPackNSISGenerator::InitializeInternal() std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: " - << nsisCmd.c_str() << std::endl); + << nsisCmd << std::endl); std::string output; int retVal = 1; bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), @@ -442,13 +442,13 @@ int cmCPackNSISGenerator::InitializeInternal() std::string tmpFile = topDir ? topDir : "."; tmpFile += "/NSISOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << nsisCmd.c_str() << std::endl + ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem checking NSIS version with command: " - << nsisCmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << nsisCmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } if ( versionRex.find(output)) @@ -470,7 +470,7 @@ int cmCPackNSISGenerator::InitializeInternal() { // No version check for NSIS cvs build cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: CVS " - << versionRexCVS.match(1).c_str() << std::endl); + << versionRexCVS.match(1) << std::endl); } this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str()); this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin"); @@ -844,12 +844,12 @@ CreateComponentDescription(cmCPackComponent *component, std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/CompressZip.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl + ofs << "# Run command: " << cmd << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << cmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return ""; } @@ -891,7 +891,7 @@ CreateComponentDescription(cmCPackComponent *component, path = *pathIt; cmSystemTools::ReplaceString(path, "/", "\\"); macrosOut << " Delete \"$INSTDIR\\" - << path.c_str() + << path << "\"\n"; } for (pathIt = component->Directories.begin(); @@ -901,7 +901,7 @@ CreateComponentDescription(cmCPackComponent *component, path = *pathIt; cmSystemTools::ReplaceString(path, "/", "\\"); macrosOut << " RMDir \"$INSTDIR\\" - << path.c_str() + << path << "\"\n"; } macrosOut << " noremove_" << component->Name << ":\n"; diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 8342fee..6c1d201 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -43,7 +43,7 @@ int cmCPackSTGZGenerator::InitializeInternal() if ( inFile.empty() ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find template file: " - << inFile.c_str() << std::endl); + << inFile << std::endl); return 0; } this->SetOptionIfNotSet("CPACK_STGZ_HEADER_FILE", inFile.c_str()); @@ -134,6 +134,6 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) cmSystemTools::ReplaceString(res, headerLengthTag, buffer); // Write in file - *os << res.c_str(); + *os << res; return this->Superclass::GenerateHeader(os); } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d1a16f0..7ebfeda 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -91,7 +91,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, value = value.c_str() + pos + 1; def->Map[key] = value; cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " - << key.c_str() << " to \"" << value.c_str() << "\"" << std::endl); + << key << " to \"" << value << "\"" << std::endl); return 1; } @@ -195,7 +195,7 @@ int main (int argc, char const* const* argv) } cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, - "Read CPack config file: " << cpackConfigFile.c_str() << std::endl); + "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; cminst.RemoveUnscriptableCommands(); @@ -262,20 +262,20 @@ int main (int argc, char const* const* argv) cpackConfigFile = cmSystemTools::CollapseFullPath(cpackConfigFile.c_str()); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, - "Read CPack configuration file: " << cpackConfigFile.c_str() + "Read CPack configuration file: " << cpackConfigFile << std::endl); if ( !globalMF->ReadListFile(0, cpackConfigFile.c_str()) ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Problem reading CPack config file: \"" - << cpackConfigFile.c_str() << "\"" << std::endl); + << cpackConfigFile << "\"" << std::endl); return 1; } } else if ( cpackConfigFileSpecified ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Cannot find CPack config file: \"" << cpackConfigFile.c_str() + "Cannot find CPack config file: \"" << cpackConfigFile << "\"" << std::endl); return 1; } |