summaryrefslogtreecommitdiffstats
path: root/applypatch/imgpatch.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Implement a custom deflate sink function for bspatchTianjie Xu2017-05-261-58/+86
| | | | | | | | | This new sink function works as a wrapper of the old sink. It deflates the available patch data on the fly. Therefore, we don't need to store the full uncompressed patch data in memory. Test: recovery_component_test && apply an incremental update on angler Change-Id: I2274ec50a1607089abcc9d0954a2a748f28c3122
* Print SHA1 of the patch if bsdiff fails with data errorTianjie Xu2017-05-161-6/+8
| | | | | | | | | | | | | | This will help us to identify the patch corruption. Meanwhile fix a wrong size parameter passed to bspatch. (patch->data.size() into patch->data.size() - patch_offset). Also remove the only usage of "ApplyBSDiffPatchMem()" and inline its Sink function for simplicity. Bug: 37855643 Test: Prints SHA1 for corrupted patch in imgdiff_test. Change-Id: Ibf2db8c08b0ded1409bb7c91a3547a6bf99c601d
* applypatch: Add determine the return value of ApplyDiffPatch andJinguang Dong2017-04-261-1/+4
| | | | | | | | | | | capture the error flow. Construct ota package which is bsdiff exception scene ,then do simulation test, native code can not capture exception scenes. Test: recovery_component_test Test: Apply an bsdiff exception scene ota package. Change-Id: Icd9f6eac78739bd35c74b9fcaaf8154335d680a5
* applypatch: Let Apply{BSDiff,Image}Patch accept std::function.Tao Bao2017-03-281-7/+6
| | | | | | Test: mmma bootable/recovery system/update_engine Test: recovery_component_test Change-Id: I93c2caa87bf94a53509bb37f98f2c02bcadb6f5c
* applypatch: Change the ssize_t length parameters to size_t.Tao Bao2017-03-281-9/+8
| | | | | | | | | | | | | | | | | Mostly for applypatch family APIs like ApplyBSDiffPatch() and ApplyImagePatch(). Changing to size_t doesn't indicate they would necessarily work with very large size_t (e.g. > ssize_t), just similar to write(2). But otherwise accepting negative length doesn't make much sense. Also change the return type of SinkFn from ssize_t to size_t. Callers tell a successful sink by comparing the number of written bytes against the desired value. Negative return values like -1 are not needed. This also makes it consistent with bsdiff::bspatch interface. Test: recovery_component_test Test: Apply an incremental with the new updater. Change-Id: I7ff1615203a5c9854134f75d019e266f4ea6e714
* More cleanup to imgdiff & imgpatchTianjie Xu2017-03-161-9/+16
| | | | | | | | Also remove the utils in applypatch and replace them with the corresponding libbase functions. Test: recovery tests pass. Change-Id: I77254c141bd3e7d3d6894c23b60e866009516f81
* Use bspatch from external/bsdiff.Sen Jiang2017-02-021-0/+3
| | | | | | | | | | Now ApplyBSDiffPatch() will stream the output to sink as we go instead of sinking everything at the end. Test: recovery_host_test Bug: 26982501 Change-Id: I05b6ed40d45e4b1b19ae72784cf705b731b976e3
* imgpatch: Compile with ZLIB_CONST defined.Tao Bao2017-01-201-1/+1
| | | | | | | So z_stream.next_in takes pointer to const data. Test: mmma bootable/recovery/applypatch Change-Id: If269b766a7c84fa2f67424ee61ba5afab0159261
* Add tests for imgdiff.Tao Bao2016-12-201-205/+200
| | | | | | | | | | | | Factor out libimgdiff static library for testing purpose. This CL adds the imgdiff tests on host and on target both (similar to libimgpatch). In practice, we only need imgdiff binary on host, and libimgpatch on target. But they should build and pass tests on both platforms. Test: recovery_host_test passes; recovery_component_test passes. Change-Id: I0eafb7faf727cdf70066310e845af6ee245d4f60
* Change StringValue to use std::stringTianjie Xu2016-10-151-22/+22
| | | | | | | | | | | Changing the field of 'Value' in edify to std::string from char*. Meanwhile cleaning up the users of 'Value' and switching them to cpp style. Test: compontent tests passed. Bug: 31713288 Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
* resolve merge conflicts of 490fad6 to nyc-dev-plus-aospTao Bao2016-06-141-57/+66
|\ | | | | | | Change-Id: I299fe15977c1a59d0c784728872c3a7f63c95e56
| * applypatch: Don't call inflate() when it expects zero-length output.Tao Bao2016-06-141-57/+66
| | | | | | | | | | | | | | | | | | We may have expanded_len == 0 when calling inflate(). After switching to using std::vector, it passes a nullptr buffer to inflate() and leads to Z_STREAM_ERROR. Bug: 29312140 Change-Id: Iab7c6c07a9e8488e844e7cdda76d02bd60d2ea98
* | Fix google-runtime-int warnings.Chih-Hung Hsieh2016-04-181-2/+2
| | | | | | | | | | Bug: 28220065 Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
* | Fix the improper use of LOCAL_WHOLE_STATIC_LIBRARIES.Tao Bao2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | If two libraries both use LOCAL_WHOLE_STATIC_LIBRARIES and include a same library, there would be linking errors when generating a shared library (or executable) that depends on the two libraries both. Also clean up Android.mk files. Remove the "LOCAL_MODULE_TAGS := eng" line for the updater module. The module will then default to "optional" which won't be built until needed. Change-Id: I3ec227109b8aa744b7568e7f82f575aae3fe0e6f
* | applypatch: Add a Makefile to build imgdiff in Chrome OS.Sen Jiang2016-02-101-0/+6
|/ | | | | | | | | Also fixed some warnings and added check for target_len. Test: mma; emerge-peppy imgdiff; emerge-nyan imgdiff; sudo emerge imgdiff Bug: 26866274 Change-Id: Ifbcd3afd6701c769ccf626e33ed94461706f7ee6
* applypatch: fix memory leaks reported by static analysis.Yabin Cui2016-02-051-34/+22
| | | | | Bug: 26906416 Change-Id: I163df5a8f3abda3ba5d4ed81dfc8567054eceb27
* Switch from mincrypt to BoringSSL in applypatch and updater.Sen Jiang2016-02-041-3/+3
| | | | | Bug: 18790686 Change-Id: I7d2136fb39b2266f5ae5be24819c617b08a6c21e
* applypatch: Compile libimgpatch for target and host.Sen Jiang2016-01-281-1/+19
| | | | | | | | | | | | | update_engine need it for the new IMGDIFF operation. Also removed __unused in ApplyImagePatch() as I got error building it for the host, and I think it's dangerous not checking the size of the input. Test: mma Bug: 26628339 Change-Id: I22d4cd55c2c3f87697d6afdf10e8106fef7d1a9c
* recovery: Switch applypatch/ and updater/ to cpp.Tao Bao2015-07-141-0/+234
Mostly trivial changes to make cpp compiler happy. Change-Id: I69bd1d96fcccf506007f6144faf37e11cfba1270