From af8a1643c1a42aa3b276a50bca10a4faab176764 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 13:35:32 +0100 Subject: [PATCH] Remove c_str calls when using stream APIs. Use an ad-hoc clang tool for matching the calls which should be ported. --- Source/CPack/cmCPackDebGenerator.cxx | 16 ++-- Source/CPack/cmCPackGenerator.cxx | 32 +++---- Source/CPack/cmCPackLog.cxx | 12 +-- Source/CPack/cmCPackNSISGenerator.cxx | 42 ++++----- Source/CPack/cmCPackSTGZGenerator.cxx | 4 +- Source/CPack/cpack.cxx | 10 +-- Source/CTest/cmCTestBuildCommand.cxx | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 2 +- Source/CTest/cmCTestConfigureHandler.cxx | 4 +- Source/CTest/cmCTestCoverageHandler.cxx | 88 +++++++++---------- .../cmCTestEmptyBinaryDirectoryCommand.cxx | 2 +- Source/CTest/cmCTestGenericHandler.cxx | 4 +- Source/CTest/cmCTestMemCheckHandler.cxx | 16 ++-- Source/CTest/cmCTestMultiProcessHandler.cxx | 2 +- Source/CTest/cmCTestRunTest.cxx | 28 +++--- Source/CTest/cmCTestScriptHandler.cxx | 20 ++--- Source/CTest/cmCTestSubmitHandler.cxx | 46 +++++----- Source/CTest/cmCTestTestHandler.cxx | 14 +-- Source/CTest/cmCTestUpdateHandler.cxx | 2 +- Source/CTest/cmCTestUploadHandler.cxx | 2 +- Source/cmAddCustomCommandCommand.cxx | 2 +- Source/cmCMakeMinimumRequired.cxx | 4 +- Source/cmCTest.cxx | 48 +++++----- Source/cmCacheManager.cxx | 4 +- Source/cmCommandArgumentParserHelper.cxx | 2 +- Source/cmCoreTryCompile.cxx | 6 +- Source/cmDependsC.cxx | 2 +- Source/cmDependsFortran.cxx | 12 +-- Source/cmDependsJavaParserHelper.cxx | 8 +- Source/cmDocumentation.cxx | 12 +-- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraCodeLiteGenerator.cxx | 4 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalKdevelopGenerator.cxx | 22 ++--- Source/cmGlobalUnixMakefileGenerator3.cxx | 14 +-- Source/cmGraphVizWriter.cxx | 6 +- Source/cmInstallGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 6 +- Source/cmLocalUnixMakefileGenerator3.cxx | 8 +- Source/cmMakefile.cxx | 16 ++-- Source/cmMakefileTargetGenerator.cxx | 6 +- Source/cmSourceGroupCommand.cxx | 2 +- Source/cmUseMangledMesaCommand.cxx | 4 +- Source/cmVariableWatchCommand.cxx | 4 +- Source/cmake.cxx | 14 +-- Source/cmcmd.cxx | 26 +++--- 49 files changed, 297 insertions(+), 297 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 9ae58395f..27e9d9fde 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 cf514aa0d..9cdf5aad9 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 4e8bf0f4e..7befca0e1 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 f43383465..011369803 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 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 8342fee2c..6c1d20189 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 d1a16f0c4..7ebfedaf0 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; } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index de42e2bba..f81083af6 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -134,7 +134,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" - << buildCommand.c_str() << "\n"); + << buildCommand << "\n"); this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str()); } else diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 291c70a6f..7922c9ad7 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -409,7 +409,7 @@ int cmCTestBuildHandler::ProcessHandler() for ( it = strings.begin(); it != strings.end(); ++it ) \ { \ cmCTestLog(this->CTest, DEBUG, "Add " #strings ": " \ - << it->c_str() << std::endl); \ + << *it << std::endl); \ regexes.push_back(it->c_str()); \ } cmCTestBuildHandlerPopulateRegexVector( diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 7c4129864..a6e39a490 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -76,7 +76,7 @@ int cmCTestConfigureHandler::ProcessHandler() cmGeneratedFileStream ofs; this->StartLogFile("Configure", ofs); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: " - << cCommand.c_str() << std::endl); + << cCommand << std::endl); res = this->CTest->RunMakeCommand(cCommand.c_str(), &output, &retVal, buildDirectory.c_str(), 0, ofs); @@ -99,7 +99,7 @@ int cmCTestConfigureHandler::ProcessHandler() { os << retVal; } - os << "" << cCommand.c_str() << "" + os << "" << cCommand << "" << std::endl; cmCTestLog(this->CTest, DEBUG, "End" << std::endl); os << "" << cmXMLSafe(output) << "" << std::endl; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2c21a1319..f0b11241f 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -269,7 +269,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if ( ndc.size() ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str() + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of " << file << std::endl); return false; } @@ -308,7 +308,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if ( ndc.size() ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str() + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of: " << file << std::endl); return false; } @@ -477,7 +477,7 @@ int cmCTestCoverageHandler::ProcessHandler() { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: " - << fullFileName.c_str() + << fullFileName << std::endl); continue; } @@ -488,7 +488,7 @@ int cmCTestCoverageHandler::ProcessHandler() if ( !cmSystemTools::FileExists(fullFileName.c_str()) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: " - << fullFileName.c_str() << std::endl); + << fullFileName << std::endl); continue; } @@ -516,7 +516,7 @@ int cmCTestCoverageHandler::ProcessHandler() if ( !ifs) { cmOStringStream ostr; - ostr << "Cannot open source file: " << fullFileName.c_str(); + ostr << "Cannot open source file: " << fullFileName; errorsWhileAccumulating.push_back(ostr.str()); error ++; continue; @@ -535,7 +535,7 @@ int cmCTestCoverageHandler::ProcessHandler() cc != fcov.size() -1 ) { cmOStringStream ostr; - ostr << "Problem reading source file: " << fullFileName.c_str() + ostr << "Problem reading source file: " << fullFileName << " line:" << cc << " out total: " << fcov.size()-1; errorsWhileAccumulating.push_back(ostr.str()); error ++; @@ -605,7 +605,7 @@ int cmCTestCoverageHandler::ProcessHandler() if (!ifs) { cmOStringStream ostr; - ostr << "Cannot open source file: " << fullPath.c_str(); + ostr << "Cannot open source file: " << fullPath; errorsWhileAccumulating.push_back(ostr.str()); error ++; continue; @@ -613,7 +613,7 @@ int cmCTestCoverageHandler::ProcessHandler() int untested = 0; std::string line; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << i->c_str() << std::endl); + "Actually performing coverage for: " << *i << std::endl); while (cmSystemTools::GetLineFromStream(ifs, line)) { covLogFile << "\t\t" @@ -647,7 +647,7 @@ int cmCTestCoverageHandler::ProcessHandler() ++ erIt ) { cmCTestLog(this->CTest, ERROR_MESSAGE, - " " << erIt->c_str() << std::endl); + " " << *erIt << std::endl); } } @@ -719,13 +719,13 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) ++ it ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " - << it->c_str() << std::endl); + << *it << std::endl); } for ( it = this->ExtraCoverageGlobs.begin(); it != this->ExtraCoverageGlobs.end(); ++it) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: " - << it->c_str() << std::endl); + << *it << std::endl); } } @@ -959,17 +959,17 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string output = ""; std::string errors = ""; int retVal = 0; - *cont->OFS << "* Run coverage for: " << fileDir.c_str() << std::endl; - *cont->OFS << " Command: " << command.c_str() << std::endl; + *cont->OFS << "* Run coverage for: " << fileDir << std::endl; + *cont->OFS << " Command: " << command << std::endl; int res = this->CTest->RunCommand(command.c_str(), &output, &errors, &retVal, tempDir.c_str(), 0 /*this->TimeOut*/); - *cont->OFS << " Output: " << output.c_str() << std::endl; - *cont->OFS << " Errors: " << errors.c_str() << std::endl; + *cont->OFS << " Output: " << output << std::endl; + *cont->OFS << " Errors: " << errors << std::endl; if ( ! res ) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Problem running coverage on file: " << it->c_str() << std::endl); + "Problem running coverage on file: " << *it << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << errors << std::endl); cont->Error ++; @@ -978,7 +978,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if ( retVal != 0 ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Coverage command returned: " - << retVal << " while processing: " << it->c_str() << std::endl); + << retVal << " while processing: " << *it << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } @@ -999,7 +999,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string sourceFile; std::string gcovFile; - cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]" + cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]" << std::endl); if ( line->size() == 0 ) @@ -1145,7 +1145,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( !cmSystemTools::StringStartsWith(line->c_str(), "Removing ")) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Unknown gcov output line: [" << line->c_str() << "]" + "Unknown gcov output line: [" << *line << "]" << std::endl); cont->Error ++; //abort(); @@ -1238,8 +1238,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if ( IsFileInDir(sourceFile, cont->SourceDir) ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " - << sourceFile.c_str() << std::endl); - *cont->OFS << " produced in source dir: " << sourceFile.c_str() + << sourceFile << std::endl); + *cont->OFS << " produced in source dir: " << sourceFile << std::endl; actualSourceFile = cmSystemTools::CollapseFullPath(sourceFile.c_str()); @@ -1247,8 +1247,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( else if ( IsFileInDir(sourceFile, cont->BinaryDir) ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: " - << sourceFile.c_str() << std::endl); - *cont->OFS << " produced in binary dir: " << sourceFile.c_str() + << sourceFile << std::endl); + *cont->OFS << " produced in binary dir: " << sourceFile << std::endl; actualSourceFile = cmSystemTools::CollapseFullPath(sourceFile.c_str()); @@ -1262,19 +1262,19 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "Something went wrong" << std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Cannot find file: [" - << sourceFile.c_str() << "]" << std::endl); + << sourceFile << "]" << std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in source dir: [" - << cont->SourceDir.c_str() << "]" + << cont->SourceDir << "]" << std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " or binary dir: [" << cont->BinaryDir.size() << "]" << std::endl); *cont->OFS << " Something went wrong. Cannot find file: " - << sourceFile.c_str() - << " in source dir: " << cont->SourceDir.c_str() - << " or binary dir: " << cont->BinaryDir.c_str() << std::endl; + << sourceFile + << " in source dir: " << cont->SourceDir + << " or binary dir: " << cont->BinaryDir << std::endl; missingFiles.insert(sourceFile); } @@ -1364,24 +1364,24 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find source Python file corresponding to: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); continue; } std::string actualSourceFile = cmSystemTools::CollapseFullPath(fileName.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Check coverage for file: " << actualSourceFile.c_str() + " Check coverage for file: " << actualSourceFile << std::endl); cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec = &cont->TotalCoverage[actualSourceFile]; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " in file: " << fileIt->c_str() << std::endl); + " in file: " << *fileIt << std::endl); cmsys::ifstream ifile(fileIt->c_str()); if ( ! ifile ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); } else { @@ -1429,7 +1429,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( // So, this will be set to 0. cov = 0; } - cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix.c_str() + cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix << " cov: " << cov << std::endl); // Read the line number starting at the 10th character of the gcov @@ -1542,7 +1542,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open coverage file: " << - outputFile.c_str() << std::endl); + outputFile << std::endl); return 0; } std::map fileMap; @@ -1602,7 +1602,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( count++; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Produce coverage for file: " - << file.c_str() << " " << count + << file << " " << count << std::endl); // start the file output covLogFile << "\tCTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program.c_str() << " " << arg << "\n"); + "Run : " << program << " " << arg << "\n"); } else { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program.c_str() << "\n"); + "Run : " << program << "\n"); } // create a process object and start it cmCTestRunProcess runCoverageSrc; @@ -1686,7 +1686,7 @@ int cmCTestCoverageHandler::RunBullseyeCommand( if(!runCoverageSrc.StartProcess()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Could not run : " - << program.c_str() << " " << arg << "\n" + << program << " " << arg << "\n" << "kwsys process state : " << runCoverageSrc.GetProcessState()); return 0; @@ -1755,7 +1755,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open coverage summary file: " << - outputFile.c_str() << std::endl); + outputFile << std::endl); return 0; } std::set coveredFileNames; @@ -1796,14 +1796,14 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: " - << file.c_str() + << file << std::endl); continue; } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Doing coverage for: " - << file.c_str() + << file << std::endl); coveredFiles.push_back(sourceFile); @@ -1830,7 +1830,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( cmet /= 2.0f; } cmet /= 100.0f; - tmpLog << stdline.c_str() << "\n"; + tmpLog << stdline << "\n"; tmpLog << fileName << "\n"; tmpLog << "functionsCalled: " << functionsCalled/100 << "\n"; tmpLog << "totalFunctions: " << totalFunctions/100 << "\n"; @@ -1957,7 +1957,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( if(pos == inputLine.npos) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing string : " - << inputLine.c_str() << "\n"); + << inputLine << "\n"); return false; } // the source file has "" around it so extract out the file name @@ -1991,7 +1991,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( if(pos != inputLine.npos) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : " - << inputLine.c_str() << " last pos not npos = " << pos << + << inputLine << " last pos not npos = " << pos << "\n"); } return true; diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index a470b3bba..5ddef01a7 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -25,7 +25,7 @@ bool cmCTestEmptyBinaryDirectoryCommand if ( !cmCTestScriptHandler::EmptyBinaryDirectory(args[0].c_str()) ) { cmOStringStream ostr; - ostr << "problem removing the binary directory: " << args[0].c_str(); + ostr << "problem removing the binary directory: " << args[0]; this->SetError(ostr.str()); return false; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 08cfaeca6..2df2229e7 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -124,7 +124,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, ostr.str(), xofs, true) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Cannot create resulting XML file: " << ostr.str().c_str() + "Cannot create resulting XML file: " << ostr.str() << std::endl); return false; } @@ -156,7 +156,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, if( !this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: " - << ostr.str().c_str() << std::endl); + << ostr.str() << std::endl); return false; } return true; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index f27dbc098..ecaa474db 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -514,7 +514,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find memory checker suppression file: " << this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str() << std::endl); + "MemoryCheckSuppressionFile") << std::endl); return false; } std::string suppressions = "--suppressions=" @@ -569,7 +569,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } default: cmCTestLog(this->CTest, ERROR_MESSAGE, - "Do not understand memory checker: " << this->MemoryTester.c_str() + "Do not understand memory checker: " << this->MemoryTester << std::endl); return false; } @@ -885,7 +885,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( else if(!parser.ParseChunk(theLine.c_str(), theLine.size())) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Error in ParseChunk: " << theLine.c_str() + "Error in ParseChunk: " << theLine << std::endl); } } @@ -916,7 +916,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " - << res.Name.c_str() << std::endl); + << res.Name << std::endl); std::string ofile = testOutputFileName(test); if ( ofile.empty() ) { @@ -943,10 +943,10 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmSystemTools::Delay(1000); cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerDPBDFile.c_str() << std::endl); + << this->BoundsCheckerDPBDFile << std::endl); cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerXMLFile.c_str() << std::endl); + << this->BoundsCheckerXMLFile << std::endl); } void @@ -955,7 +955,7 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res, { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessPurifyTest for : " - << res.Name.c_str() << std::endl); + << res.Name << std::endl); appendMemTesterOutput(res, test); } @@ -965,7 +965,7 @@ cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res, { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessValgrindTest for : " - << res.Name.c_str() << std::endl); + << res.Name << std::endl); appendMemTesterOutput(res, test); } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index c979be3f3..b9e67211c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -672,7 +672,7 @@ void cmCTestMultiProcessHandler::PrintTestList() indexStr << " #" << p.Index << ":"; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) - << indexStr.str().c_str()); + << indexStr.str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); //pop working dir diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index cdf90b9af..385388d5d 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -334,9 +334,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "Test Failed.\n"; } } - *this->TestHandler->LogFile << "\"" << this->TestProperties->Name.c_str() + *this->TestHandler->LogFile << "\"" << this->TestProperties->Name << "\" end time: " << this->CTest->CurrentTime() << std::endl - << "\"" << this->TestProperties->Name.c_str() << "\" time elapsed: " + << "\"" << this->TestProperties->Name << "\" time elapsed: " << buffer << std::endl << "----------------------------------------------------------" << std::endl << std::endl; @@ -388,8 +388,8 @@ void cmCTestRunTest::MemCheckPostProcess() } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": process test output now: " - << this->TestProperties->Name.c_str() << " " - << this->TestResult.Name.c_str() << std::endl); + << this->TestProperties->Name << " " + << this->TestResult.Name << std::endl); cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); switch ( handler->MemoryTesterStyle ) @@ -465,9 +465,9 @@ bool cmCTestRunTest::StartTest(size_t total) //Required file was not found this->TestProcess = new cmProcess; *this->TestHandler->LogFile << "Unable to find required file: " - << file.c_str() << std::endl; + << file << std::endl; cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find required file: " - << file.c_str() << std::endl); + << file << std::endl); this->TestResult.Output = "Unable to find required file: " + file; this->TestResult.FullCommandLine = ""; this->TestResult.CompletionStatus = "Not Run"; @@ -482,9 +482,9 @@ bool cmCTestRunTest::StartTest(size_t total) // that has that information this->TestProcess = new cmProcess; *this->TestHandler->LogFile << "Unable to find executable: " - << args[1].c_str() << std::endl; + << args[1] << std::endl; cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: " - << args[1].c_str() << std::endl); + << args[1] << std::endl); this->TestResult.Output = "Unable to find executable: " + args[1]; this->TestResult.FullCommandLine = ""; this->TestResult.CompletionStatus = "Not Run"; @@ -711,7 +711,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) indexStr << " #" << this->Index << ":"; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) - << indexStr.str().c_str()); + << indexStr.str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); std::string outname = this->TestProperties->Name + " "; @@ -722,18 +722,18 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << this->TestProperties->Name << std::endl; *this->TestHandler->LogFile << this->TestProperties->Index << "/" << this->TestHandler->TotalNumberOfTests - << " Test: " << this->TestProperties->Name.c_str() << std::endl; + << " Test: " << this->TestProperties->Name << std::endl; *this->TestHandler->LogFile << "Command: \"" << this->ActualCommand << "\""; for (std::vector::iterator i = this->Arguments.begin(); i != this->Arguments.end(); ++i) { *this->TestHandler->LogFile - << " \"" << i->c_str() << "\""; + << " \"" << *i << "\""; } *this->TestHandler->LogFile << std::endl << "Directory: " << this->TestProperties->Directory << std::endl - << "\"" << this->TestProperties->Name.c_str() << "\" start time: " + << "\"" << this->TestProperties->Name << "\" start time: " << this->StartTime << std::endl; *this->TestHandler->LogFile @@ -741,9 +741,9 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << "----------------------------------------------------------" << std::endl; *this->TestHandler->LogFile - << this->ProcessOutput.c_str() << "" << std::endl; + << this->ProcessOutput << "" << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str()); cmCTestLog(this->CTest, DEBUG, "Testing " - << this->TestProperties->Name.c_str() << " ... "); + << this->TestProperties->Name << " ... "); } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 4d419c251..567acfc95 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -426,7 +426,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" - << systemFile.c_str() << "\n"); + << systemFile << "\n"); return 2; } @@ -444,7 +444,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read script: " - << script.c_str() + << script << std::endl); // Reset the error flag so that it can run more than // one script with an error when you @@ -781,7 +781,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() output = ""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run Update: " - << fullCommand.c_str() << std::endl); + << fullCommand << std::endl); res = cmSystemTools::RunSingleCommand(fullCommand.c_str(), &output, &retVal, cvsArgs[0].c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -902,7 +902,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() command += "\""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run cmake command: " - << command.c_str() << std::endl); + << command << std::endl); res = cmSystemTools::RunSingleCommand(command.c_str(), &output, &retVal, this->BinaryDir.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -916,7 +916,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Write CMake output to file: " << cmakeOutputFile.c_str() + "Write CMake output to file: " << cmakeOutputFile << std::endl); cmGeneratedFileStream fout(cmakeOutputFile.c_str()); if ( fout ) @@ -927,7 +927,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open CMake output file: " - << cmakeOutputFile.c_str() << " for writing" << std::endl); + << cmakeOutputFile << " for writing" << std::endl); } } if (!res || retVal != 0) @@ -948,7 +948,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() output = ""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run ctest command: " - << command.c_str() << std::endl); + << command << std::endl); res = cmSystemTools::RunSingleCommand(command.c_str(), &output, &retVal, this->BinaryDir.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -962,13 +962,13 @@ int cmCTestScriptHandler::RunConfigurationDashboard() { cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to run cmake:" << std::endl - << cmakeFailedOuput.c_str() << std::endl); + << cmakeFailedOuput << std::endl); return 10; } cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to run ctest:" << std::endl - << "command: " << command.c_str() << std::endl - << "output: " << output.c_str() << std::endl); + << "command: " << command << std::endl + << "output: " << output << std::endl); if (!res) { return 11; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index bc3c33377..7c72cba2f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -229,18 +229,18 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, if ( ::stat(local_file.c_str(), &st) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); ::curl_easy_cleanup(curl); ::curl_global_cleanup(); return false; } ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); - *this->LogFile << "\tUpload file: " << local_file.c_str() << " to " - << upload_as.c_str() << std::endl; + *this->LogFile << "\tUpload file: " << local_file << " to " + << upload_as << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file.c_str() << " to " - << upload_as.c_str() << std::endl); + << local_file << " to " + << upload_as << std::endl); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); @@ -290,11 +290,11 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << " Error when uploading file: " - << local_file.c_str() + << local_file << std::endl << " Error message was: " << error_buffer << std::endl @@ -422,8 +422,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, std::string remote_file = remoteprefix + cmSystemTools::GetFilenameName(*file); - *this->LogFile << "\tUpload file: " << local_file.c_str() << " to " - << remote_file.c_str() << std::endl; + *this->LogFile << "\tUpload file: " << local_file << " to " + << remote_file << std::endl; std::string ofile = ""; for ( kk = 0; kk < remote_file.size(); kk ++ ) @@ -470,7 +470,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if ( ::stat(local_file.c_str(), &st) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); ::curl_easy_cleanup(curl); ::curl_global_cleanup(); return false; @@ -478,8 +478,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file.c_str() << " to " - << upload_as.c_str() << " Size: " << st.st_size << std::endl); + << local_file << " to " + << upload_as << " Size: " << st.st_size << std::endl); // specify target ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); @@ -595,11 +595,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << " Error when uploading file: " - << local_file.c_str() + << local_file << std::endl << " Error message was: " << error_buffer << std::endl; @@ -750,15 +750,15 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( std::string turl = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "xmlfile=" + ofile; - *this->LogFile << "Trigger url: " << turl.c_str() << std::endl; + *this->LogFile << "Trigger url: " << turl << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " - << turl.c_str() << std::endl); + << turl << std::endl); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); if ( curl_easy_perform(curl) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when triggering: " - << turl.c_str() << std::endl); + << turl << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << "\tTriggering failed with error: " << error_buffer @@ -932,8 +932,8 @@ bool cmCTestSubmitHandler::SubmitUsingCP( std::string rfname = destination + "/" + remoteprefix + *file; cmSystemTools::CopyFileAlways(lfname.c_str(), rfname.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " - << lfname.c_str() << " to " - << rfname.c_str() << std::endl); + << lfname << " to " + << rfname << std::endl); } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; cmSystemTools::Touch(tagDoneFile.c_str(), true); @@ -1183,7 +1183,7 @@ int cmCTestSubmitHandler::ProcessHandler() = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); std::string::size_type glen = gpath.size() + 1; gpath = gpath + "/CoverageLog*"; - cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath.c_str() + cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath << std::endl); if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) { @@ -1191,7 +1191,7 @@ int cmCTestSubmitHandler::ProcessHandler() for ( cc = 0; cc < gfiles.size(); cc ++ ) { gfiles[cc] = gfiles[cc].substr(glen); - cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc].c_str() + cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] << std::endl); this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str()); } @@ -1232,7 +1232,7 @@ int cmCTestSubmitHandler::ProcessHandler() cmCTest::SetOfStrings::iterator it; for ( it = files.begin(); it != files.end(); ++ it ) { - ofs << cnt << "\t" << it->c_str() << std::endl; + ofs << cnt << "\t" << *it << std::endl; cnt ++; } } @@ -1448,7 +1448,7 @@ int cmCTestSubmitHandler::ProcessHandler() oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(buildDirectory.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " - << buildDirectory.c_str() << std::endl); + << buildDirectory << std::endl); if ( !this->SubmitUsingCP( "Testing/"+this->CTest->GetCurrentTag(), diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index efeb658be..1d1dde4ad 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -616,7 +616,7 @@ int cmCTestTestHandler::ProcessHandler() ofs << ftit->TestCount << ":" << ftit->Name << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->TestCount << " - " - << ftit->Name.c_str() << " (" + << ftit->Name << " (" << this->GetTestStatus(ftit->Status) << ")" << std::endl); } @@ -1022,7 +1022,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, { cmCTestLog(this->CTest, ERROR_MESSAGE, "parse error: missing tag: " - << tag << " found [" << line.c_str() << "]" << std::endl); + << tag << " found [" << line << "]" << std::endl); ret = false; } return ret; @@ -1223,7 +1223,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) { os << "\t\t\tfirst.c_str() << "\">" + << "name=\"" << measureIt->first << "\">" << cmXMLSafe(measureIt->second) << "\n"; } @@ -1820,7 +1820,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() else if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem reading file: " - << lastTestsFailedLog.c_str() << + << lastTestsFailedLog << " while generating list of previously failed tests." << std::endl); } } @@ -1960,7 +1960,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages( << " " << k1 << "=\"" << v1 << "\"" << " " << k2 << "=\"" << v2 << "\"" << " encoding=\"none\"" - << ">Image " << filename.c_str() + << ">Image " << filename << " is empty"; } else @@ -2014,10 +2014,10 @@ std::string cmCTestTestHandler::GenerateRegressionImages( << "\t\t\tFile " << filename.c_str() + << ">File " << filename << " not found" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename.c_str() + cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename << "\" not found." << std::endl); } cxml.erase(measurementfile.start(), diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 11474ecb9..fda61ea49 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -331,7 +331,7 @@ int cmCTestUpdateHandler::DetectVCS(const char* dir) { std::string sourceDirectory = dir; cmCTestLog(this->CTest, DEBUG, "Check directory: " - << sourceDirectory.c_str() << std::endl); + << sourceDirectory << std::endl); sourceDirectory += "/.svn"; if ( cmSystemTools::FileExists(sourceDirectory.c_str()) ) { diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index caf2e5370..4c3f81b11 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -64,7 +64,7 @@ int cmCTestUploadHandler::ProcessHandler() for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) { cmCTestLog(this->CTest, OUTPUT, - "\tUpload file: " << it->c_str() << std::endl); + "\tUpload file: " << *it << std::endl); ofs << "\n" << "\n"; ofs << this->CTest->Base64EncodeFile(*it); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index c3a9a16d4..d5f00ff12 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -286,7 +286,7 @@ bool cmAddCustomCommandCommand // No command for this output exists. cmOStringStream e; - e << "given APPEND option with output \"" << output[0].c_str() + e << "given APPEND option with output \"" << output[0] << "\" which is not already a custom command output."; this->SetError(e.str()); return false; diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index ba3a83245..58b61deef 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -79,7 +79,7 @@ bool cmCMakeMinimumRequired &required_patch, &required_tweak) < 2) { cmOStringStream e; - e << "could not parse VERSION \"" << version_string.c_str() << "\"."; + e << "could not parse VERSION \"" << version_string << "\"."; this->SetError(e.str()); return false; } @@ -98,7 +98,7 @@ bool cmCMakeMinimumRequired { // The current version is too low. cmOStringStream e; - e << "CMake " << version_string.c_str() + e << "CMake " << version_string << " or higher is required. You are running version " << cmVersion::GetCMakeVersion(); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 678b497f4..9f711b73b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -78,7 +78,7 @@ struct tm* cmCTest::GetNightlyTime(std::string str, lctime->tm_mday, str.c_str()); cmCTestLog(this, OUTPUT, "Determine Nightly Start Time" << std::endl - << " Specified time: " << str.c_str() << std::endl); + << " Specified time: " << str << std::endl); //Convert the nightly start time to seconds. Since we are //providing only a time and a timezone, the current date of //the local machine is assumed. Consequently, nightlySeconds @@ -681,7 +681,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) if ( !fname.empty() ) { cmCTestLog(this, OUTPUT, " Reading ctest configuration file: " - << fname.c_str() << std::endl); + << fname << std::endl); bool readit = mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str() ); if(!readit) @@ -696,10 +696,10 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { cmCTestLog(this, WARNING, "Cannot locate CTest configuration: in BuildDirectory: " - << bld_dir_fname.c_str() << std::endl); + << bld_dir_fname << std::endl); cmCTestLog(this, WARNING, "Cannot locate CTest configuration: in SourceDirectory: " - << src_dir_fname.c_str() << std::endl); + << src_dir_fname << std::endl); } this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime", @@ -748,13 +748,13 @@ bool cmCTest::UpdateCTestConfiguration() } } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "UpdateCTestConfiguration from :" - << fileName.c_str() << "\n"); + << fileName << "\n"); if ( !cmSystemTools::FileExists(fileName.c_str()) ) { // No need to exit if we are not producing XML if ( this->ProduceXML ) { - cmCTestLog(this, ERROR_MESSAGE, "Cannot find file: " << fileName.c_str() + cmCTestLog(this, ERROR_MESSAGE, "Cannot find file: " << fileName << std::endl); return false; } @@ -762,7 +762,7 @@ bool cmCTest::UpdateCTestConfiguration() else { cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Parse Config file:" - << fileName.c_str() << "\n"); + << fileName << "\n"); // parse the dart test file cmsys::ifstream fin(fileName.c_str()); @@ -1346,7 +1346,7 @@ int cmCTest::RunTest(std::vector argv, *output += oss.str(); if ( log ) { - *log << output->c_str(); + *log << *output; } cmSystemTools::ChangeDirectory(oldpath.c_str()); @@ -1562,7 +1562,7 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) for(std::vector::iterator i = args.begin(); i != args.end(); ++i) { - ostr << " \n"; + ostr << " \n"; } ostr << " \n"; } @@ -1606,7 +1606,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, for ( it = files.begin(); it != files.end(); it ++ ) { - cmCTestLog(this, OUTPUT, "\tAdd file: " << it->c_str() << std::endl); + cmCTestLog(this, OUTPUT, "\tAdd file: " << *it << std::endl); std::string note_time = this->CurrentTime(); os << "\n" << "\n" @@ -1624,8 +1624,8 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, } else { - os << "Problem reading file: " << it->c_str() << std::endl; - cmCTestLog(this, ERROR_MESSAGE, "Problem reading file: " << it->c_str() + os << "Problem reading file: " << *it << std::endl; + cmCTestLog(this, ERROR_MESSAGE, "Problem reading file: " << *it << " while creating notes" << std::endl); } os << "\n" @@ -1732,7 +1732,7 @@ bool cmCTest::SubmitExtraFiles(const VectorOfStrings &files) if ( !cmSystemTools::FileExists(it->c_str()) ) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " - << it->c_str() << " to submit." + << *it << " to submit." << std::endl;); return false; } @@ -2319,7 +2319,7 @@ int cmCTest::Run(std::vector &args, std::string* output) executeTests = false; cmCTestLog(this, ERROR_MESSAGE, "CTest -T called with incorrect option: " - << args[i].c_str() << std::endl); + << args[i] << std::endl); cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl << " " << ctestExec << " -T all" << std::endl << " " << ctestExec << " -T start" << std::endl @@ -2356,7 +2356,7 @@ int cmCTest::Run(std::vector &args, std::string* output) { executeTests = false; cmCTestLog(this, ERROR_MESSAGE, - "CTest -M called with incorrect option: " << str.c_str() + "CTest -M called with incorrect option: " << str << std::endl); cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl << " " << ctestExec << " -M Continuous" << std::endl @@ -2527,11 +2527,11 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) std::string fname = dir; fname += "/CTestCustom.cmake"; cmCTestLog(this, DEBUG, "* Check for file: " - << fname.c_str() << std::endl); + << fname << std::endl); if ( cmSystemTools::FileExists(fname.c_str()) ) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " - << fname.c_str() << std::endl); + << fname << std::endl); bool erroroc = cmSystemTools::GetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag(); @@ -2540,7 +2540,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " - << fname.c_str() << std::endl); + << fname << std::endl); } found = true; if ( erroroc ) @@ -2552,7 +2552,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) std::string rexpr = dir; rexpr += "/CTestCustom.ctest"; cmCTestLog(this, DEBUG, "* Check for file: " - << rexpr.c_str() << std::endl); + << rexpr << std::endl); if ( !found && cmSystemTools::FileExists(rexpr.c_str()) ) { cmsys::Glob gl; @@ -2564,13 +2564,13 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) ++ fileIt ) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); if ( !mf->ReadListFile(0, fileIt->c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); } } found = true; @@ -2584,7 +2584,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration vectors for handler: " - << it->first.c_str() << " (" << it->second << ")" << std::endl); + << it->first << " (" << it->second << ")" << std::endl); it->second->PopulateCustomVectors(mf); } } @@ -2610,7 +2610,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, for ( it = slist.begin(); it != slist.end(); ++it ) { - cmCTestLog(this, DEBUG, " -- " << it->c_str() << std::endl); + cmCTestLog(this, DEBUG, " -- " << *it << std::endl); vec.push_back(*it); } } @@ -2849,7 +2849,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) "CTest configuration overwrite specified in the wrong format." << std::endl << "Valid format is: --overwrite key=value" << std::endl - << "The specified was: --overwrite " << overStr.c_str() << std::endl); + << "The specified was: --overwrite " << overStr << std::endl); return; } std::string key = overStr.substr(0, epos); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 159f9c307..8f352b112 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -644,7 +644,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout, fout << "\\n"; } oneLine = helpString.substr(pos, i - pos); - fout << oneLine.c_str() << "\n"; + fout << oneLine << "\n"; pos = i; } } @@ -698,7 +698,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const { if((*i).second.Type != INTERNAL) { - out << (*i).first.c_str() << " = " << (*i).second.Value.c_str() + out << (*i).first << " = " << (*i).second.Value << std::endl; } } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index c9490ca53..a7f6b494c 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -293,7 +293,7 @@ int cmCommandArgumentParserHelper::ParseString(const char* str, int verb) if ( Verbose ) { std::cerr << "Expanding [" << str << "] produced: [" - << this->Result.c_str() << "]" << std::endl; + << this->Result << "]" << std::endl; } return 1; } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 3987283bc..a3f327775 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -284,7 +284,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { cmOStringStream e; e << "Failed to open\n" - << " " << outFileName.c_str() << "\n" + << " " << outFileName << "\n" << cmSystemTools::GetLastSystemError(); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return -1; @@ -519,9 +519,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { cmOStringStream emsg; emsg << "Cannot copy output executable\n" - << " '" << this->OutputFile.c_str() << "'\n" + << " '" << this->OutputFile << "'\n" << "to destination specified by COPY_FILE:\n" - << " '" << copyFile.c_str() << "'\n"; + << " '" << copyFile << "'\n"; if(!this->FindErrorMessage.empty()) { emsg << this->FindErrorMessage.c_str(); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 56ef6e2f3..d26d3a90f 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -278,7 +278,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; - internalDepends << " " << i->c_str() << std::endl; + internalDepends << " " << *i << std::endl; } makeDepends << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1d91b4aa8..79cb560b6 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -453,7 +453,7 @@ cmDependsFortran cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; - internalDepends << " " << i->c_str() << std::endl; + internalDepends << " " << *i << std::endl; } makeDepends << std::endl; @@ -666,7 +666,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) if(!cmSystemTools::CopyFileAlways(mod_upper.c_str(), stamp.c_str())) { std::cerr << "Error copying Fortran module from \"" - << mod_upper.c_str() << "\" to \"" << stamp.c_str() + << mod_upper << "\" to \"" << stamp << "\".\n"; return false; } @@ -681,7 +681,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) if(!cmSystemTools::CopyFileAlways(mod_lower.c_str(), stamp.c_str())) { std::cerr << "Error copying Fortran module from \"" - << mod_lower.c_str() << "\" to \"" << stamp.c_str() + << mod_lower << "\" to \"" << stamp << "\".\n"; return false; } @@ -689,9 +689,9 @@ bool cmDependsFortran::CopyModule(const std::vector& args) return true; } - std::cerr << "Error copying Fortran module \"" << args[2].c_str() - << "\". Tried \"" << mod_upper.c_str() - << "\" and \"" << mod_lower.c_str() << "\".\n"; + std::cerr << "Error copying Fortran module \"" << args[2] + << "\". Tried \"" << mod_upper + << "\" and \"" << mod_lower << "\".\n"; return false; } diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index e23e4b7ff..02f2d21d6 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -262,7 +262,7 @@ void cmDependsJavaParserHelper::PrintClasses() sit != files.end(); ++ sit ) { - std::cout << " " << sit->c_str() << ".class" << std::endl; + std::cout << " " << *sit << ".class" << std::endl; } } @@ -308,7 +308,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) if ( this->CurrentPackage.size() > 0 ) { std::cout << "Current package is: " << - this->CurrentPackage.c_str() << std::endl; + this->CurrentPackage << std::endl; } std::cout << "Imports packages:"; if ( this->PackagesImport.size() > 0 ) @@ -318,7 +318,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) it != this->PackagesImport.end(); ++ it ) { - std::cout << " " << it->c_str(); + std::cout << " " << *it; } } std::cout << std::endl; @@ -330,7 +330,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) it != this->ClassesFound.end(); ++ it ) { - std::cout << " " << it->c_str(); + std::cout << " " << *it; } } std::cout << std::endl; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index a4bc83d1f..d421889e7 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -693,7 +693,7 @@ bool cmDocumentation::PrintHelpOneManual(std::ostream& os) return true; } // Argument was not a manual. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-manual is not an available manual. " << "Use --help-manual-list to see all available manuals.\n"; return false; @@ -715,7 +715,7 @@ bool cmDocumentation::PrintHelpOneCommand(std::ostream& os) return true; } // Argument was not a command. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-command is not a CMake command. " << "Use --help-command-list to see all commands.\n"; return false; @@ -737,7 +737,7 @@ bool cmDocumentation::PrintHelpOneModule(std::ostream& os) return true; } // Argument was not a module. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-module is not a CMake module.\n"; return false; } @@ -772,7 +772,7 @@ bool cmDocumentation::PrintHelpOneProperty(std::ostream& os) return true; } // Argument was not a property. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-property is not a CMake property. " << "Use --help-property-list to see all properties.\n"; return false; @@ -796,7 +796,7 @@ bool cmDocumentation::PrintHelpOnePolicy(std::ostream& os) } // Argument was not a policy. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-policy is not a CMake policy.\n"; return false; } @@ -817,7 +817,7 @@ bool cmDocumentation::PrintHelpOneVariable(std::ostream& os) return true; } // Argument was not a variable. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-variable is not a defined variable. " << "Use --help-variable-list to see all defined variables.\n"; return false; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 3dc1f6cea..a83a228b7 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -271,7 +271,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig( { std::string se = cmSystemTools::GetLastSystemError(); cmOStringStream e; - e << "cannot write to file \"" << fileName.c_str() + e << "cannot write to file \"" << fileName << "\": " << se; cmSystemTools::Error(e.str().c_str()); return false; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index edb9c38c0..dba240651 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -499,7 +499,7 @@ void cmExtraCodeBlocksGenerator sit!=otherFiles.end(); ++sit) { - fout<<" c_str() <<"\">\n" + fout<<" \n" " \n"; } @@ -653,7 +653,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, dirIt != uniqIncludeDirs.end(); ++dirIt) { - fout <<" c_str() << "\" />\n"; + fout <<" \n"; } fout<<" \n"; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index da397b191..1cbd0577a 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -311,7 +311,7 @@ void cmExtraCodeLiteGenerator { std::string relativePath = cmSystemTools::RelativePath(projectPath.c_str(), sit->first.c_str()); - fout<< " \n"; + fout<< " \n"; } fout<< " \n"; fout<< " \n"; @@ -322,7 +322,7 @@ void cmExtraCodeLiteGenerator { std::string relativePath = cmSystemTools::RelativePath(projectPath.c_str(), sit->c_str()); - fout << " \n"; + fout << " \n"; } fout << " \n"; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index d02e54df6..fcb95a0ed 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1292,7 +1292,7 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout, std::string pathXml = cmExtraEclipseCDT4Generator::EscapeForXML(path); fout << "\n" "" << cmExtraEclipseCDT4Generator::GetEclipsePath(make) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 1d4e30c1e..a790e0040 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -268,7 +268,7 @@ bool cmFindPackageCommand else { cmOStringStream e; - e << "called with invalid argument \"" << args[i].c_str() << "\""; + e << "called with invalid argument \"" << args[i] << "\""; this->SetError(e.str()); return false; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b67da5bd6..b95ff81ae 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2318,7 +2318,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) it != componentsSet->end(); ++ it ) { - ostr << " \"" << it->c_str() << "\""; + ostr << " \"" << *it << "\""; } } else diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 2e856ba8e..df3ce108d 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -360,7 +360,7 @@ void cmGlobalKdevelopGenerator if (strstr(line, "")) { fout<< " KDevCustomProject\n"; - fout<< " " <" <\n"; //this one is important fout<<" true\n"; //and this one @@ -368,14 +368,14 @@ void cmGlobalKdevelopGenerator // inside kdevcustomproject the must be put if (strstr(line, "")) { - fout<<" "<"<\n"; } // buildtool and builddir go inside if (strstr(line, "")) { fout<<" make\n"; - fout<<" "<\n"; + fout<<" "<\n"; } } } @@ -417,7 +417,7 @@ void cmGlobalKdevelopGenerator " KDevCustomProject\n" " " << primaryLanguage << "\n" " \n" - " " << projectDir.c_str() << + " " << projectDir << "\n"; //this one is important fout<<" true\n"; //and this one @@ -444,12 +444,12 @@ void cmGlobalKdevelopGenerator fout<<" \n" " \n" - " " << outputDir.c_str() << + " " << outputDir << "\n" " \n" - " " << executable.c_str() << "\n" + " " << executable << "\n" " custom\n" - " "<\n" + " "<\n" " \n" " false\n" " true\n" @@ -457,7 +457,7 @@ void cmGlobalKdevelopGenerator " \n" " \n" " make\n"; //this one is important - fout<<" "<\n"; //and this one + fout<<" "<\n"; //and this one fout<<" \n" " \n" " false\n" @@ -480,7 +480,7 @@ void cmGlobalKdevelopGenerator dirIt != this->Blacklist.end(); ++dirIt) { - fout<<" " << dirIt->c_str() << "\n"; + fout<<" " << *dirIt << "\n"; } fout<<" \n"; @@ -558,7 +558,7 @@ void cmGlobalKdevelopGenerator // command fout<<" \n" " \n" - " \n"; if (enableCxx) @@ -601,7 +601,7 @@ void cmGlobalKdevelopGenerator "\n" "\n" " \n" - " \n" " \n" " \n" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4a19c0c97..f5c56a987 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -357,13 +357,13 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" << lg->Convert(cache, - cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; + cmLocalGenerator::START_OUTPUT) << "\"\n"; for(std::vector::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { cmakefileStream << " \"" - << lg->Convert(*i, cmLocalGenerator::START_OUTPUT).c_str() + << lg->Convert(*i, cmLocalGenerator::START_OUTPUT) << "\"\n"; } cmakefileStream @@ -380,10 +380,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" << lg->Convert(makefileName, - cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" + cmLocalGenerator::START_OUTPUT) << "\"\n" << " \"" << lg->Convert(check, - cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; + cmLocalGenerator::START_OUTPUT) << "\"\n"; cmakefileStream << " )\n\n"; // CMake must rerun if a byproduct is missing. @@ -397,7 +397,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() k != outfiles.end(); ++k) { cmakefileStream << " \"" << - lg->Convert(*k,cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(*k,cmLocalGenerator::HOME_OUTPUT) << "\"\n"; } @@ -411,7 +411,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" << - lg->Convert(tmpStr,cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(tmpStr,cmLocalGenerator::HOME_OUTPUT) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -450,7 +450,7 @@ void cmGlobalUnixMakefileGenerator3 std::string tname = lg->GetRelativeTargetDirectory(l->second); tname += "/DependInfo.cmake"; cmSystemTools::ConvertToUnixSlashes(tname); - cmakefileStream << " \"" << tname.c_str() << "\"\n"; + cmakefileStream << " \"" << tname << "\"\n"; } } } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 824e9e746..601993f95 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -349,8 +349,8 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName, this->WriteNode(libName, this->TargetPtrs.find(libName)->second, insertedNodes, str); - str << " \"" << myNodeName.c_str() << "\" -> \"" - << libNameIt->second.c_str() << "\""; + str << " \"" << myNodeName << "\" -> \"" + << libNameIt->second << "\""; str << " // " << targetName << " -> " << libName << std::endl; this->WriteConnections(libName, insertedNodes, insertedConnections, str); } @@ -455,7 +455,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName, std::map::const_iterator nameIt = this->TargetNamesNodes.find(targetName); - str << " \"" << nameIt->second.c_str() << "\" [ label=\"" + str << " \"" << nameIt->second << "\" [ label=\"" << targetName << "\" shape=\"" << getShapeForTarget(target) << "\"];" << std::endl; } diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 0fad9d66c..9370e4871 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -91,7 +91,7 @@ void cmInstallGenerator << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; os << indent << "endif()\n"; } - os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); + os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype; if(optional) { os << " OPTIONAL"; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 21957f9ef..de8dd514c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -503,7 +503,7 @@ void cmLocalGenerator::GenerateInstallRules() { std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); - fout << " include(\"" << odir.c_str() + fout << " include(\"" << odir << "/cmake_install.cmake\")" << std::endl; } } @@ -523,12 +523,12 @@ void cmLocalGenerator::GenerateInstallRules() "endif()\n\n"; fout << "file(WRITE \"" - << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " + << homedir << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"\")" << std::endl; fout << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl << " file(APPEND \"" - << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " + << homedir << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"${file}\\n\")" << std::endl << "endforeach()" << std::endl; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5dd2bb12b..02d388a93 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -625,7 +625,7 @@ cmLocalUnixMakefileGenerator3 i != commands.end(); ++i) { replace = *i; - os << "\t" << replace.c_str() << "\n"; + os << "\t" << replace << "\n"; } if(symbolic && !this->WatcomWMake) { @@ -1933,7 +1933,7 @@ void cmLocalUnixMakefileGenerator3 for(ImplicitDependLanguageMap::const_iterator l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { - cmakefileStream << " \"" << l->first.c_str() << "\"\n"; + cmakefileStream << " \"" << l->first << "\"\n"; } cmakefileStream << " )\n"; @@ -1944,7 +1944,7 @@ void cmLocalUnixMakefileGenerator3 l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { cmakefileStream - << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; + << "set(CMAKE_DEPENDS_CHECK_" << l->first << "\n"; ImplicitDependFileMap const& implicitPairs = l->second; // for each file pair @@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3 if(cid && *cid) { cmakefileStream - << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" + << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6fef3718c..58625fbc1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -240,7 +240,7 @@ void cmMakefile::PrintStringVector(const char* s, for(std::vector::const_iterator i = v.begin(); i != v.end(); ++i) { - std::cout << (*i).c_str() << " "; + std::cout << *i << " "; } std::cout << " )\n"; } @@ -253,7 +253,7 @@ void cmMakefile for(std::vector >::const_iterator i = v.begin(); i != v.end(); ++i) { - std::cout << i->first.c_str() << " " << i->second; + std::cout << i->first << " " << i->second; } std::cout << " )\n"; } @@ -273,15 +273,15 @@ void cmMakefile::Print() const } std::cout << " this->StartOutputDirectory; " << - this->StartOutputDirectory.c_str() << std::endl; + this->StartOutputDirectory << std::endl; std::cout << " this->HomeOutputDirectory; " << - this->HomeOutputDirectory.c_str() << std::endl; + this->HomeOutputDirectory << std::endl; std::cout << " this->cmStartDirectory; " << - this->cmStartDirectory.c_str() << std::endl; + this->cmStartDirectory << std::endl; std::cout << " this->cmHomeDirectory; " << - this->cmHomeDirectory.c_str() << std::endl; + this->cmHomeDirectory << std::endl; std::cout << " this->ProjectName; " - << this->ProjectName.c_str() << std::endl; + << this->ProjectName << std::endl; this->PrintStringVector("this->LinkDirectories", this->LinkDirectories); #if defined(CMAKE_BUILD_WITH_CMAKE) for( std::vector::const_iterator i = @@ -2619,7 +2619,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, << " " << filename << ":" << line << "\n"; } error << "when parsing string\n" - << " " << source.c_str() << "\n"; + << " " << source << "\n"; error << emsg; // If the parser failed ("res" is false) then this is a real diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0730bc371..983fd997f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -353,7 +353,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() std::string compiler = "CMAKE_"; compiler += *l; compiler += "_COMPILER"; - *this->FlagFileStream << "# compile " << l->c_str() << " with " << + *this->FlagFileStream << "# compile " << *l << " with " << this->Makefile->GetSafeDefinition(compiler) << "\n"; } @@ -1353,7 +1353,7 @@ cmMakefileTargetGenerator "_OBJECTS"); *this->BuildFileStream << "# Object files for target " << this->Target->GetName() << "\n" - << variableName.c_str() << " ="; + << variableName << " ="; std::string object; const char* objName = this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS"); @@ -1390,7 +1390,7 @@ cmMakefileTargetGenerator << "\n" << "# External object files for target " << this->Target->GetName() << "\n" - << variableNameExternal.c_str() << " ="; + << variableNameExternal << " ="; for(std::vector::const_iterator i = this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 365665df6..edba5baf8 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -91,7 +91,7 @@ bool cmSourceGroupCommand else { cmOStringStream err; - err << "Unknown argument \"" << args[i].c_str() << "\". " + err << "Unknown argument \"" << args[i] << "\". " << "Perhaps the FILES keyword is missing.\n"; this->SetError(err.str()); return false; diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 60796ec4f..8d26f863a 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -107,12 +107,12 @@ CopyAndFullPathMesaHeader(const char* source, if(glDirLine.find(includeFile.c_str())) { std::string gfile = glDirLine.match(3); - fout << "#include \"" << outdir << "/" << gfile.c_str() << "\"\n"; + fout << "#include \"" << outdir << "/" << gfile << "\"\n"; } else if(glLine.find(includeFile.c_str())) { fout << "#include \"" << outdir << "/" << - includeLine.match(1).c_str() << "\"\n"; + includeLine.match(1) << "\"\n"; } else { diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 3c1fe466c..debe24340 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -84,7 +84,7 @@ static void cmVariableWatchCommandVariableAccessed( if ( !processed ) { cmOStringStream msg; - msg << "Variable \"" << variable.c_str() << "\" was accessed using " + msg << "Variable \"" << variable << "\" was accessed using " << accessString << " with value \"" << (newValue?newValue:"") << "\"."; makefile->IssueMessage(cmake::LOG, msg.str()); } @@ -136,7 +136,7 @@ bool cmVariableWatchCommand if ( variable == "CMAKE_CURRENT_LIST_FILE" ) { cmOStringStream ostr; - ostr << "cannot be set on the variable: " << variable.c_str(); + ostr << "cannot be set on the variable: " << variable; this->SetError(ostr.str()); return false; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ad8e5e61d..4ce1d7065 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -433,7 +433,7 @@ bool cmake::SetCacheArgs(const std::vector& args) return false; } } - std::cerr << "loading initial cache file " << path.c_str() << "\n"; + std::cerr << "loading initial cache file " << path << "\n"; this->ReadListFile(args, path.c_str()); } else if(arg.find("-P",0) == 0) @@ -1922,7 +1922,7 @@ int cmake::CheckBuildSystem() { cmOStringStream msg; msg << "Re-run cmake missing file: " - << this->CheckBuildSystemArgument.c_str() << "\n"; + << this->CheckBuildSystemArgument << "\n"; cmSystemTools::Stdout(msg.str().c_str()); } return 1; @@ -1942,7 +1942,7 @@ int cmake::CheckBuildSystem() { cmOStringStream msg; msg << "Re-run cmake error reading : " - << this->CheckBuildSystemArgument.c_str() << "\n"; + << this->CheckBuildSystemArgument << "\n"; cmSystemTools::Stdout(msg.str().c_str()); } // There was an error reading the file. Just rerun. @@ -2076,8 +2076,8 @@ int cmake::CheckBuildSystem() if(verbose) { cmOStringStream msg; - msg << "Re-run cmake file: " << out_oldest.c_str() - << " older than: " << dep_newest.c_str() << "\n"; + msg << "Re-run cmake file: " << out_oldest + << " older than: " << dep_newest << "\n"; cmSystemTools::Stdout(msg.str().c_str()); } return 1; @@ -2351,8 +2351,8 @@ int cmake::GetSystemInformation(std::vector& args) // Copy file if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) { - std::cerr << "Error copying file \"" << inFile.c_str() - << "\" to \"" << outFile.c_str() << "\".\n"; + std::cerr << "Error copying file \"" << inFile + << "\" to \"" << outFile << "\".\n"; return 1; } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ad1f2a5a0..9aee975cc 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -102,8 +102,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str())) { - std::cerr << "Error copying file \"" << args[2].c_str() - << "\" to \"" << args[3].c_str() << "\".\n"; + std::cerr << "Error copying file \"" << args[2] + << "\" to \"" << args[3] << "\".\n"; return 1; } return 0; @@ -116,7 +116,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) args[3].c_str())) { std::cerr << "Error copying file (if different) from \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\".\n"; return 1; } @@ -129,7 +129,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str())) { std::cerr << "Error copying directory from \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\".\n"; return 1; } @@ -143,7 +143,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { std::string e = cmSystemTools::GetLastSystemError(); std::cerr << "Error renaming from \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\": " << e << "\n"; return 1; } @@ -156,7 +156,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str())) { std::cerr << "Files \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\" are different.\n"; return 1; } @@ -199,7 +199,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::vector::iterator it; for ( it = env.begin(); it != env.end(); ++ it ) { - std::cout << it->c_str() << std::endl; + std::cout << *it << std::endl; } return 0; } @@ -209,7 +209,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { if(!cmSystemTools::MakeDirectory(args[2].c_str())) { - std::cerr << "Error making directory \"" << args[2].c_str() + std::cerr << "Error making directory \"" << args[2] << "\".\n"; return 1; } @@ -221,7 +221,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(cmSystemTools::FileIsDirectory(args[2].c_str()) && !cmSystemTools::RemoveADirectory(args[2].c_str())) { - std::cerr << "Error removing directory \"" << args[2].c_str() + std::cerr << "Error removing directory \"" << args[2] << "\".\n"; return 1; } @@ -1181,7 +1181,7 @@ bool cmcmd::RunCommand(const char* comment, for(std::vector::iterator i = command.begin(); i != command.end(); ++i) { - std::cout << i->c_str() << " "; + std::cout << *i << " "; } std::cout << "\n"; } @@ -1257,7 +1257,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, resourceInputFile += ".resource.txt"; if(verbose) { - std::cout << "Create " << resourceInputFile.c_str() << "\n"; + std::cout << "Create " << resourceInputFile << "\n"; } // Create input file for rc command cmsys::ofstream fout(resourceInputFile.c_str()); @@ -1269,7 +1269,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, manifestFile += ".embed.manifest"; std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str()); fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID " - "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath.c_str() << "\""; + "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath << "\""; fout.close(); manifestArg += tempManifest; // add the manifest arg to the linkCommand @@ -1281,7 +1281,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, { if(verbose) { - std::cout << "Create empty: " << manifestFile.c_str() << "\n"; + std::cout << "Create empty: " << manifestFile << "\n"; } cmsys::ofstream foutTmp(manifestFile.c_str()); }