Commit fa277b29 authored by Daniel Pfeifer's avatar Daniel Pfeifer

Remove c_str() calls from stream arguments.

Mostly automated:

git grep -l '.c_str() <<' | xargs sed -i 's|\.c_str() <<| <<|g'
parent ba5fb165
......@@ -72,7 +72,7 @@ int main(int argc, char* argv[])
std::string scriptDirectory =
cmsys::SystemTools::GetFilenamePath(fullScriptPath);
ofs << fullScriptPath.c_str() << std::endl;
ofs << fullScriptPath << std::endl;
std::vector<const char*> args;
args.push_back(fullScriptPath.c_str());
int cc;
......
......@@ -232,12 +232,12 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID");
temp_sign_file_cmd << " \"";
temp_sign_file_cmd << bundle_path;
temp_sign_file_cmd << it->c_str() << "\"";
temp_sign_file_cmd << *it << "\"";
if (!this->RunCommand(temp_sign_file_cmd, &output)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error signing file:"
<< bundle_path << it->c_str() << std::endl
<< output << std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error signing file:" << bundle_path << *it << std::endl
<< output << std::endl);
return 0;
}
......
......@@ -158,11 +158,10 @@ int cmCPackOSXX11Generator::PackageFiles()
tmpFile += "/hdiutilOutput.log";
std::ostringstream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
<< "\" create -ov -format UDZO -srcfolder \""
<< diskImageDirectory.c_str() << "\" \"" << packageFileNames[0]
<< "\"";
<< "\" create -ov -format UDZO -srcfolder \"" << diskImageDirectory
<< "\" \"" << packageFileNames[0] << "\"";
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress disk image using command: "
<< dmgCmd.str().c_str() << std::endl);
<< dmgCmd.str() << std::endl);
// since we get random dashboard failures with this one
// try running it more than once
int retVal = 1;
......@@ -181,12 +180,12 @@ int cmCPackOSXX11Generator::PackageFiles()
}
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl
ofs << "# Run command: " << dmgCmd.str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
<< output << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running hdiutil command: "
<< dmgCmd.str().c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors"
<< dmgCmd.str() << std::endl
<< "Please check " << tmpFile << " for errors"
<< std::endl);
return 0;
}
......@@ -249,7 +248,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< (inFileName ? inFileName : "(NULL)")
<< " to " << destFileName.c_str() << std::endl);
<< " to " << destFileName << std::endl);
this->ConfigureFile(inFileName, destFileName.c_str());
return true;
}
......@@ -277,9 +276,8 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
destFileName += "/";
destFileName += outputFileName;
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << inFileName.c_str() << " to "
<< destFileName.c_str() << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< inFileName << " to " << destFileName << std::endl);
this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly);
return true;
}
......
......@@ -316,9 +316,9 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(
this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(),
(name + ext).c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< (inFileName ? inFileName : "(NULL)") << " to "
<< destFileName.c_str() << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << (inFileName ? inFileName : "(NULL)")
<< " to " << destFileName << std::endl);
this->ConfigureFile(inFileName, destFileName.c_str());
return true;
}
......@@ -344,9 +344,8 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(
destFileName += "/";
destFileName += outName;
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << inFileName.c_str() << " to "
<< destFileName.c_str() << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< inFileName << " to " << destFileName << std::endl);
this->ConfigureFile(inFileName.c_str(), destFileName.c_str());
return true;
}
......@@ -360,8 +359,8 @@ int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir,
dst += name;
cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str());
cmSystemTools::SetPermissions(dst.c_str(), 0777);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : "
<< script << "\ninto " << dst.c_str() << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"copy script : " << script << "\ninto " << dst << std::endl);
return 1;
}
......@@ -101,7 +101,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating installer directory: "
<< preflightDirName.c_str() << std::endl);
<< preflightDirName << std::endl);
return 0;
}
}
......@@ -109,7 +109,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating installer directory: "
<< postflightDirName.c_str() << std::endl);
<< postflightDirName << std::endl);
return 0;
}
}
......@@ -137,7 +137,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating component packages directory: "
<< packageDir.c_str() << std::endl);
<< packageDir << std::endl);
return 0;
}
......@@ -147,7 +147,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
cmCPackLogger(
cmCPackLog::LOG_ERROR,
"Problem creating component PostFlight Packages directory: "
<< packageFileDir.c_str() << std::endl);
<< packageFileDir << std::endl);
return 0;
}
std::string packageFile =
......@@ -169,7 +169,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating component packages directory: "
<< basePackageDir.c_str() << std::endl);
<< basePackageDir << std::endl);
return 0;
}
......@@ -314,12 +314,12 @@ int cmCPackPackageMakerGenerator::PackageFiles()
}
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl
ofs << "# Run command: " << dmgCmd.str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
<< output << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running hdiutil command: "
<< dmgCmd.str().c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors"
<< dmgCmd.str() << std::endl
<< "Please check " << tmpFile << " for errors"
<< std::endl);
return 0;
}
......@@ -382,7 +382,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
if (!cmSystemTools::FileExists(versionFile.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find PackageMaker compiler version file: "
<< versionFile.c_str() << std::endl);
<< versionFile << std::endl);
return 0;
}
......@@ -416,7 +416,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
if (!cmSystemTools::GetLineFromStream(ifs, line) || !rexVersion.find(line)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem reading the PackageMaker compiler version file: "
<< versionFile.c_str() << std::endl);
<< versionFile << std::endl);
return 0;
}
this->PackageMakerVersion = atof(rexVersion.match(1).c_str());
......@@ -481,11 +481,11 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command,
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << command << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
<< output << std::endl;
cmCPackLogger(
cmCPackLog::LOG_ERROR, "Problem running PackageMaker command: "
<< command << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
<< "Please check " << tmpFile << " for errors" << std::endl);
return false;
}
// sometimes the command finishes but the directory is not yet
......
......@@ -47,7 +47,7 @@ int cmCPackProductBuildGenerator::PackageFiles()
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating component packages directory: "
<< basePackageDir.c_str() << std::endl);
<< basePackageDir << std::endl);
return 0;
}
......@@ -153,12 +153,12 @@ bool cmCPackProductBuildGenerator::RunProductBuild(
{
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << command << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
<< "# Output:" << std::endl
<< output << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem running command: " << command
<< std::endl << "Please check " << tmpFile.c_str() << " for errors"
<< std::endl);
"Problem running command: " << command << std::endl
<< "Please check " << tmpFile
<< " for errors" << std::endl);
return false;
}
return true;
......@@ -194,8 +194,8 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
if ( !cmsys::SystemTools::MakeDirectory(scriptDir.c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating installer directory: "
<< scriptDir.c_str() << std::endl);
"Problem creating installer directory: " << scriptDir
<< std::endl);
return 0;
}
......
......@@ -302,7 +302,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
out << "Could not find path to executable, perhaps it was not built: "
<< this->TestCommand << "\n";
out << "tried to find it in these places:\n";
out << fullPath.c_str() << "\n";
out << fullPath << "\n";
for (unsigned int i = 0; i < failed.size(); ++i) {
out << failed[i] << "\n";
}
......
......@@ -1012,7 +1012,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
"-o \"" + fileDir + "\" " + "\"" + *it + "\"";
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
command.c_str() << std::endl, this->Quiet);
command << std::endl, this->Quiet);
std::string output = "";
std::string errors = "";
......@@ -1377,7 +1377,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
"Current coverage dir: " << fileDir << std::endl,
this->Quiet);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
command.c_str() << std::endl, this->Quiet);
command << std::endl, this->Quiet);
std::string output = "";
std::string errors = "";
......
......@@ -991,7 +991,7 @@ void cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(
cmsys::ifstream ifs(ofile.c_str());
if (!ifs) {
std::string log = "Cannot read memory tester output file: " + ofile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
return;
}
res.Output += BOUNDS_CHECKER_MARKER;
......@@ -1024,7 +1024,7 @@ void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res,
cmsys::ifstream ifs(ofile.c_str());
if (!ifs) {
std::string log = "Cannot read memory tester output file: " + ofile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
return;
}
std::string line;
......@@ -1056,7 +1056,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
g.FindFiles(ofile);
if (g.GetFiles().empty()) {
std::string log = "Cannot find memory tester output file: " + ofile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
ofile = "";
} else {
files = g.GetFiles();
......@@ -1064,7 +1064,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
}
} else if (!cmSystemTools::FileExists(ofile.c_str())) {
std::string log = "Cannot find memory tester output file: " + ofile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
ofile = "";
}
files.push_back(ofile);
......
......@@ -449,7 +449,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
fout << "---\n";
for (std::vector<std::string>::iterator i = this->Failed->begin();
i != this->Failed->end(); ++i) {
fout << i->c_str() << "\n";
fout << *i << "\n";
}
fout.close();
cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str());
......@@ -710,8 +710,8 @@ void cmCTestMultiProcessHandler::PrintTestList()
<< indexStr.str(),
this->Quiet);
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
p.Name.c_str() << std::endl, this->Quiet);
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, p.Name << std::endl,
this->Quiet);
// pop working dir
cmSystemTools::ChangeDirectory(current_dir);
}
......
......@@ -902,8 +902,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
/* Call the famous server at UserLand. */
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: "
<< realURL.c_str() << " (" << remoteprefix.c_str()
<< ")" << std::endl,
<< realURL << " (" << remoteprefix << ")" << std::endl,
this->Quiet);
cmCTest::SetOfStrings::const_iterator file;
for (file = files.begin(); file != files.end(); ++file) {
......@@ -914,12 +913,12 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
local_file = localprefix + "/" + *file;
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Submit file: " << local_file.c_str() << std::endl,
" Submit file: " << local_file << std::endl,
this->Quiet);
struct stat st;
if (::stat(local_file.c_str(), &st)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Cannot find file: " << local_file.c_str() << std::endl);
" Cannot find file: " << local_file << std::endl);
return false;
}
......@@ -927,15 +926,15 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
// make sure the file is not too big.
if (static_cast<off_t>(static_cast<size_t>(st.st_size)) !=
static_cast<off_t>(st.st_size)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" File too big: " << local_file.c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, " File too big: " << local_file
<< std::endl);
return false;
}
size_t fileSize = static_cast<size_t>(st.st_size);
FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
if (!fp) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Cannot open file: " << local_file.c_str() << std::endl);
" Cannot open file: " << local_file << std::endl);
return false;
}
......@@ -944,7 +943,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
delete[] fileBuffer;
fclose(fp);
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Cannot read file: " << local_file.c_str() << std::endl);
" Cannot read file: " << local_file << std::endl);
return false;
}
fclose(fp);
......
......@@ -1321,7 +1321,7 @@ std::string cmCTestTestHandler::FindExecutable(
<< "Looked in the following places:\n");
for (std::vector<std::string>::iterator i = failed.begin();
i != failed.end(); ++i) {
cmCTestLog(ctest, HANDLER_OUTPUT, i->c_str() << "\n");
cmCTestLog(ctest, HANDLER_OUTPUT, *i << "\n");
}
}
......
......@@ -1245,16 +1245,16 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
if (output) {
*output += outerr;
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl
<< std::flush);
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl
<< std::flush);
} else if (result == cmsysProcess_State_Error) {
std::string outerr = "\n*** ERROR executing: ";
outerr += cmsysProcess_GetErrorString(cp);
if (output) {
*output += outerr;
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl
<< std::flush);
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl
<< std::flush);
}
cmsysProcess_Delete(cp);
......
......@@ -105,8 +105,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
std::ostringstream oss;
oss << std::endl;
oss << "Invoke(ExecuteCommand)" << std::endl;
oss << " Macro: " << macro.c_str() << std::endl;
oss << " Args: " << args.c_str() << std::endl;
oss << " Macro: " << macro << std::endl;
oss << " Args: " << args << std::endl;
if (DISP_E_EXCEPTION == hr) {
oss << "DISP_E_EXCEPTION EXCEPINFO:" << excep.wCode << std::endl;
......
......@@ -343,16 +343,16 @@ void cmDependsC::WriteCacheFile() const
this->FileCache.begin();
fileIt != this->FileCache.end(); ++fileIt) {
if (fileIt->second->Used) {
cacheOut << fileIt->first.c_str() << std::endl;
cacheOut << fileIt->first << std::endl;
for (std::vector<UnscannedEntry>::const_iterator incIt =
fileIt->second->UnscannedEntries.begin();
incIt != fileIt->second->UnscannedEntries.end(); ++incIt) {
cacheOut << incIt->FileName.c_str() << std::endl;
cacheOut << incIt->FileName << std::endl;
if (incIt->QuotedLocation.empty()) {
cacheOut << "-" << std::endl;
} else {
cacheOut << incIt->QuotedLocation.c_str() << std::endl;
cacheOut << incIt->QuotedLocation << std::endl;
}
}
cacheOut << std::endl;
......
......@@ -213,7 +213,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
// only put relative paths
if (!tmp.empty() && tmp[0] != '/') {
fout << tmp.c_str() << "\n";
fout << tmp << "\n";
}
}
return true;
......
......@@ -1544,7 +1544,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
std::string echo_cmd = "echo ";
echo_cmd += (this->CurrentLocalGenerator->EscapeForShell(
comment, ccg.GetCC().GetEscapeAllowMakeVars()));
makefileStream << "\t" << echo_cmd.c_str() << "\n";
makefileStream << "\t" << echo_cmd << "\n";
}
// Add each command line to the set of commands.
......@@ -1562,7 +1562,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
}
cmd += cmd2;
ccg.AppendArguments(c, cmd);
makefileStream << "\t" << cmd.c_str() << "\n";
makefileStream << "\t" << cmd << "\n";
}
}
}
......
......@@ -427,7 +427,7 @@ int cmGraphVizWriter::CollectAllTargets()
// Skip ignored targets
continue;
}
// std::cout << "Found target: " << tit->first.c_str() << std::endl;
// std::cout << "Found target: " << tit->first << std::endl;
std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[realTargetName] = ostr.str();
......@@ -469,7 +469,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[libName] = ostr.str();
this->TargetPtrs[libName] = NULL;
// str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
// str << " \"" << ostr << "\" [ label=\"" << libName
// << "\" shape=\"ellipse\"];" << std::endl;
}
}
......
......@@ -1688,12 +1688,12 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
ppLang);
}
if (!fc.AdditionalDeps.empty()) {
fout << "\t\t\t\t\tAdditionalDependencies=\""
<< fc.AdditionalDeps.c_str() << "\"\n";
fout << "\t\t\t\t\tAdditionalDependencies=\"" << fc.AdditionalDeps
<< "\"\n";
}
if (!fc.ObjectName.empty()) {
fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/"
<< fc.ObjectName.c_str() << "\"\n";
fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" << fc.ObjectName
<< "\"\n";
}
fout << "\t\t\t\t\t/>\n"
<< "\t\t\t\t</FileConfiguration>\n";
......
......@@ -3416,7 +3416,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
while (cmSystemTools::GetLineFromStream(fin, inLine)) {
outLine = "";
this->ConfigureString(inLine, outLine, atOnly, escapeQuotes);
fout << outLine.c_str() << newLineCharacters;
fout << outLine << newLineCharacters;
}
// close the files before attempting to copy
fin.close();
......
......@@ -31,8 +31,7 @@ int main()
kwsys::DynamicLoader::LibraryHandle handle =
kwsys::DynamicLoader::OpenLibrary(libName.c_str());
if (!handle) {
std::cerr << "Could not open plugin \"" << libName.c_str() << "\"!"
<< std::endl;
std::cerr << "Could not open plugin \"" << libName << "\"!" << std::endl;
return 1;
}
kwsys::DynamicLoader::SymbolPointer sym =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment