Remove some unneeded c_str calls.

This commit is contained in:
Stephen Kelly 2014-11-23 11:05:50 +01:00
parent 2a0c654858
commit 5eb4d7590e
26 changed files with 59 additions and 59 deletions

View File

@ -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;

View File

@ -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";

View File

@ -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);

View File

@ -825,7 +825,7 @@ CreateComponentDescription(cmCPackComponent *component,
}
out << std::endl;
totalSize += cmSystemTools::FileLength((dirName + *fileIt).c_str());
totalSize += cmSystemTools::FileLength(dirName + *fileIt);
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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: "

View 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);

View File

@ -98,7 +98,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
{
std::string put = "LC_MESSAGES=";
put += saveLCMessages;
cmSystemTools::PutEnv(put.c_str());
cmSystemTools::PutEnv(put);
}
else
{

View File

@ -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();

View File

@ -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);

View File

@ -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);
}
//----------------------------------------------------------------------

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -79,7 +79,7 @@ bool cmGetFilenameComponentCommand
}
}
}
cmSystemTools::SplitProgramFromArgs(filename.c_str(),
cmSystemTools::SplitProgramFromArgs(filename,
result, programArgs);
}
else if (args[2] == "EXT")

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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,

View File

@ -43,7 +43,7 @@ bool cmSetCommand
if (!currValue || strcmp(currValue,args[1].c_str()))
{
putEnvArg += args[1];
cmSystemTools::PutEnv(putEnvArg.c_str());
cmSystemTools::PutEnv(putEnvArg);
}
return true;
}
@ -51,7 +51,7 @@ bool cmSetCommand
// if it will be cleared, then clear it if it isn;t already clear
if (currValue)
{
cmSystemTools::PutEnv(putEnvArg.c_str());
cmSystemTools::PutEnv(putEnvArg);
}
return true;
}

View File

@ -780,7 +780,7 @@ bool cmStringCommand
const std::string& variableName = args[2];
this->Makefile->AddDefinition(variableName,
cmSystemTools::MakeCidentifier(input.c_str()).c_str());
cmSystemTools::MakeCidentifier(input).c_str());
return true;
}

View File

@ -1409,7 +1409,7 @@ void cmSystemTools::AppendEnv(std::vector<std::string> const& env)
for(std::vector<std::string>::const_iterator eit = env.begin();
eit != env.end(); ++eit)
{
cmSystemTools::PutEnv(eit->c_str());
cmSystemTools::PutEnv(*eit);
}
}
@ -2333,7 +2333,7 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
{
return false;
}
if(!cmSystemTools::ReadSymlink(fullPath.c_str(), soname))
if(!cmSystemTools::ReadSymlink(fullPath, soname))
{
return false;
}

View File

@ -4713,7 +4713,7 @@ const char* cmTarget::GetExportMacro() const
{
std::string in = this->GetName();
in += "_EXPORTS";
this->ExportMacro = cmSystemTools::MakeCindentifier(in.c_str());
this->ExportMacro = cmSystemTools::MakeCindentifier(in);
}
return this->ExportMacro.c_str();
}

View File

@ -1135,13 +1135,13 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
{
env += this->CCEnvironment;
}
cmSystemTools::PutEnv(env.c_str());
cmSystemTools::PutEnv(env);
env = "CXX=";
if(this->CXXEnvironment.size())
{
env += this->CXXEnvironment;
}
cmSystemTools::PutEnv(env.c_str());
cmSystemTools::PutEnv(env);
}
// set the new

View File

@ -215,7 +215,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if(a.find("=") != a.npos)
{
// Set environment variable.
cmSystemTools::PutEnv(a.c_str());
cmSystemTools::PutEnv(a);
}
else
{
@ -549,7 +549,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
"' because existing path cannot be removed: " << emsg << "\n";
return 1;
}
if(!cmSystemTools::CreateSymlink(args[2].c_str(), args[3].c_str()))
if(!cmSystemTools::CreateSymlink(args[2], args[3]))
{
std::string emsg = cmSystemTools::GetLastSystemError();
std::cerr <<
@ -893,7 +893,7 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
#else
std::string linktext = cmSystemTools::GetFilenameName(file);
return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str());
return cmSystemTools::CreateSymlink(linktext, link);
#endif
}