summaryrefslogtreecommitdiffstats
path: root/applypatch/applypatch.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-04-20 20:19:59 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-04-20 20:19:59 +0200
commit73edea3e67ca22b93217d97605a18d2d0a267483 (patch)
tree32edc2048c063f83a95467274f8b2d1cc1d9dd27 /applypatch/applypatch.cpp
parentMerge "applypatch: Dump patch info on mismatching patching result." am: d2c32b281b am: ea70fd7d1d (diff)
parentMerge "applypatch: Drop the SHA_CTX parameter in Apply{BSDiff,Image}Patch." am: bcb015239c (diff)
downloadandroid_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.tar
android_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.tar.gz
android_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.tar.bz2
android_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.tar.lz
android_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.tar.xz
android_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.tar.zst
android_bootable_recovery-73edea3e67ca22b93217d97605a18d2d0a267483.zip
Diffstat (limited to '')
-rw-r--r--applypatch/applypatch.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 120add6d6..7104abd67 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -627,21 +627,20 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
// We store the decoded output in memory.
std::string memory_sink_str; // Don't need to reserve space.
- SinkFn sink = [&memory_sink_str](const unsigned char* data, size_t len) {
+ SHA_CTX ctx;
+ SHA1_Init(&ctx);
+ SinkFn sink = [&memory_sink_str, &ctx](const unsigned char* data, size_t len) {
+ SHA1_Update(&ctx, data, len);
memory_sink_str.append(reinterpret_cast<const char*>(data), len);
return len;
};
- SHA_CTX ctx;
- SHA1_Init(&ctx);
-
int result;
if (use_bsdiff) {
- result =
- ApplyBSDiffPatch(source_file.data.data(), source_file.data.size(), *patch, 0, sink, &ctx);
+ result = ApplyBSDiffPatch(source_file.data.data(), source_file.data.size(), *patch, 0, sink);
} else {
- result = ApplyImagePatch(source_file.data.data(), source_file.data.size(), *patch, sink, &ctx,
- bonus_data);
+ result =
+ ApplyImagePatch(source_file.data.data(), source_file.data.size(), *patch, sink, bonus_data);
}
if (result != 0) {