aboutsummaryrefslogtreecommitdiff
path: root/patch_writer.cc
diff options
context:
space:
mode:
authorSamuel Huang <huangs@chromium.org>2018-03-28 22:20:09 +0000
committerEdward Lesmes <ehmaldonado@google.com>2021-07-23 22:00:41 +0000
commit1a73d78bea5b940a8f5499e31ad9794d9aa7d475 (patch)
tree08744f9e46995c6b109993b8264ce3f46bbde0ef /patch_writer.cc
parent4feab7d1a15a2aaa51f34f24c68ec80d285948ee (diff)
downloadzucchini-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_writer.cc')
-rw-r--r--patch_writer.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/patch_writer.cc b/patch_writer.cc
index 4edbc7c..114bcd4 100644
--- a/patch_writer.cc
+++ b/patch_writer.cc
@@ -266,8 +266,7 @@ void EnsemblePatchWriter::AddElement(PatchElementWriter&& patch_element) {
}
size_t EnsemblePatchWriter::SerializedSize() const {
- size_t serialized_size =
- sizeof(PatchHeader) + sizeof(PatchType) + sizeof(uint32_t);
+ size_t serialized_size = sizeof(PatchHeader) + sizeof(uint32_t);
for (const auto& patch_element : elements_) {
serialized_size += patch_element.SerializedSize();
}
@@ -275,11 +274,9 @@ size_t EnsemblePatchWriter::SerializedSize() const {
}
bool EnsemblePatchWriter::SerializeInto(BufferSink* sink) const {
- DCHECK_NE(patch_type_, PatchType::kUnrecognisedPatch);
DCHECK_EQ(current_dst_offset_, header_.new_size);
bool ok =
sink->PutValue<PatchHeader>(header_) &&
- sink->PutValue<PatchType>(patch_type_) &&
sink->PutValue<uint32_t>(base::checked_cast<uint32_t>(elements_.size()));
if (!ok)
return false;