]>
Commit | Line | Data |
---|---|---|
bb742ede | 1 | /* |
359fc2d2 | 2 | * Copyright (C) the libgit2 contributors. All rights reserved. |
bb742ede VM |
3 | * |
4 | * This file is part of libgit2, distributed under the GNU GPL v2 with | |
5 | * a Linking Exception. For full terms see the included COPYING file. | |
6 | */ | |
c23841c8 SP |
7 | #ifndef INCLUDE_delta_apply_h__ |
8 | #define INCLUDE_delta_apply_h__ | |
9 | ||
72a3fe42 VM |
10 | #include "odb.h" |
11 | ||
c23841c8 SP |
12 | /** |
13 | * Apply a git binary delta to recover the original content. | |
14 | * | |
15 | * @param out the output buffer to receive the original data. | |
16 | * Only out->data and out->len are populated, as this is | |
17 | * the only information available in the delta. | |
18 | * @param base the base to copy from during copy instructions. | |
19 | * @param base_len number of bytes available at base. | |
20 | * @param delta the delta to execute copy/insert instructions from. | |
21 | * @param delta_len total number of bytes in the delta. | |
22 | * @return | |
e172cf08 | 23 | * - 0 on a successful delta unpack. |
c23841c8 SP |
24 | * - GIT_ERROR if the delta is corrupt or doesn't match the base. |
25 | */ | |
e035685f | 26 | extern int git__delta_apply( |
f49a2e49 | 27 | git_rawobj *out, |
c23841c8 SP |
28 | const unsigned char *base, |
29 | size_t base_len, | |
30 | const unsigned char *delta, | |
31 | size_t delta_len); | |
32 | ||
d1b6ea8a DMB |
33 | /** |
34 | * Read the header of a git binary delta. | |
35 | * | |
36 | * @param delta the delta to execute copy/insert instructions from. | |
37 | * @param delta_len total number of bytes in the delta. | |
38 | * @param base_sz pointer to store the base size field. | |
39 | * @param res_sz pointer to store the result size field. | |
40 | * @return | |
41 | * - 0 on a successful decoding the header. | |
42 | * - GIT_ERROR if the delta is corrupt. | |
43 | */ | |
44 | extern int git__delta_read_header( | |
45 | const unsigned char *delta, | |
46 | size_t delta_len, | |
47 | size_t *base_sz, | |
48 | size_t *res_sz); | |
49 | ||
c23841c8 | 50 | #endif |