diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-10 23:04:11 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-11 14:03:50 (GMT) |
commit | 21c573f682f9eafbc8d4402f7febbb1bec1cb86a (patch) | |
tree | 8c9e0b913c7de5737a770430064ff5533a19477d /Source/CTest | |
parent | e21ffaf8fe5499426604b4ebb9cd08798ee6107c (diff) | |
download | CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.zip CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.tar.gz CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.tar.bz2 |
Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestHandlerCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestLaunch.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestP4.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunScriptCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestStartCommand.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 30 | ||||
-rw-r--r-- | Source/CTest/cmParseMumpsCoverage.cxx | 2 |
15 files changed, 47 insertions, 47 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 0fac136..4a3eec5 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -241,11 +241,11 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) { // Make the generator available for the Build call below. cm.SetGlobalGenerator(cm.CreateGlobalGenerator( - this->BuildGenerator.c_str())); + this->BuildGenerator)); cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. - cm.GetCacheManager()->LoadCache(this->BinaryDir.c_str()); + cm.GetCacheManager()->LoadCache(this->BinaryDir); } else { @@ -295,9 +295,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) config = "Debug"; } int retVal = cm.GetGlobalGenerator()->Build( - this->SourceDir.c_str(), this->BinaryDir.c_str(), - this->BuildProject.c_str(), tarIt->c_str(), - &output, this->BuildMakeProgram.c_str(), + this->SourceDir, this->BinaryDir, + this->BuildProject, *tarIt, + &output, this->BuildMakeProgram, config, !this->BuildNoClean, false, remainingTime); diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 04eabd2..de42e2b 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -151,7 +151,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() "\n" "Alternatively, set CTEST_BUILD_COMMAND to build the project " "with a custom command line."; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return 0; } } diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 5eed409..1aa8768 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -69,7 +69,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmOStringStream e; e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return 0; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2e35b75..2c21a13 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -157,7 +157,7 @@ void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log) logGlob += this->CTest->GetCurrentTag(); logGlob += "/CoverageLog*"; cmsys::Glob gl; - gl.FindFiles(logGlob.c_str()); + gl.FindFiles(logGlob); std::vector<std::string> const& files = gl.GetFiles(); for(std::vector<std::string>::const_iterator fi = files.begin(); fi != files.end(); ++fi) @@ -241,7 +241,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, bool buildSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), fBinDir.c_str()); // Always check parent directory of the file. - std::string fileDir = cmSystemTools::GetFilenamePath(fFile.c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(fFile); std::string checkDir; // We also need to check the binary/source directory pair. @@ -296,7 +296,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, checkDir = fSrcDir; } fFile = checkDir + "/" + relPath; - fFile = cmSystemTools::GetFilenamePath(fFile.c_str()); + fFile = cmSystemTools::GetFilenamePath(fFile); if ( fileDir == fFile ) { @@ -503,7 +503,7 @@ int cmCTestCoverageHandler::ProcessHandler() } const std::string fileName - = cmSystemTools::GetFilenameName(fullFileName.c_str()); + = cmSystemTools::GetFilenameName(fullFileName); std::string shortFileName = this->CTest->GetShortPathToFile(fullFileName.c_str()); const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov @@ -947,7 +947,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // Call gcov to get coverage data for this *.gcda file: // - std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(*it); std::string command = "\"" + gcovCommand + "\" " + gcovExtraFlags + " " + "-o \"" + fileDir + "\" " + @@ -1814,7 +1814,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( total_tested += functionsCalled; total_untested += (totalFunctions - functionsCalled); - std::string fileName = cmSystemTools::GetFilenameName(file.c_str()); + std::string fileName = cmSystemTools::GetFilenameName(file); std::string shortFileName = this->CTest->GetShortPathToFile(file.c_str()); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index abc33de..a470b3b 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -26,7 +26,7 @@ bool cmCTestEmptyBinaryDirectoryCommand { cmOStringStream ostr; ostr << "problem removing the binary directory: " << args[0].c_str(); - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index ae498ea..08cfaec 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -75,7 +75,7 @@ void cmCTestGenericHandler::Initialize() it != this->PersistentOptions.end(); ++ it ) { - this->Options[it->first.c_str()] = it->second.c_str(); + this->Options[it->first] = it->second.c_str(); } } @@ -121,7 +121,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, return false; } if( !this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), - ostr.str().c_str(), xofs, true) ) + ostr.str(), xofs, true) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create resulting XML file: " << ostr.str().c_str() @@ -153,7 +153,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, ostr << "_" << this->CTest->GetCurrentTag(); } ostr << ".log"; - if( !this->CTest->OpenOutputFile("Temporary", ostr.str().c_str(), xofs) ) + if( !this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: " << ostr.str().c_str() << std::endl); diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 2e2feb0..0e29160 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -48,7 +48,7 @@ bool cmCTestHandlerCommand { cmOStringStream e; e << "called with unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index c9f9e9e..10a5199 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -680,8 +680,8 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname) continue; } - if(this->Match(line.c_str(), this->RegexWarning) && - !this->Match(line.c_str(), this->RegexWarningSuppress)) + if(this->Match(line, this->RegexWarning) && + !this->Match(line, this->RegexWarningSuppress)) { return true; } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 1ad94bc..0bb1a99 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -352,7 +352,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions) for(std::vector<std::string>::const_iterator ai = args.begin(); ai != args.end(); ++ai) { - P4Options.push_back(ai->c_str()); + P4Options.push_back(*ai); } } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index fe429bd..bdf9b9c 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -56,7 +56,7 @@ bool cmCTestRunScriptCommand &ret); cmOStringStream str; str << ret; - this->Makefile->AddDefinition(returnVariable.c_str(), str.str().c_str()); + this->Makefile->AddDefinition(returnVariable, str.str().c_str()); } } return true; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 7f13855..4d419c2 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -337,8 +337,8 @@ void cmCTestScriptHandler::CreateCMake() // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. // Also, some commands need Makefile->GetCurrentDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->Makefile->SetStartDirectory(cwd.c_str()); - this->Makefile->SetStartOutputDirectory(cwd.c_str()); + this->Makefile->SetStartDirectory(cwd); + this->Makefile->SetStartOutputDirectory(cwd); // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts @@ -436,7 +436,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) for (std::map<std::string, std::string>::const_iterator it = defs.begin(); it != defs.end(); ++it) { - this->Makefile->AddDefinition(it->first.c_str(), it->second.c_str()); + this->Makefile->AddDefinition(it->first, it->second.c_str()); } // finally read in the script @@ -646,7 +646,7 @@ int cmCTestScriptHandler::RunCurrentScript() if (!this->CTestEnv.empty()) { std::vector<std::string> envArgs; - cmSystemTools::ExpandListArgument(this->CTestEnv.c_str(),envArgs); + cmSystemTools::ExpandListArgument(this->CTestEnv,envArgs); cmSystemTools::AppendEnv(envArgs); } @@ -772,7 +772,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() ++ it ) { std::vector<std::string> cvsArgs; - cmSystemTools::ExpandListArgument(it->c_str(),cvsArgs); + cmSystemTools::ExpandListArgument(*it,cvsArgs); if (cvsArgs.size() == 2) { std::string fullCommand = command; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 228a173..da46f4a 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -131,7 +131,7 @@ bool cmCTestStartCommand << " " << sourceDir << "\n" << "which is not an existing directory. " << "Set CTEST_CHECKOUT_COMMAND to a command line to create it."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -160,7 +160,7 @@ bool cmCTestStartCommand::InitialCheckout( { // Use a generic VC object to run and log the command. cmCTestVC vc(this->CTest, ofs); - vc.SetSourceDirectory(sourceDir.c_str()); + vc.SetSourceDirectory(sourceDir); if(!vc.InitialCheckout(initialCheckoutCommand)) { return false; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 3173f15..bc3c333 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -339,7 +339,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector<std::string> args; - cmSystemTools::ExpandListArgument(curlopt.c_str(), args); + cmSystemTools::ExpandListArgument(curlopt, args); bool verifyPeerOff = false; bool verifyHostOff = false; for( std::vector<std::string>::iterator i = args.begin(); @@ -461,7 +461,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, else { char md5[33]; - cmSystemTools::ComputeFileMD5(local_file.c_str(), md5); + cmSystemTools::ComputeFileMD5(local_file, md5); md5[32] = 0; upload_as += md5; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 5970656..efeb658 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -125,7 +125,7 @@ bool cmCTestSubdirCommand { std::string m = "Could not find include file: "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } } @@ -213,7 +213,7 @@ bool cmCTestAddSubdirectoryCommand { std::string m = "Could not find include file: "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } return true; @@ -1506,7 +1506,7 @@ std::string cmCTestTestHandler // then try with the exe extension else { - failed.push_back(attempted[ai].c_str()); + failed.push_back(attempted[ai]); tempPath = attempted[ai]; tempPath += cmSystemTools::GetExecutableExtension(); if(cmSystemTools::FileExists(tempPath.c_str()) @@ -1517,7 +1517,7 @@ std::string cmCTestTestHandler } else { - failed.push_back(tempPath.c_str()); + failed.push_back(tempPath); } } } @@ -2154,7 +2154,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ATTACHED_FILES" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2165,7 +2165,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ATTACHED_FILES_ON_FAIL" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2176,7 +2176,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "RESOURCE_LOCK" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2196,7 +2196,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "REQUIRED_FILES" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2211,14 +2211,14 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "FAIL_REGULAR_EXPRESSION" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->ErrorRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( cmsys::RegularExpression(crit->c_str()), - std::string(crit->c_str()))); + std::string(*crit))); } } if ( key == "PROCESSORS" ) @@ -2240,7 +2240,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "DEPENDS" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2250,7 +2250,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ENVIRONMENT" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2260,7 +2260,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "LABELS" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2284,14 +2284,14 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "PASS_REGULAR_EXPRESSION" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->RequiredRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( cmsys::RegularExpression(crit->c_str()), - std::string(crit->c_str()))); + std::string(*crit))); } } if ( key == "WORKING_DIRECTORY" ) diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index fe98964..6236211 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -122,7 +122,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) glob.RecurseOn(); std::string pat = d; pat += "/*.m"; - glob.FindFiles(pat.c_str()); + glob.FindFiles(pat); std::vector<std::string>& files = glob.GetFiles(); std::vector<std::string>::iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); |