diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-08-08 01:18:10 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-08-08 17:23:55 (GMT) |
commit | 0abde043d285ff34c374a49c0211aa4b375e4c9a (patch) | |
tree | 297d8b6fdb3e2c20a4aea863113d0014b2f3e9a1 | |
parent | 4d5198a986902588271307a3837f08999c139368 (diff) | |
download | CMake-0abde043d285ff34c374a49c0211aa4b375e4c9a.zip CMake-0abde043d285ff34c374a49c0211aa4b375e4c9a.tar.gz CMake-0abde043d285ff34c374a49c0211aa4b375e4c9a.tar.bz2 |
cmCryptoHash: prefer to cmSystemTools::ComputeFileHash
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 8 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 8 |
3 files changed, 9 insertions, 11 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 34c56c9..8d16428 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -290,8 +290,8 @@ std::string DebGenerator::generateMD5File() const continue; } - std::string output = - cmSystemTools::ComputeFileHash(file, cmCryptoHash::AlgoMD5); + cmCryptoHash hasher(cmCryptoHash::AlgoMD5); + std::string output = hasher.HashFile(file); if (output.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem computing the md5 of " << file << std::endl); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 7d4b0a8..1934d8c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -285,8 +285,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( if (cmIsOn(this->GetOption("InternalTest"))) { upload_as += "ffffffffffffffffffffffffffffffff"; } else { - upload_as += - cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5); + cmCryptoHash hasher(cmCryptoHash::AlgoMD5); + upload_as += hasher.HashFile(local_file); } if (!cmSystemTools::FileExists(local_file)) { @@ -549,8 +549,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, } } - std::string md5sum = - cmSystemTools::ComputeFileHash(file, cmCryptoHash::AlgoMD5); + cmCryptoHash hasher(cmCryptoHash::AlgoMD5); + std::string md5sum = hasher.HashFile(file); // 1. request the buildid and check to see if the file // has already been uploaded // TODO I added support for subproject. You would need to add diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ce2479b..b18f5cf 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -13,6 +13,7 @@ #include "cmCommandLineArgument.h" #include "cmConsoleBuf.h" +#include "cmCryptoHash.h" #include "cmDuration.h" #include "cmGlobalGenerator.h" #include "cmList.h" @@ -1692,11 +1693,8 @@ int cmcmd::HashSumFile(std::vector<std::string> const& args, std::cerr << "Error: " << filename << " is a directory" << std::endl; retval++; } else { - std::string value -#ifndef CMAKE_BOOTSTRAP - = cmSystemTools::ComputeFileHash(filename, algo) -#endif - ; + cmCryptoHash hasher(algo); + std::string value = hasher.HashFile(filename); if (value.empty()) { // To mimic "md5sum/shasum" behavior in a shell: std::cerr << filename << ": No such file or directory" << std::endl; |