lin
2025-07-30 fcd736bf35fd93b563e9bbf594f2aa7b62028cc9
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2015 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_BSPATCH_H_
#define _BSDIFF_BSPATCH_H_
 
#include <stddef.h>
#include <stdint.h>
 
#include <functional>
#include <memory>
#include <vector>
 
#include "bsdiff/extents_file.h"
 
namespace bsdiff {
 
BSDIFF_EXPORT
int bspatch(const char* old_filename,
            const char* new_filename,
            const char* patch_filename,
            const char* old_extents,
            const char* new_extents);
 
BSDIFF_EXPORT
int bspatch(const char* old_filename,
            const char* new_filename,
            const uint8_t* patch_data,
            size_t patch_size,
            const char* old_extents,
            const char* new_extents);
 
BSDIFF_EXPORT
int bspatch(const uint8_t* old_data,
            size_t old_size,
            const uint8_t* patch_data,
            size_t patch_size,
            const std::function<size_t(const uint8_t*, size_t)>& sink);
 
BSDIFF_EXPORT
int bspatch(const std::unique_ptr<FileInterface>& old_file,
            const std::unique_ptr<FileInterface>& new_file,
            const uint8_t* patch_data,
            size_t patch_size);
 
bool WriteAll(const std::unique_ptr<FileInterface>& file,
              const uint8_t* data,
              size_t size);
 
bool IsOverlapping(const char* old_filename,
                   const char* new_filename,
                   const std::vector<ex_t>& old_extents,
                   const std::vector<ex_t>& new_extents);
 
}  // namespace bsdiff
 
#endif  // _BSDIFF_BSPATCH_H_