summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-31 02:38:50 +0200
committerCarl Hetherington <cth@carlh.net>2025-09-15 15:26:35 +0200
commit7cb07bcec10bfdfed3e82a2dc138114dc6a5ac68 (patch)
treefcc7b8bca794aaa3df5b81f4ad22af272628ee9c /src/util.cc
parent11a3284c65b94960ef1e2ad819ccc22e97aa9454 (diff)
Allow hash to pass data to some function.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util.cc b/src/util.cc
index 11fcda27..1942686a 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -117,7 +117,7 @@ dcp::make_digest (ArrayData data)
string
-dcp::make_digest(boost::filesystem::path filename, function<void (int64_t, int64_t)> progress)
+dcp::make_digest(boost::filesystem::path filename, function<void (int64_t, int64_t)> progress, function<void (int64_t offset, uint8_t const* buffer, int size)> check)
{
Kumu::FileReader reader;
auto r = reader.OpenRead(dcp::filesystem::fix_long_path(filename).string().c_str());
@@ -143,6 +143,10 @@ dcp::make_digest(boost::filesystem::path filename, function<void (int64_t, int64
boost::throw_exception (FileError("could not read file to compute digest", filename, r));
}
+ if (check) {
+ check(done, read_buffer.Data(), read);
+ }
+
SHA1_Update (&sha, read_buffer.Data(), read);
if (progress) {