summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2018-01-31 15:20:02 (GMT)
committerPavel Solodovnikov <hellyeahdominate@gmail.com>2018-01-31 15:23:03 (GMT)
commit653b894683abe63233cb8679b34ea39d9017e317 (patch)
tree200e5066b754d8ddfdc7beb86c4db179aa2e69d0 /Source/cmcmd.cxx
parent4499cc8bb65e217e1cb2959452ed391af82e757b (diff)
downloadCMake-653b894683abe63233cb8679b34ea39d9017e317.zip
CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.gz
CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.bz2
Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 70e4fde..0988c3c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -641,7 +641,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = false;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
- if (!cmSystemTools::MakeDirectory(args[cc].c_str())) {
+ if (!cmSystemTools::MakeDirectory(args[cc])) {
std::cerr << "Error creating directory \"" << args[cc] << "\".\n";
return_value = true;
}
@@ -668,7 +668,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Complain if the file could not be removed, still exists,
// and the -f option was not given.
if (!cmSystemTools::RemoveFile(args[cc]) && !force &&
- cmSystemTools::FileExists(args[cc].c_str())) {
+ cmSystemTools::FileExists(args[cc])) {
return 1;
}
}
@@ -789,7 +789,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Command to change directory and run a program.
if (args[1] == "chdir" && args.size() >= 4) {
std::string const& directory = args[2];
- if (!cmSystemTools::FileExists(directory.c_str())) {
+ if (!cmSystemTools::FileExists(directory)) {
cmSystemTools::Error("Directory does not exist for chdir command: ",
args[2].c_str());
return 1;
@@ -826,7 +826,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
count = atoi(args[3].c_str());
}
if (count) {
- cmSystemTools::MakeDirectory(dirName.c_str());
+ cmSystemTools::MakeDirectory(dirName);
// write the count into the directory
std::string fName = dirName;
fName += "/count.txt";
@@ -1274,8 +1274,7 @@ int cmcmd::SymlinkExecutable(std::vector<std::string>& args)
bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
{
- if (cmSystemTools::FileExists(link.c_str()) ||
- cmSystemTools::FileIsSymlink(link)) {
+ if (cmSystemTools::FileExists(link) || cmSystemTools::FileIsSymlink(link)) {
cmSystemTools::RemoveFile(link);
}
#if defined(_WIN32) && !defined(__CYGWIN__)