summaryrefslogtreecommitdiff
path: root/src/buildtool/crypto/hash_function.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-05 16:49:45 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-22 17:01:13 +0200
commitbeb3faa6956b9bfd58d4ea6644a9b2987409aaba (patch)
tree9a1edee40bfe335717eb856237372d50127367ac /src/buildtool/crypto/hash_function.cpp
parent30f2b4a215ebd4f9c0c491f41de6e8eb56ed3fdf (diff)
downloadjustbuild-beb3faa6956b9bfd58d4ea6644a9b2987409aaba.tar.gz
Use HashFunction functionality via Instance()
...to track changes during refactoring easier.
Diffstat (limited to 'src/buildtool/crypto/hash_function.cpp')
-rw-r--r--src/buildtool/crypto/hash_function.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/buildtool/crypto/hash_function.cpp b/src/buildtool/crypto/hash_function.cpp
index 02e43f1f..d1ca0c2b 100644
--- a/src/buildtool/crypto/hash_function.cpp
+++ b/src/buildtool/crypto/hash_function.cpp
@@ -16,20 +16,19 @@
#include <cstddef>
#include <fstream>
-#include <string>
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
[[nodiscard]] auto HashFunction::ComputeHashFile(
const std::filesystem::path& file_path,
- bool as_tree) noexcept
+ bool as_tree) const noexcept
-> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> {
static constexpr std::size_t kChunkSize{4048};
try {
auto hasher = Hasher();
auto size = std::filesystem::file_size(file_path);
- if (HashType() == JustHash::Native) {
+ if (type_ == JustHash::Native) {
hasher.Update(
(as_tree ? std::string{"tree "} : std::string{"blob "}) +
std::to_string(size) + '\0');