diff options
author | Tao Bao <tbao@google.com> | 2018-04-19 21:02:13 -0700 |
---|---|---|
committer | Tao Bao <tbao@google.com> | 2018-04-20 09:27:50 -0700 |
commit | 8b0b0f1f02f7990177e0da89eb471da2ced13f4c (patch) | |
tree | ce9cf683304b2d70ae800bb6811842b375904beb /applypatch/bspatch.cpp | |
parent | d2c32b281bf8168797dccfda9497a1b0151ff81b (diff) |
applypatch: Drop the SHA_CTX parameter in Apply{BSDiff,Image}Patch.
As they're accepting the SinkFn callback, it makes more sense to leave
the work to their callers.
Test: mmma -j bootable/recovery
Test: Run recovery_component_test on marlin.
Test: No other active user of the two functions.
Change-Id: I8d67b38ce037925442296f136b483e0c71983777
Diffstat (limited to 'applypatch/bspatch.cpp')
-rw-r--r-- | applypatch/bspatch.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/applypatch/bspatch.cpp b/applypatch/bspatch.cpp index 912dbbdd..ba33c3a9 100644 --- a/applypatch/bspatch.cpp +++ b/applypatch/bspatch.cpp @@ -66,18 +66,12 @@ void ShowBSDiffLicense() { } int ApplyBSDiffPatch(const unsigned char* old_data, size_t old_size, const Value& patch, - size_t patch_offset, SinkFn sink, SHA_CTX* ctx) { - auto sha_sink = [&sink, &ctx](const uint8_t* data, size_t len) { - len = sink(data, len); - if (ctx) SHA1_Update(ctx, data, len); - return len; - }; - + size_t patch_offset, SinkFn sink) { CHECK_LE(patch_offset, patch.data.size()); int result = bsdiff::bspatch(old_data, old_size, reinterpret_cast<const uint8_t*>(&patch.data[patch_offset]), - patch.data.size() - patch_offset, sha_sink); + patch.data.size() - patch_offset, sink); if (result != 0) { LOG(ERROR) << "bspatch failed, result: " << result; // print SHA1 of the patch in the case of a data error. |