summaryrefslogtreecommitdiff
path: root/bz2_compressor.h
AgeCommit message (Collapse)Author
2018-03-07Modify the patch writer to use a list of compressors for each streamTianjie Xu
Switch the internal member of the patch writer from a single compressor to a list of compressors for ctrl|diff|extra streams. The change doesn't affect the functionality of the existing bz2|brotli compressors; but later allow us to try all the compressors and select the one with the best compression ratio. With this new writer, callers will be able to produce the smallest patch without calling bsdiff explictly multiple times. Test: unit tests pass Change-Id: I441ae6636e2299b2cfc9d14f50952c85585dbb4f
2017-11-16Implement a new bsdiff formatTianjie Xu
Add a new BSDF2 format that allows compression of ctrl/diff/extra streams with different algorithms. The compression algorithm supported for now is bz2 and brotli. This new format is similar to the legacy "BSDIFF40" format except for the magic headers. File format: 0 8 magic header 8 8 X 16 8 Y 24 8 new_file_size 32 X compressed control block 32+X Y compressed diff block 32+X+Y ??? compressed extra block The magic header for BSDF2 format: 0 5 BSDF2 5 1 compressed type for control stream 6 1 compressed type for diff stream 7 1 compressed type for extra stream Bug: 34220646 Test: unittest pass Change-Id: I6eb0867e88476dbc4a4b7be609783f8c8a0a41cd
2017-10-31Add the brotli compressor for bsdiffTianjie Xu
Add a new compressor interface; and the brotli compressor which is similar to the existing bz2 one. Also add a new CompressorType argument to PatchWriter's init function; this allows us to choose the right compressor based on the input option in the future. Bug: 34220646 Test: Run bsdiff/bspatch with brotli compressor/decompressor over a list of files from angler's system image. Make succeeds. Change-Id: Id9a3db2d7d051dcb751a1fc362f4c3b9226e878b
2017-09-15Refactor bsdiff patch writing code to another file.Alex Deymo
bsdiff.cc had code to handle both the sub-streams compression and the patch format. This CL moves the patch file format logic to a new class in a separated file, and the bzip2 compression to another class. This allows to replace the core bsdiff logic separatedly from the patch format. There are no changes to the functionality of bsdiff and the generated patches. The code does a bit more of memcpy() since it doesn't write the control stream to disk as it goes. Bug: 34220646 Test: Ran bsdiff and compared results with previous version. Change-Id: Ibdc1482e98cbd370cbed677c326008e19a217ef8