Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 5eb4d759 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

Remove some unneeded c_str calls.

parent 2a0c6548
......@@ -30,7 +30,7 @@ unsigned long cmCPackComponent::GetInstalledSize(
std::string path = installDir;
path += '/';
path += *fileIt;
this->TotalSize += cmSystemTools::FileLength(path.c_str());
this->TotalSize += cmSystemTools::FileLength(path);
}
return this->TotalSize;
......
......@@ -390,7 +390,7 @@ int cmCPackDebGenerator::createDeb()
packageFiles.begin();
fileIt != packageFiles.end(); ++ fileIt )
{
totalSize += cmSystemTools::FileLength(fileIt->c_str());
totalSize += cmSystemTools::FileLength(*fileIt);
}
}
out << "Installed-Size: " << (totalSize + 1023) / 1024 << "\n";
......
......@@ -217,7 +217,7 @@ int cmCPackGenerator::InstallProject()
{
std::string destDir = "DESTDIR=";
destDir += tempInstallDirectory;
cmSystemTools::PutEnv(destDir.c_str());
cmSystemTools::PutEnv(destDir);
}
else
{
......@@ -277,7 +277,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
{
std::string tempInstallDirectoryEnv = "CMAKE_INSTALL_PREFIX=";
tempInstallDirectoryEnv += tempInstallDirectory;
cmSystemTools::PutEnv(tempInstallDirectoryEnv.c_str());
cmSystemTools::PutEnv(tempInstallDirectoryEnv);
std::vector<std::string> installCommandsVector;
cmSystemTools::ExpandListArgument(installCommands,installCommandsVector);
std::vector<std::string>::iterator it;
......@@ -404,7 +404,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
std::string targetFile;
std::string inFileRelative =
cmSystemTools::RelativePath(top.c_str(),inFile.c_str());
cmSystemTools::ReadSymlink(inFile.c_str(),targetFile);
cmSystemTools::ReadSymlink(inFile,targetFile);
symlinkedFiles.push_back(std::pair<std::string,
std::string>(targetFile,inFileRelative));
}
......@@ -437,8 +437,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
<< symlinkedIt->second << "--> "
<< symlinkedIt->first << std::endl);
if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(),
(symlinkedIt->second).c_str()))
if (!cmSystemTools::CreateSymlink(symlinkedIt->first,
symlinkedIt->second))
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create symlink: "
<< symlinkedIt->second << "--> "
......@@ -787,7 +787,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
* in order to put things in subdirs...
*/
cmSystemTools::PutEnv(
(std::string("DESTDIR=")+tempInstallDirectory).c_str()
std::string("DESTDIR=")+tempInstallDirectory
);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Creating directory: '" << dir << "'" << std::endl);
......
......@@ -825,7 +825,7 @@ CreateComponentDescription(cmCPackComponent *component,
}
out << std::endl;
totalSize += cmSystemTools::FileLength((dirName + *fileIt).c_str());
totalSize += cmSystemTools::FileLength(dirName + *fileIt);
}
}
......
......@@ -828,7 +828,7 @@ cmCTestBuildHandler::LaunchHelper::LaunchHelper(cmCTestBuildHandler* handler):
this->WriteLauncherConfig();
std::string launchEnv = "CTEST_LAUNCH_LOGS=";
launchEnv += launchDir;
cmSystemTools::PutEnv(launchEnv.c_str());
cmSystemTools::PutEnv(launchEnv);
}
}
......
......@@ -884,7 +884,7 @@ struct cmCTestCoverageHandlerLocale
{
if(!lc_all.empty())
{
cmSystemTools::PutEnv(("LC_ALL=" + lc_all).c_str());
cmSystemTools::PutEnv("LC_ALL=" + lc_all);
}
else
{
......@@ -1491,24 +1491,24 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
lcovExtraFlags + " ";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: "
<< fileDir.c_str() << std::endl);
<< fileDir << std::endl);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl);
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, fileDir.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 ++;
......@@ -1517,7 +1517,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
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);
}
......
......@@ -234,7 +234,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
::curl_global_cleanup();
return false;
}
unsigned long filelen = cmSystemTools::FileLength(local_file.c_str());
unsigned long filelen = cmSystemTools::FileLength(local_file);
ftpfile = cmsys::SystemTools::Fopen(local_file, "rb");
*this->LogFile << "\tUpload file: " << local_file << " to "
......@@ -475,7 +475,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
::curl_global_cleanup();
return false;
}
unsigned long filelen = cmSystemTools::FileLength(local_file.c_str());
unsigned long filelen = cmSystemTools::FileLength(local_file);
ftpfile = cmsys::SystemTools::Fopen(local_file, "rb");
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
......
......@@ -1939,7 +1939,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
cmCTest::CleanString(measurementfile.match(5));
if ( cmSystemTools::FileExists(filename.c_str()) )
{
long len = cmSystemTools::FileLength(filename.c_str());
long len = cmSystemTools::FileLength(filename);
if ( len == 0 )
{
std::string k1 = measurementfile.match(1);
......
......@@ -98,7 +98,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
{
std::string put = "LC_MESSAGES=";
put += saveLCMessages;
cmSystemTools::PutEnv(put.c_str());
cmSystemTools::PutEnv(put);
}
else
{
......
......@@ -78,7 +78,7 @@ public:
* information in the local vector
*/
FileLinesType& CoverageVector =
this->Coverage.TotalCoverage[filename.c_str()];
this->Coverage.TotalCoverage[filename];
CoverageVector = localCoverageVector;
localCoverageVector.clear();
foundFile=false;
......@@ -98,7 +98,7 @@ public:
* FoundFile and foundSource ensure that
* only the value of the line coverage is captured
*/
std::string result = getValue(line,1).c_str();
std::string result = getValue(line,1);
result = result.substr(2,result.npos);
if(result == "\"\"")
{
......@@ -120,7 +120,7 @@ public:
// On exit, capture end of last file covered.
FileLinesType& CoverageVector =
this->Coverage.TotalCoverage[filename.c_str()];
this->Coverage.TotalCoverage[filename];
CoverageVector = localCoverageVector;
foundFile=false;
localCoverageVector.clear();
......
......@@ -47,7 +47,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
cmSystemTools::GetCMakeCursesCommand());
// create the arguments for the cmake object
std::string whereCMake = cmSystemTools::GetProgramPath(this->Args[0].c_str());
std::string whereCMake = cmSystemTools::GetProgramPath(this->Args[0]);
whereCMake += "/cmake";
this->Args[0] = whereCMake;
this->CMakeInstance->SetArgs(this->Args);
......
......@@ -1688,7 +1688,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
//----------------------------------------------------------------------
std::string cmCTest::Base64EncodeFile(std::string file)
{
long len = cmSystemTools::FileLength(file.c_str());
long len = cmSystemTools::FileLength(file);
cmsys::ifstream ifs(file.c_str(), std::ios::in
#ifdef _WIN32
| std::ios::binary
......@@ -2860,7 +2860,7 @@ void cmCTest::SetConfigType(const char* ct)
cmSystemTools::ReplaceString(this->ConfigType, ".\\", "");
std::string confTypeEnv
= "CMAKE_CONFIG_TYPE=" + this->ConfigType;
cmSystemTools::PutEnv(confTypeEnv.c_str());
cmSystemTools::PutEnv(confTypeEnv);
}
//----------------------------------------------------------------------
......
......@@ -1640,7 +1640,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile)
cmSystemTools::RemoveFile(toFile);
// Create the symlink.
if(!cmSystemTools::CreateSymlink(symlinkTarget.c_str(), toFile))
if(!cmSystemTools::CreateSymlink(symlinkTarget, toFile))
{
cmOStringStream e;
e << this->Name << " cannot duplicate symlink \"" << fromFile
......@@ -3282,7 +3282,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
return false;
}
unsigned long file_size = cmsys::SystemTools::FileLength(filename.c_str());
unsigned long file_size = cmsys::SystemTools::FileLength(filename);
#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8)
url = fix_file_url_windows(url);
......
......@@ -1475,7 +1475,7 @@ void cmFindPackageCommand::FillPrefixesBuilds()
cmSystemTools::ExpandRegistryValues(f);
cmSystemTools::ConvertToUnixSlashes(f);
if(cmSystemTools::FileIsFullPath(f.c_str()) &&
cmSystemTools::FileIsDirectory(f.c_str()))
cmSystemTools::FileIsDirectory(f))
{
paths.AddPath(f);
}
......
......@@ -88,7 +88,7 @@ std::string cmFindProgramCommand
{
std::string appName = *name + std::string(".app");
std::string appPath = cmSystemTools::FindDirectory(appName.c_str(),
std::string appPath = cmSystemTools::FindDirectory(appName,
this->SearchPaths,
true);
......
......@@ -329,7 +329,7 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
return cmSystemTools::MakeCidentifier(parameters.front().c_str());
return cmSystemTools::MakeCidentifier(parameters.front());
}
} makeCIdentifierNode;
......
......@@ -79,7 +79,7 @@ bool cmGetFilenameComponentCommand
}
}
}
cmSystemTools::SplitProgramFromArgs(filename.c_str(),
cmSystemTools::SplitProgramFromArgs(filename,
result, programArgs);
}
else if (args[2] == "EXT")
......
......@@ -300,11 +300,11 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
std::string dir;
std::string file;
cmSystemTools::SplitProgramPath(makeProgram.c_str(),
cmSystemTools::SplitProgramPath(makeProgram,
dir, file);
std::string saveFile = file;
cmSystemTools::GetShortPath(makeProgram, makeProgram);
cmSystemTools::SplitProgramPath(makeProgram.c_str(),
cmSystemTools::SplitProgramPath(makeProgram,
dir, file);
makeProgram = dir;
makeProgram += "/";
......@@ -607,7 +607,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
std::string env = envVar;
env += "=";
env += envVarValue;
cmSystemTools::PutEnv(env.c_str());
cmSystemTools::PutEnv(env);
}
// if determineLanguage was called then load the file it
......@@ -2469,7 +2469,7 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf)
this->FindMakeProgram(mf);
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::vector<std::string> locations;
locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
locations.push_back(cmSystemTools::GetProgramPath(makeProgram));
locations.push_back("/mingw/bin");
locations.push_back("c:/mingw/bin");
std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
......
......@@ -113,7 +113,7 @@ void cmOSXBundleGenerator::CreateFramework(
newName = versions;
newName += "/Current";
cmSystemTools::RemoveFile(newName);
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
cmSystemTools::CreateSymlink(oldName, newName);
this->Makefile->AddCMakeOutputFile(newName);
// foo -> Versions/Current/foo
......@@ -122,7 +122,7 @@ void cmOSXBundleGenerator::CreateFramework(
newName = contentdir;
newName += name;
cmSystemTools::RemoveFile(newName);
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
cmSystemTools::CreateSymlink(oldName, newName);
this->Makefile->AddCMakeOutputFile(newName);
// Resources -> Versions/Current/Resources
......@@ -133,7 +133,7 @@ void cmOSXBundleGenerator::CreateFramework(
newName = contentdir;
newName += "Resources";
cmSystemTools::RemoveFile(newName);
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
cmSystemTools::CreateSymlink(oldName, newName);
this->Makefile->AddCMakeOutputFile(newName);
}
......@@ -145,7 +145,7 @@ void cmOSXBundleGenerator::CreateFramework(
newName = contentdir;
newName += "Headers";
cmSystemTools::RemoveFile(newName);
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
cmSystemTools::CreateSymlink(oldName, newName);
this->Makefile->AddCMakeOutputFile(newName);
}
......@@ -157,7 +157,7 @@ void cmOSXBundleGenerator::CreateFramework(
newName = contentdir;
newName += "PrivateHeaders";
cmSystemTools::RemoveFile(newName);
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
cmSystemTools::CreateSymlink(oldName, newName);
this->Makefile->AddCMakeOutputFile(newName);
}
}
......
......@@ -178,7 +178,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
command.push_back("--list");
std::string absFile = cmsys::SystemTools::GetRealPath(
sf->GetFullPath().c_str());
sf->GetFullPath());
command.push_back(absFile);
......@@ -394,7 +394,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
{
cmSourceFile* sf = *fileIt;
std::string absFile = cmsys::SystemTools::GetRealPath(
sf->GetFullPath().c_str());
sf->GetFullPath());
std::string ext = sf->GetExtension();
......@@ -2319,8 +2319,8 @@ bool cmQtAutoGenerators::InputFilesNewerThanQrc(const std::string& qrcFile,
it != files.end(); ++it)
{
int inputNewerThanQrc = 0;
bool success = cmsys::SystemTools::FileTimeCompare(it->c_str(),
rccOutput.c_str(),
bool success = cmsys::SystemTools::FileTimeCompare(*it,
rccOutput,
&inputNewerThanQrc);
if (!success || inputNewerThanQrc >= 0)
{
......@@ -2353,7 +2353,7 @@ bool cmQtAutoGenerators::GenerateQrc()
int sourceNewerThanQrc = 0;
bool generateQrc = !cmsys::SystemTools::FileTimeCompare(*si,
rcc_output_file.c_str(),
rcc_output_file,
&sourceNewerThanQrc);
generateQrc = generateQrc || (sourceNewerThanQrc >= 0);
generateQrc = generateQrc || this->InputFilesNewerThanQrc(*si,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment