diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:20:02 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:23:03 (GMT) |
commit | 653b894683abe63233cb8679b34ea39d9017e317 (patch) | |
tree | 200e5066b754d8ddfdc7beb86c4db179aa2e69d0 /Source/cmFindPackageCommand.cxx | |
parent | 4499cc8bb65e217e1cb2959452ed391af82e757b (diff) | |
download | CMake-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/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 293a967..2f3a85b 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -660,7 +660,7 @@ bool cmFindPackageCommand::HandlePackageMode() cmSystemTools::ConvertToUnixSlashes(dir); // Treat relative paths with respect to the current source dir. - if (!cmSystemTools::FileIsFullPath(dir.c_str())) { + if (!cmSystemTools::FileIsFullPath(dir)) { dir = "/" + dir; dir = this->Makefile->GetCurrentSourceDirectory() + dir; } @@ -1346,10 +1346,10 @@ bool cmFindPackageCommand::CheckPackageRegistryEntry(const std::string& fname, cmSearchPath& outPaths) { // Parse the content of one package registry entry. - if (cmSystemTools::FileIsFullPath(fname.c_str())) { + if (cmSystemTools::FileIsFullPath(fname)) { // The first line in the stream is the full path to a file or // directory containing the package. - if (cmSystemTools::FileExists(fname.c_str())) { + if (cmSystemTools::FileExists(fname)) { // The path exists. Look for the package here. if (!cmSystemTools::FileIsDirectory(fname)) { outPaths.AddPath(cmSystemTools::GetFilenamePath(fname)); @@ -1442,8 +1442,7 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir, if (this->DebugMode) { fprintf(stderr, "Checking file [%s]\n", file.c_str()); } - if (cmSystemTools::FileExists(file.c_str(), true) && - this->CheckVersion(file)) { + if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) { return true; } } @@ -1463,7 +1462,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) // Look for foo-config-version.cmake std::string version_file = version_file_base; version_file += "-version.cmake"; - if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) { + if (!haveResult && cmSystemTools::FileExists(version_file, true)) { result = this->CheckVersionFile(version_file, version); haveResult = true; } @@ -1471,7 +1470,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) // Look for fooConfigVersion.cmake version_file = version_file_base; version_file += "Version.cmake"; - if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) { + if (!haveResult && cmSystemTools::FileExists(version_file, true)) { result = this->CheckVersionFile(version_file, version); haveResult = true; } |