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/CTest | |
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/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 20 | ||||
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestLaunch.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 24 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 8 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 20 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 14 | ||||
-rw-r--r-- | Source/CTest/cmCTestUploadCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestVC.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmParseCoberturaCoverage.cxx | 2 |
17 files changed, 74 insertions, 80 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 5ccab26..2e1ea4c 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -193,7 +193,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) out << "Internal cmake changing into directory: " << this->BinaryDir << std::endl; if (!cmSystemTools::FileIsDirectory(this->BinaryDir)) { - cmSystemTools::MakeDirectory(this->BinaryDir.c_str()); + cmSystemTools::MakeDirectory(this->BinaryDir); } cmWorkingDirectory workdir(this->BinaryDir); @@ -280,7 +280,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cmCTestTestHandler::FindExecutable(this->CTest, this->TestCommand.c_str(), resultingConfig, extraPaths, failed); - if (!cmSystemTools::FileExists(fullPath.c_str())) { + if (!cmSystemTools::FileExists(fullPath)) { out << "Could not find path to executable, perhaps it was not built: " << this->TestCommand << "\n"; out << "tried to find it in these places:\n"; @@ -358,7 +358,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( idx++; this->BinaryDir = allArgs[idx]; // dir must exist before CollapseFullPath is called - cmSystemTools::MakeDirectory(this->BinaryDir.c_str()); + cmSystemTools::MakeDirectory(this->BinaryDir); this->BinaryDir = cmSystemTools::CollapseFullPath(this->BinaryDir); this->SourceDir = cmSystemTools::CollapseFullPath(this->SourceDir); } else { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index ad28d92..ce6fbc7 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -709,7 +709,7 @@ cmCTestBuildHandler::LaunchHelper::LaunchHelper(cmCTestBuildHandler* handler) if (this->Handler->UseCTestLaunch) { // Enable launcher fragments. - cmSystemTools::MakeDirectory(launchDir.c_str()); + cmSystemTools::MakeDirectory(launchDir); this->WriteLauncherConfig(); std::string launchEnv = "CTEST_LAUNCH_LOGS="; launchEnv += launchDir; diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index c44b866..7b5c3bc 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -57,7 +57,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() } const std::string cmakelists_file = source_dir + "/CMakeLists.txt"; - if (!cmSystemTools::FileExists(cmakelists_file.c_str())) { + if (!cmSystemTools::FileExists(cmakelists_file)) { std::ostringstream e; e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]"; this->SetError(e.str()); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 856421f..9c66e73 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -240,7 +240,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(std::string const& file, // If it is the same as fileDir, then ignore, otherwise check. std::string relPath; if (!checkDir.empty()) { - relPath = cmSystemTools::RelativePath(checkDir.c_str(), fFile.c_str()); + relPath = cmSystemTools::RelativePath(checkDir, fFile); } else { relPath = fFile; } @@ -450,7 +450,7 @@ int cmCTestCoverageHandler::ProcessHandler() "Process file: " << fullFileName << std::endl, this->Quiet); - if (!cmSystemTools::FileExists(fullFileName.c_str())) { + if (!cmSystemTools::FileExists(fullFileName)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: " << fullFileName << std::endl); continue; @@ -718,7 +718,7 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( // build the find file string with the directory from above coverageXMLFile += "/coverage.xml"; - if (cmSystemTools::FileExists(coverageXMLFile.c_str())) { + if (cmSystemTools::FileExists(coverageXMLFile)) { // If file exists, parse it cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cobertura XML file: " << coverageXMLFile @@ -741,7 +741,7 @@ int cmCTestCoverageHandler::HandleMumpsCoverage( cmParseGTMCoverage cov(*cont, this->CTest); std::string coverageFile = this->CTest->GetBinaryDir() + "/gtm_coverage.mcov"; - if (cmSystemTools::FileExists(coverageFile.c_str())) { + if (cmSystemTools::FileExists(coverageFile)) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cache Coverage: " << coverageFile << std::endl, this->Quiet); @@ -754,7 +754,7 @@ int cmCTestCoverageHandler::HandleMumpsCoverage( this->Quiet); cmParseCacheCoverage ccov(*cont, this->CTest); coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov"; - if (cmSystemTools::FileExists(coverageFile.c_str())) { + if (cmSystemTools::FileExists(coverageFile)) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cache Coverage: " << coverageFile << std::endl, this->Quiet); @@ -975,7 +975,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string testingDir = this->CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; - cmSystemTools::MakeDirectory(tempDir.c_str()); + cmSystemTools::MakeDirectory(tempDir); cmWorkingDirectory workdir(tempDir); int gcovStyle = 0; @@ -1646,7 +1646,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( std::string testingDir = this->CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; - cmSystemTools::MakeDirectory(tempDir.c_str()); + cmSystemTools::MakeDirectory(tempDir); int file_count = 0; for (std::string const& file : files) { @@ -1742,11 +1742,11 @@ std::string cmCTestCoverageHandler::FindFile( cmSystemTools::GetFilenameWithoutLastExtension(fileName); // First check in source and binary directory std::string fullName = cont->SourceDir + "/" + fileNameNoE + ".py"; - if (cmSystemTools::FileExists(fullName.c_str())) { + if (cmSystemTools::FileExists(fullName)) { return fullName; } fullName = cont->BinaryDir + "/" + fileNameNoE + ".py"; - if (cmSystemTools::FileExists(fullName.c_str())) { + if (cmSystemTools::FileExists(fullName)) { return fullName; } return ""; @@ -2012,7 +2012,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( } std::string file = sourceFile; coveredFileNames.insert(file); - if (!cmSystemTools::FileIsFullPath(sourceFile.c_str())) { + if (!cmSystemTools::FileIsFullPath(sourceFile)) { // file will be relative to the binary dir file = cont->BinaryDir; file += "/"; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 8cb795e..e85af5e 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -113,7 +113,7 @@ std::string cmCTestGIT::FindGitDir() // are a Windows application. Run "cygpath" to get Windows path. std::string cygpath_exe = cmSystemTools::GetFilenamePath(git); cygpath_exe += "/cygpath.exe"; - if (cmSystemTools::FileExists(cygpath_exe.c_str())) { + if (cmSystemTools::FileExists(cygpath_exe)) { char const* cygpath[] = { cygpath_exe.c_str(), "-w", git_dir.c_str(), 0 }; OneLineParser cygpath_out(this, "cygpath-out> ", git_dir_line); @@ -249,7 +249,7 @@ bool cmCTestGIT::UpdateImpl() if (this->GetGitVersion() < cmCTestGITVersion(1, 6, 5, 0)) { recursive = nullptr; // No need to require >= 1.6.5 if there are no submodules. - if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) { + if (cmSystemTools::FileExists(top_dir + "/.gitmodules")) { this->Log << "Git < 1.6.5 cannot update submodules recursively\n"; } } @@ -258,7 +258,7 @@ bool cmCTestGIT::UpdateImpl() if (this->GetGitVersion() < cmCTestGITVersion(1, 8, 1, 0)) { sync_recursive = nullptr; // No need to require >= 1.8.1 if there are no submodules. - if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) { + if (cmSystemTools::FileExists(top_dir + "/.gitmodules")) { this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n"; } } @@ -553,15 +553,15 @@ private: void DoHeaderLine() { // Look for header fields that we need. - if (cmHasLiteralPrefix(this->Line.c_str(), "commit ")) { + if (cmHasLiteralPrefix(this->Line, "commit ")) { this->Rev.Rev = this->Line.c_str() + 7; - } else if (cmHasLiteralPrefix(this->Line.c_str(), "author ")) { + } else if (cmHasLiteralPrefix(this->Line, "author ")) { Person author; this->ParsePerson(this->Line.c_str() + 7, author); this->Rev.Author = author.Name; this->Rev.EMail = author.EMail; this->Rev.Date = this->FormatDateTime(author); - } else if (cmHasLiteralPrefix(this->Line.c_str(), "committer ")) { + } else if (cmHasLiteralPrefix(this->Line, "committer ")) { Person committer; this->ParsePerson(this->Line.c_str() + 10, committer); this->Rev.Committer = committer.Name; diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 07dd2f5..30f76a9 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -377,11 +377,10 @@ void cmCTestLaunch::WriteXMLAction(cmXMLWriter& xml) cmSystemTools::ConvertToUnixSlashes(source); // If file is in source tree use its relative location. - if (cmSystemTools::FileIsFullPath(this->SourceDir.c_str()) && - cmSystemTools::FileIsFullPath(source.c_str()) && + if (cmSystemTools::FileIsFullPath(this->SourceDir) && + cmSystemTools::FileIsFullPath(source) && cmSystemTools::IsSubDirectory(source, this->SourceDir)) { - source = - cmSystemTools::RelativePath(this->SourceDir.c_str(), source.c_str()); + source = cmSystemTools::RelativePath(this->SourceDir, source); } xml.Element("SourceFile", source); @@ -629,8 +628,7 @@ void cmCTestLaunch::LoadConfig() cmMakefile mf(&gg, cm.GetCurrentSnapshot()); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; - if (cmSystemTools::FileExists(fname.c_str()) && - mf.ReadListFile(fname.c_str())) { + if (cmSystemTools::FileExists(fname) && mf.ReadListFile(fname.c_str())) { this->SourceDir = mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY"); cmSystemTools::ConvertToUnixSlashes(this->SourceDir); } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 84151e8..cb1d947 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -163,7 +163,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand( std::string index; std::ostringstream stream; std::string memcheckcommand = - cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str()); + cmSystemTools::ConvertToOutputPath(this->MemoryTester); stream << test; index = stream.str(); for (std::string arg : this->MemoryTesterDynamicOptions) { @@ -426,7 +426,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTester.clear(); // Setup the command if (cmSystemTools::FileExists( - this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str())) { + this->CTest->GetCTestConfiguration("MemoryCheckCommand"))) { this->MemoryTester = this->CTest->GetCTestConfiguration("MemoryCheckCommand"); std::string testerName = @@ -443,17 +443,15 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN; } } else if (cmSystemTools::FileExists( - this->CTest->GetCTestConfiguration("PurifyCommand").c_str())) { + this->CTest->GetCTestConfiguration("PurifyCommand"))) { this->MemoryTester = this->CTest->GetCTestConfiguration("PurifyCommand"); this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; } else if (cmSystemTools::FileExists( - this->CTest->GetCTestConfiguration("ValgrindCommand") - .c_str())) { + this->CTest->GetCTestConfiguration("ValgrindCommand"))) { this->MemoryTester = this->CTest->GetCTestConfiguration("ValgrindCommand"); this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; } else if (cmSystemTools::FileExists( - this->CTest->GetCTestConfiguration("BoundsCheckerCommand") - .c_str())) { + this->CTest->GetCTestConfiguration("BoundsCheckerCommand"))) { this->MemoryTester = this->CTest->GetCTestConfiguration("BoundsCheckerCommand"); this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; @@ -537,9 +535,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .empty()) { - if (!cmSystemTools::FileExists( - this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") - .c_str())) { + if (!cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile"))) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find memory checker suppression file: " << this->CTest->GetCTestConfiguration( @@ -560,9 +557,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() #ifdef _WIN32 if (this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .size()) { - if (!cmSystemTools::FileExists( - this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") - .c_str())) { + if (!cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile"))) { cmCTestLog( this->CTest, ERROR_MESSAGE, "Cannot find memory checker suppression file: " @@ -1093,7 +1089,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames( files = g.GetFiles(); return; } - } else if (!cmSystemTools::FileExists(ofile.c_str())) { + } else if (!cmSystemTools::FileExists(ofile)) { std::string log = "Cannot find memory tester output file: " + ofile; cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); ofile.clear(); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index eee9b6c..50c2d86 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -413,7 +413,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() PropertiesMap temp = this->Properties; - if (cmSystemTools::FileExists(fname.c_str())) { + if (cmSystemTools::FileExists(fname)) { cmsys::ifstream fin; fin.open(fname.c_str()); @@ -466,7 +466,7 @@ void cmCTestMultiProcessHandler::ReadCostData() { std::string fname = this->CTest->GetCostDataFile(); - if (cmSystemTools::FileExists(fname.c_str(), true)) { + if (cmSystemTools::FileExists(fname, true)) { cmsys::ifstream fin; fin.open(fname.c_str()); std::string line; @@ -741,7 +741,7 @@ void cmCTestMultiProcessHandler::CheckResume() std::string fname = this->CTest->GetBinaryDir() + "/Testing/Temporary/CTestCheckpoint.txt"; if (this->CTest->GetFailover()) { - if (cmSystemTools::FileExists(fname.c_str(), true)) { + if (cmSystemTools::FileExists(fname, true)) { *this->TestHandler->LogFile << "Resuming previously interrupted test set" << std::endl << "----------------------------------------------------------" @@ -756,7 +756,7 @@ void cmCTestMultiProcessHandler::CheckResume() } fin.close(); } - } else if (cmSystemTools::FileExists(fname.c_str(), true)) { + } else if (cmSystemTools::FileExists(fname, true)) { cmSystemTools::RemoveFile(fname); } } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 8d602fa..30ad38c 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -467,7 +467,7 @@ bool cmCTestRunTest::StartTest(size_t total) // Check if all required files exist for (std::string const& file : this->TestProperties->RequiredFiles) { - if (!cmSystemTools::FileExists(file.c_str())) { + if (!cmSystemTools::FileExists(file)) { // Required file was not found this->TestProcess = cm::make_unique<cmProcess>(*this); *this->TestHandler->LogFile << "Unable to find required file: " << file @@ -537,7 +537,7 @@ void cmCTestRunTest::ComputeArguments() ++j; // skip the executable (it will be actualCommand) } std::string testCommand = - cmSystemTools::ConvertToOutputPath(this->ActualCommand.c_str()); + cmSystemTools::ConvertToOutputPath(this->ActualCommand); // Prepends memcheck args to our command string this->TestHandler->GenerateTestCommand(this->Arguments, this->Index); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 759b695..e0bffd4 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -327,7 +327,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) script_arg = total_script_arg.substr(comma_pos + 1); } // make sure the file exists - if (!cmSystemTools::FileExists(script.c_str())) { + if (!cmSystemTools::FileExists(script)) { cmSystemTools::Error("Cannot find file: ", script.c_str()); return 1; } @@ -598,7 +598,7 @@ int cmCTestScriptHandler::CheckOutSourceDir() int retVal; bool res; - if (!cmSystemTools::FileExists(this->SourceDir.c_str()) && + if (!cmSystemTools::FileExists(this->SourceDir) && !this->CVSCheckOut.empty()) { // we must now checkout the src dir output.clear(); @@ -630,10 +630,10 @@ int cmCTestScriptHandler::BackupDirectories() // backup the binary and src directories if requested if (this->Backup) { // if for some reason those directories exist then first delete them - if (cmSystemTools::FileExists(this->BackupSourceDir.c_str())) { + if (cmSystemTools::FileExists(this->BackupSourceDir)) { cmSystemTools::RemoveADirectory(this->BackupSourceDir); } - if (cmSystemTools::FileExists(this->BackupBinaryDir.c_str())) { + if (cmSystemTools::FileExists(this->BackupBinaryDir)) { cmSystemTools::RemoveADirectory(this->BackupBinaryDir); } @@ -716,9 +716,9 @@ int cmCTestScriptHandler::RunConfigurationDashboard() } // make sure the binary directory exists if it isn't the srcdir - if (!cmSystemTools::FileExists(this->BinaryDir.c_str()) && + if (!cmSystemTools::FileExists(this->BinaryDir) && this->SourceDir != this->BinaryDir) { - if (!cmSystemTools::MakeDirectory(this->BinaryDir.c_str())) { + if (!cmSystemTools::MakeDirectory(this->BinaryDir)) { cmSystemTools::Error("Unable to create the binary directory:\n", this->BinaryDir.c_str()); this->RestoreBackupDirectories(); @@ -782,7 +782,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() if (!this->CMOutFile.empty()) { std::string cmakeOutputFile = this->CMOutFile; - if (!cmSystemTools::FileIsFullPath(cmakeOutputFile.c_str())) { + if (!cmSystemTools::FileIsFullPath(cmakeOutputFile)) { cmakeOutputFile = this->BinaryDir + "/" + cmakeOutputFile; } @@ -876,10 +876,10 @@ void cmCTestScriptHandler::RestoreBackupDirectories() // the backed up dirs if (this->Backup) { // if for some reason those directories exist then first delete them - if (cmSystemTools::FileExists(this->SourceDir.c_str())) { + if (cmSystemTools::FileExists(this->SourceDir)) { cmSystemTools::RemoveADirectory(this->SourceDir); } - if (cmSystemTools::FileExists(this->BinaryDir.c_str())) { + if (cmSystemTools::FileExists(this->BinaryDir)) { cmSystemTools::RemoveADirectory(this->BinaryDir); } // rename the src and binary directories @@ -918,7 +918,7 @@ bool cmCTestScriptHandler::EmptyBinaryDirectory(const char* sname) std::string check = sname; check += "/CMakeCache.txt"; - if (!cmSystemTools::FileExists(check.c_str())) { + if (!cmSystemTools::FileExists(check)) { return false; } diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 1794ca6..34adb4a 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -229,7 +229,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) } if (this->ArgumentDoing == ArgumentDoingFiles) { - if (cmSystemTools::FileExists(arg.c_str())) { + if (cmSystemTools::FileExists(arg)) { this->Files.insert(arg); } else { std::ostringstream e; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1ce2b6f..08d05c8 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -194,13 +194,13 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); std::string local_file = file; - if (!cmSystemTools::FileExists(local_file.c_str())) { + if (!cmSystemTools::FileExists(local_file)) { local_file = localprefix + "/" + file; } std::string upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(file); - if (!cmSystemTools::FileExists(local_file.c_str())) { + if (!cmSystemTools::FileExists(local_file)) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); ::curl_easy_cleanup(curl); @@ -387,7 +387,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); std::string local_file = file; - if (!cmSystemTools::FileExists(local_file.c_str())) { + if (!cmSystemTools::FileExists(local_file)) { local_file = localprefix + "/" + file; } std::string remote_file = @@ -429,7 +429,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5); } - if (!cmSystemTools::FileExists(local_file.c_str())) { + if (!cmSystemTools::FileExists(local_file)) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); ::curl_easy_cleanup(curl); @@ -772,7 +772,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command, std::string lfname = localprefix; cmSystemTools::ConvertToUnixSlashes(lfname); lfname += "/" + file; - lfname = cmSystemTools::ConvertToOutputPath(lfname.c_str()); + lfname = cmSystemTools::ConvertToOutputPath(lfname); argv[1] = lfname.c_str(); std::string rfname = url + "/" + remoteprefix + file; argv[2] = rfname.c_str(); @@ -898,7 +898,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( xmlrpc_value* result; std::string local_file = file; - if (!cmSystemTools::FileExists(local_file.c_str())) { + if (!cmSystemTools::FileExists(local_file)) { local_file = localprefix + "/" + file; } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 7bbf8dc..84d8926 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -70,7 +70,7 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args, for (std::string const& arg : args) { std::string fname; - if (cmSystemTools::FileIsFullPath(arg.c_str())) { + if (cmSystemTools::FileIsFullPath(arg)) { fname = arg; } else { fname = cwd; @@ -145,7 +145,7 @@ bool cmCTestAddSubdirectoryCommand::InitialPass( fname += "/"; fname += args[0]; - if (!cmSystemTools::FileExists(fname.c_str())) { + if (!cmSystemTools::FileExists(fname)) { // No subdirectory? So what... return true; } @@ -1576,7 +1576,7 @@ std::string cmCTestTestHandler::FindExecutable( // now look in the paths we specified above for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) { // first check without exe extension - if (cmSystemTools::FileExists(attempted[ai].c_str()) && + if (cmSystemTools::FileExists(attempted[ai]) && !cmSystemTools::FileIsDirectory(attempted[ai])) { fullPath = cmSystemTools::CollapseFullPath(attempted[ai]); resultingConfig = attemptedConfigs[ai]; @@ -1586,7 +1586,7 @@ std::string cmCTestTestHandler::FindExecutable( failed.push_back(attempted[ai]); tempPath = attempted[ai]; tempPath += cmSystemTools::GetExecutableExtension(); - if (cmSystemTools::FileExists(tempPath.c_str()) && + if (cmSystemTools::FileExists(tempPath) && !cmSystemTools::FileIsDirectory(tempPath)) { fullPath = cmSystemTools::CollapseFullPath(tempPath); resultingConfig = attemptedConfigs[ai]; @@ -1822,7 +1822,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() std::string lastTestsFailedLog = this->CTest->GetBinaryDir() + "/Testing/Temporary/" + logName; - if (!cmSystemTools::FileExists(lastTestsFailedLog.c_str())) { + if (!cmSystemTools::FileExists(lastTestsFailedLog)) { if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) { cmCTestLog(this->CTest, ERROR_MESSAGE, lastTestsFailedLog << " does not exist!" << std::endl); @@ -1935,7 +1935,7 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml, } else if (measurementfile.find(cxml)) { const std::string& filename = cmCTest::CleanString(measurementfile.match(5)); - if (cmSystemTools::FileExists(filename.c_str())) { + if (cmSystemTools::FileExists(filename)) { long len = cmSystemTools::FileLength(filename); if (len == 0) { std::string k1 = measurementfile.match(1); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 809abd1..504b210 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -257,37 +257,37 @@ int cmCTestUpdateHandler::DetectVCS(const char* dir) "Check directory: " << sourceDirectory << std::endl, this->Quiet); sourceDirectory += "/.svn"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_SVN; } sourceDirectory = dir; sourceDirectory += "/CVS"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_CVS; } sourceDirectory = dir; sourceDirectory += "/.bzr"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_BZR; } sourceDirectory = dir; sourceDirectory += "/.git"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_GIT; } sourceDirectory = dir; sourceDirectory += "/.hg"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_HG; } sourceDirectory = dir; sourceDirectory += "/.p4"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_P4; } sourceDirectory = dir; sourceDirectory += "/.p4config"; - if (cmSystemTools::FileExists(sourceDirectory.c_str())) { + if (cmSystemTools::FileExists(sourceDirectory)) { return cmCTestUpdateHandler::e_P4; } return cmCTestUpdateHandler::e_UNKNOWN; diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index d85f35f..ec78c1e 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -51,7 +51,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) return true; } if (this->ArgumentDoing == ArgumentDoingFiles) { - if (cmSystemTools::FileExists(arg.c_str())) { + if (cmSystemTools::FileExists(arg)) { this->Files.insert(arg); return true; } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index fd7f37a..13fa6e1 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -47,7 +47,7 @@ bool cmCTestVC::InitialCheckout(const char* command) std::string parent = cmSystemTools::GetFilenamePath(this->SourceDirectory); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Perform checkout in directory: " << parent << "\n"); - if (!cmSystemTools::MakeDirectory(parent.c_str())) { + if (!cmSystemTools::MakeDirectory(parent)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create directory: " << parent << std::endl); return false; diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 61ce7d4..5bb6424 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -83,7 +83,7 @@ protected: // binary directories. for (std::string const& filePath : FilePaths) { finalpath = filePath + "/" + filename; - if (cmSystemTools::FileExists(finalpath.c_str())) { + if (cmSystemTools::FileExists(finalpath)) { this->CurFileName = finalpath; break; } |