diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2016-05-06 00:35:43 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-05-06 00:35:43 +0200 |
commit | 704cac2f997dd45573593b00e2a266b06e2cc318 (patch) | |
tree | 8526a2538cdf782bb23de6d0b648448b91d93867 /applypatch/imgdiff.cpp | |
parent | Merge "recovery: Always log the update attempt." (diff) | |
parent | applypatch: Use bsdiff from external/bsdiff. (diff) | |
download | android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.tar android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.tar.gz android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.tar.bz2 android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.tar.lz android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.tar.xz android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.tar.zst android_bootable_recovery-704cac2f997dd45573593b00e2a266b06e2cc318.zip |
Diffstat (limited to 'applypatch/imgdiff.cpp')
-rw-r--r-- | applypatch/imgdiff.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp index 2aa4a6862..7c5bb866d 100644 --- a/applypatch/imgdiff.cpp +++ b/applypatch/imgdiff.cpp @@ -130,6 +130,8 @@ #include <unistd.h> #include <sys/types.h> +#include <bsdiff.h> + #include "zlib.h" #include "imgdiff.h" #include "utils.h" @@ -144,8 +146,6 @@ typedef struct { size_t source_start; size_t source_len; - off_t* I; // used by bsdiff - // --- for CHUNK_DEFLATE chunks only: --- // original (compressed) deflate data @@ -179,10 +179,6 @@ static int fileentry_compare(const void* a, const void* b) { } } -// from bsdiff.c -int bsdiff(u_char* old, off_t oldsize, off_t** IP, u_char* newdata, off_t newsize, - const char* patch_filename); - unsigned char* ReadZip(const char* filename, int* num_chunks, ImageChunk** chunks, int include_pseudo_chunk) { @@ -296,7 +292,6 @@ unsigned char* ReadZip(const char* filename, curr->len = st.st_size; curr->data = img; curr->filename = NULL; - curr->I = NULL; ++curr; ++*num_chunks; } @@ -311,7 +306,6 @@ unsigned char* ReadZip(const char* filename, curr->deflate_len = temp_entries[nextentry].deflate_len; curr->deflate_data = img + pos; curr->filename = temp_entries[nextentry].filename; - curr->I = NULL; curr->len = temp_entries[nextentry].uncomp_len; curr->data = reinterpret_cast<unsigned char*>(malloc(curr->len)); @@ -356,7 +350,6 @@ unsigned char* ReadZip(const char* filename, } curr->data = img + pos; curr->filename = NULL; - curr->I = NULL; pos += curr->len; ++*num_chunks; @@ -424,7 +417,6 @@ unsigned char* ReadImage(const char* filename, curr->type = CHUNK_NORMAL; curr->len = GZIP_HEADER_LEN; curr->data = p; - curr->I = NULL; pos += curr->len; p += curr->len; @@ -432,7 +424,6 @@ unsigned char* ReadImage(const char* filename, curr->type = CHUNK_DEFLATE; curr->filename = NULL; - curr->I = NULL; // We must decompress this chunk in order to discover where it // ends, and so we can put the uncompressed data and its length @@ -491,7 +482,6 @@ unsigned char* ReadImage(const char* filename, curr->start = pos; curr->len = GZIP_FOOTER_LEN; curr->data = img+pos; - curr->I = NULL; pos += curr->len; p += curr->len; @@ -515,7 +505,6 @@ unsigned char* ReadImage(const char* filename, *chunks = reinterpret_cast<ImageChunk*>(realloc(*chunks, *num_chunks * sizeof(ImageChunk))); ImageChunk* curr = *chunks + (*num_chunks-1); curr->start = pos; - curr->I = NULL; // 'pos' is not the offset of the start of a gzip chunk, so scan // forward until we find a gzip header. @@ -642,7 +631,7 @@ unsigned char* MakePatch(ImageChunk* src, ImageChunk* tgt, size_t* size) { close(fd); // temporary file is created and we don't need its file // descriptor - int r = bsdiff(src->data, src->len, &(src->I), tgt->data, tgt->len, ptemp); + int r = bsdiff::bsdiff(src->data, src->len, tgt->data, tgt->len, ptemp); if (r != 0) { printf("bsdiff() failed: %d\n", r); return NULL; |