diff options
author | Samuel Huang <huangs@chromium.org> | 2018-03-28 22:20:09 +0000 |
---|---|---|
committer | Edward Lesmes <ehmaldonado@google.com> | 2021-07-23 22:00:41 +0000 |
commit | 1a73d78bea5b940a8f5499e31ad9794d9aa7d475 (patch) | |
tree | 08744f9e46995c6b109993b8264ce3f46bbde0ef /patch_reader.cc | |
parent | 4feab7d1a15a2aaa51f34f24c68ec80d285948ee (diff) | |
download | zucchini-1a73d78bea5b940a8f5499e31ad9794d9aa7d475.tar.gz |
[Zucchini] Format change: Remove PatchType.
Previously, Zucchini patches store a uint32_t PatchType enum that
distinguishes among (0) raw patch, (1) single executable patch, and
(2) ensemble patch. However, ever since every element (and gap) stores
ExecutableType, this PatchType field has become a vestige. This CL
simplifies Zucchini by removing PatchType, including in README.md
and tests.
This CL alters Zucchini patch format (removes 4 bytes); patches created
across this change are incompatible.
Bug: 729154
Change-Id: Ia5f467ba5e01720f5085ce87a5de88f678a64930
Reviewed-on: https://chromium-review.googlesource.com/981789
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546621}
NOKEYCHECK=True
GitOrigin-RevId: 325bcee07f3eb9e3604c8aa0367ae7145025ddb6
Diffstat (limited to 'patch_reader.cc')
-rw-r--r-- | patch_reader.cc | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/patch_reader.cc b/patch_reader.cc index eceb969..970b90c 100644 --- a/patch_reader.cc +++ b/patch_reader.cc @@ -272,32 +272,12 @@ bool EnsemblePatchReader::Initialize(BufferSource* source) { LOG(ERROR) << "Patch contains invalid magic."; return false; } - uint32_t patch_type_int = - static_cast<uint32_t>(PatchType::kUnrecognisedPatch); - if (!source->GetValue(&patch_type_int)) { - LOG(ERROR) << "Impossible to read patch_type from source."; - return false; - } - patch_type_ = static_cast<PatchType>(patch_type_int); - if (patch_type_ != PatchType::kRawPatch && - patch_type_ != PatchType::kSinglePatch && - patch_type_ != PatchType::kEnsemblePatch) { - LOG(ERROR) << "Invalid patch_type encountered."; - return false; - } uint32_t element_count = 0; if (!source->GetValue(&element_count)) { LOG(ERROR) << "Impossible to read element_count from source."; return false; } - if (patch_type_ == PatchType::kRawPatch || - patch_type_ == PatchType::kSinglePatch) { - if (element_count != 1) { - LOG(ERROR) << "Unexpected number of elements in patch."; - return false; // Only one element expected. - } - } offset_t current_dst_offset = 0; for (uint32_t i = 0; i < element_count; ++i) { |