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.
This commit is contained in:
Pavel Solodovnikov
2018-01-31 18:20:02 +03:00
parent 4499cc8bb6
commit 653b894683
120 changed files with 471 additions and 507 deletions

View File

@@ -127,7 +127,7 @@ bool cmAddCustomCommandCommand::InitialPass(
case doing_output:
case doing_outputs:
case doing_byproducts:
if (!cmSystemTools::FileIsFullPath(copy.c_str())) {
if (!cmSystemTools::FileIsFullPath(copy)) {
// This is an output to be generated, so it should be
// under the build tree. CMake 2.4 placed this under the
// source tree. However the only case that this change
@@ -154,7 +154,7 @@ bool cmAddCustomCommandCommand::InitialPass(
break;
}
if (cmSystemTools::FileIsFullPath(filename.c_str())) {
if (cmSystemTools::FileIsFullPath(filename)) {
filename = cmSystemTools::CollapseFullPath(filename);
}
switch (doing) {
@@ -355,7 +355,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
for (std::string const& o : outputs) {
// Make sure the file will not be generated into the source
// directory during an out of source build.
if (!this->Makefile->CanIWriteThisFile(o.c_str())) {
if (!this->Makefile->CanIWriteThisFile(o)) {
std::string e = "attempted to have a file \"" + o +
"\" in a source directory as an output of custom command.";
this->SetError(e);