diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 06:56:03 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 06:56:03 +0000 |
commit | 03b66fc204e8fdf7cffe9ef2bf1a82451620d581 (patch) | |
tree | 4f60cc104be3c4d98888fedc7529c8ca449fe405 | |
parent | 23cd02df99bb906d681c0f40f4603eb015792712 (diff) | |
parent | 7e486cb657c3ae0f79f77d3d0d93cb7c027919e3 (diff) | |
download | bsdiff-03b66fc204e8fdf7cffe9ef2bf1a82451620d581.tar.gz |
Snap for 8564071 from 7e486cb657c3ae0f79f77d3d0d93cb7c027919e3 to mainline-extservices-releaseaml_ext_331814220aml_ext_331412000aml_ext_331312000aml_ext_331112010aml_ext_331012020android13-mainline-extservices-release
Change-Id: I0f7431b9bf559a1a2b61c4ce8aac425f0f5f35a1
-rw-r--r-- | Android.bp | 1 | ||||
-rw-r--r-- | OWNERS | 2 | ||||
-rw-r--r-- | TEST_MAPPING | 5 | ||||
-rw-r--r-- | bspatch.cc | 2 | ||||
-rw-r--r-- | include/bsdiff/compressor_interface.h (renamed from compressor_interface.h) | 0 | ||||
-rw-r--r-- | include/bsdiff/control_entry.h | 15 | ||||
-rw-r--r-- | include/bsdiff/decompressor_interface.h (renamed from decompressor_interface.h) | 0 | ||||
-rw-r--r-- | include/bsdiff/file.h (renamed from file.h) | 0 | ||||
-rw-r--r-- | include/bsdiff/memory_file.h (renamed from memory_file.h) | 0 | ||||
-rw-r--r-- | include/bsdiff/patch_reader.h (renamed from patch_reader.h) | 0 | ||||
-rw-r--r-- | include/bsdiff/patch_writer.h (renamed from patch_writer.h) | 9 | ||||
-rw-r--r-- | patch_reader.cc | 2 | ||||
-rw-r--r-- | patch_writer.cc | 7 | ||||
-rw-r--r-- | suffix_array_index.cc | 1 |
14 files changed, 28 insertions, 16 deletions
@@ -73,6 +73,7 @@ cc_library_static { cc_library_static { name: "libbsdiff", + recovery_available: true, defaults: ["bsdiff_defaults"], srcs: [ @@ -1,3 +1,5 @@ deymo@google.com senj@google.com xunchang@google.com +zhangkelvin@google.com + diff --git a/TEST_MAPPING b/TEST_MAPPING index 598f4c9..570788d 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -3,5 +3,10 @@ { "name": "bsdiff_unittest" } + ], + "hwasan-postsubmit": [ + { + "name": "bsdiff_unittest" + } ] } @@ -33,8 +33,8 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59: #include <errno.h> #include <fcntl.h> #include <inttypes.h> -#include <stdio.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> diff --git a/compressor_interface.h b/include/bsdiff/compressor_interface.h index c0ff18d..c0ff18d 100644 --- a/compressor_interface.h +++ b/include/bsdiff/compressor_interface.h diff --git a/include/bsdiff/control_entry.h b/include/bsdiff/control_entry.h index 2c849f6..3d2d96c 100644 --- a/include/bsdiff/control_entry.h +++ b/include/bsdiff/control_entry.h @@ -8,23 +8,24 @@ #include <stdint.h> struct ControlEntry { - ControlEntry(uint64_t diff_size, - uint64_t extra_size, - int64_t offset_increment) + constexpr ControlEntry(uint64_t diff_size, + uint64_t extra_size, + int64_t offset_increment) : diff_size(diff_size), extra_size(extra_size), offset_increment(offset_increment) {} + constexpr ControlEntry() = default; // The number of bytes to copy from the source and diff stream. - uint64_t diff_size; + uint64_t diff_size{0}; // The number of bytes to copy from the extra stream. - uint64_t extra_size; + uint64_t extra_size{0}; // The value to add to the source pointer after patching from the diff stream. - int64_t offset_increment; + int64_t offset_increment{0}; - bool operator==(const ControlEntry& o) const { + [[nodiscard]] bool operator==(const ControlEntry& o) const { return diff_size == o.diff_size && extra_size == o.extra_size && offset_increment == o.offset_increment; } diff --git a/decompressor_interface.h b/include/bsdiff/decompressor_interface.h index 46ee444..46ee444 100644 --- a/decompressor_interface.h +++ b/include/bsdiff/decompressor_interface.h diff --git a/file.h b/include/bsdiff/file.h index 959c53e..959c53e 100644 --- a/file.h +++ b/include/bsdiff/file.h diff --git a/memory_file.h b/include/bsdiff/memory_file.h index 4100fd6..4100fd6 100644 --- a/memory_file.h +++ b/include/bsdiff/memory_file.h diff --git a/patch_reader.h b/include/bsdiff/patch_reader.h index fe0451b..fe0451b 100644 --- a/patch_reader.h +++ b/include/bsdiff/patch_reader.h diff --git a/patch_writer.h b/include/bsdiff/patch_writer.h index 8ad4cde..6d2bcf5 100644 --- a/patch_writer.h +++ b/include/bsdiff/patch_writer.h @@ -14,6 +14,15 @@ namespace bsdiff { + +constexpr void EncodeInt64(int64_t x, uint8_t* buf) { + uint64_t y = x < 0 ? (1ULL << 63ULL) - x : x; + for (int i = 0; i < 8; ++i) { + buf[i] = y & 0xff; + y /= 256; + } +} + // A PatchWriterInterface class with three compressors and a 32-byte header. class BsdiffPatchWriter : public PatchWriterInterface { public: diff --git a/patch_reader.cc b/patch_reader.cc index e863b9a..6d317f3 100644 --- a/patch_reader.cc +++ b/patch_reader.cc @@ -32,7 +32,7 @@ bool BsdiffPatchReader::Init(const uint8_t* patch_data, size_t patch_size) { // extra block; seek forwards in oldfile by z bytes". if (patch_size < 32) { - LOG(ERROR) << "Too small to be a bspatch."; + LOG(ERROR) << "Too small to be a bspatch. " << patch_size; return false; } // Check for appropriate magic. diff --git a/patch_writer.cc b/patch_writer.cc index 52982e0..b7d9b08 100644 --- a/patch_writer.cc +++ b/patch_writer.cc @@ -15,13 +15,6 @@ namespace { -void EncodeInt64(int64_t x, uint8_t* buf) { - uint64_t y = x < 0 ? (1ULL << 63ULL) - x : x; - for (int i = 0; i < 8; ++i) { - buf[i] = y & 0xff; - y /= 256; - } -} } // namespace diff --git a/suffix_array_index.cc b/suffix_array_index.cc index b02655c..710249c 100644 --- a/suffix_array_index.cc +++ b/suffix_array_index.cc @@ -4,6 +4,7 @@ #include "bsdiff/suffix_array_index.h" +#include <algorithm> #include <limits> #include <vector> |