diff options
author | Alex Deymo <deymo@google.com> | 2017-10-10 17:56:17 +0200 |
---|---|---|
committer | Alex Deymo <deymo@google.com> | 2017-10-24 14:00:31 +0200 |
commit | fa188268e43ab75732a480d6b2ec748d9d0dbfae (patch) | |
tree | 9498a723d8c244df87b8fccff1b2fb3df1873ebd /applypatch/imgdiff.cpp | |
parent | 7a3fc2de8eb535637055a4a1c0063c5fbc101c4a (diff) | |
download | android_bootable_recovery-fa188268e43ab75732a480d6b2ec748d9d0dbfae.tar.gz android_bootable_recovery-fa188268e43ab75732a480d6b2ec748d9d0dbfae.tar.bz2 android_bootable_recovery-fa188268e43ab75732a480d6b2ec748d9d0dbfae.zip |
Use SuffixArrayIndexInterface opaque type instead of the underlying data pointer.
bsdiff interface is changing such that it hides the suffix array
pointer from the public interface. This allows to use a different
suffix array data size depending on the input size, running much faster
in the normal case.
Bug: 34220646
Test: `make checkbuild`; Ran an incremental update generation on a non-A/B device.
Change-Id: I78e766da56cf28bc7774b8c8e58527bc11d919fb
Diffstat (limited to 'applypatch/imgdiff.cpp')
-rw-r--r-- | applypatch/imgdiff.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp index c887a854..ccd68dc3 100644 --- a/applypatch/imgdiff.cpp +++ b/applypatch/imgdiff.cpp @@ -161,7 +161,7 @@ #include <android-base/memory.h> #include <android-base/parseint.h> #include <android-base/unique_fd.h> -#include <bsdiff.h> +#include <bsdiff/bsdiff.h> #include <ziparchive/zip_archive.h> #include <zlib.h> @@ -322,7 +322,8 @@ void ImageChunk::MergeAdjacentNormal(const ImageChunk& other) { } bool ImageChunk::MakePatch(const ImageChunk& tgt, const ImageChunk& src, - std::vector<uint8_t>* patch_data, saidx_t** bsdiff_cache) { + std::vector<uint8_t>* patch_data, + bsdiff::SuffixArrayIndexInterface** bsdiff_cache) { #if defined(__ANDROID__) char ptemp[] = "/data/local/tmp/imgdiff-patch-XXXXXX"; #else @@ -1081,7 +1082,7 @@ bool ZipModeImage::GeneratePatchesInternal(const ZipModeImage& tgt_image, printf("Construct patches for %zu chunks...\n", tgt_image.NumOfChunks()); patch_chunks->clear(); - saidx_t* bsdiff_cache = nullptr; + bsdiff::SuffixArrayIndexInterface* bsdiff_cache = nullptr; for (size_t i = 0; i < tgt_image.NumOfChunks(); i++) { const auto& tgt_chunk = tgt_image[i]; @@ -1095,7 +1096,8 @@ bool ZipModeImage::GeneratePatchesInternal(const ZipModeImage& tgt_image, : src_image.FindChunkByName(tgt_chunk.GetEntryName()); const auto& src_ref = (src_chunk == nullptr) ? src_image.PseudoSource() : *src_chunk; - saidx_t** bsdiff_cache_ptr = (src_chunk == nullptr) ? &bsdiff_cache : nullptr; + bsdiff::SuffixArrayIndexInterface** bsdiff_cache_ptr = + (src_chunk == nullptr) ? &bsdiff_cache : nullptr; std::vector<uint8_t> patch_data; if (!ImageChunk::MakePatch(tgt_chunk, src_ref, &patch_data, bsdiff_cache_ptr)) { @@ -1112,7 +1114,7 @@ bool ZipModeImage::GeneratePatchesInternal(const ZipModeImage& tgt_image, patch_chunks->emplace_back(tgt_chunk, src_ref, std::move(patch_data)); } } - free(bsdiff_cache); + delete bsdiff_cache; CHECK_EQ(patch_chunks->size(), tgt_image.NumOfChunks()); return true; |