summaryrefslogtreecommitdiff
path: root/include/bsdiff/control_entry.h
blob: 2c849f634c8ad5a2643d1bda22ee88caac924656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef _BSDIFF_CONTROL_ENTRY_H_
#define _BSDIFF_CONTROL_ENTRY_H_

#include <stdint.h>

struct ControlEntry {
  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) {}

  // The number of bytes to copy from the source and diff stream.
  uint64_t diff_size;

  // The number of bytes to copy from the extra stream.
  uint64_t extra_size;

  // The value to add to the source pointer after patching from the diff stream.
  int64_t offset_increment;

  bool operator==(const ControlEntry& o) const {
    return diff_size == o.diff_size && extra_size == o.extra_size &&
           offset_increment == o.offset_increment;
  }
};

#endif  // _BSDIFF_CONTROL_ENTRY_H_