mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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" )
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user