Skip to content

Commit 9372964

Browse files
committed
Always specify number of bytes to return
1 parent 1f6be9b commit 9372964

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

include/boost/crypt2/hash/detail/hash_file.hpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
#include <boost/crypt2/detail/concepts.hpp>
1414
#include <boost/crypt2/detail/compat.hpp>
1515

16-
#if !defined(BOOST_CRYPT_BUILD_MODULE)
17-
#include <limits>
18-
#endif
19-
2016
namespace boost::crypt::hash_detail {
2117

2218
// Error: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Werror,-Wunsafe-buffer-usage-in-container]
@@ -54,7 +50,7 @@ template <typename HasherType, concepts::file_system_path T>
5450
}
5551

5652
template <typename HasherType, concepts::file_system_path T>
57-
[[nodiscard]] auto hash_file_impl(const T& filepath, std::span<std::byte> out, std::size_t amount = std::numeric_limits<std::size_t>::max()) -> state
53+
[[nodiscard]] auto hash_file_impl(const T& filepath, std::span<std::byte> out, std::size_t amount) -> state
5854
{
5955
if constexpr (std::is_pointer_v<std::remove_cvref_t<T>>)
6056
{
@@ -76,15 +72,7 @@ template <typename HasherType, concepts::file_system_path T>
7672
}
7773

7874
hasher.finalize();
79-
80-
if (amount == std::numeric_limits<std::size_t>::max())
81-
{
82-
return hasher.get_digest(out);
83-
}
84-
else
85-
{
86-
return hasher.get_digest(out, amount);
87-
}
75+
return hasher.get_digest(out, amount);
8876
}
8977

9078
#if defined(__clang__) && __clang_major__ >= 19

0 commit comments

Comments
 (0)