diff options
-rw-r--r-- | applypatch/imgdiff.cpp | 12 | ||||
-rw-r--r-- | applypatch/include/applypatch/imgdiff_image.h | 5 | ||||
-rw-r--r-- | tests/component/updater_test.cpp | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp index c887a854d..ccd68dc3e 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; diff --git a/applypatch/include/applypatch/imgdiff_image.h b/applypatch/include/applypatch/imgdiff_image.h index 491043dc1..4e915e5e7 100644 --- a/applypatch/include/applypatch/imgdiff_image.h +++ b/applypatch/include/applypatch/imgdiff_image.h @@ -24,7 +24,7 @@ #include <string> #include <vector> -#include <bsdiff.h> +#include <bsdiff/bsdiff.h> #include <ziparchive/zip_archive.h> #include <zlib.h> @@ -98,7 +98,8 @@ class ImageChunk { * repeatedly, pass nullptr if not needed. */ static bool 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); private: const uint8_t* GetRawData() const; diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp index 2a0575a31..19653ec50 100644 --- a/tests/component/updater_test.cpp +++ b/tests/component/updater_test.cpp @@ -32,7 +32,7 @@ #include <android-base/test_utils.h> #include <bootloader_message/bootloader_message.h> #include <brotli/encode.h> -#include <bsdiff.h> +#include <bsdiff/bsdiff.h> #include <gtest/gtest.h> #include <ziparchive/zip_archive.h> #include <ziparchive/zip_writer.h> |