yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | #ifndef PATCH_H
|
| 2 | #define PATCH_H
|
| 3 |
|
| 4 | // Image patch chunk types
|
| 5 | #define CHUNK_NORMAL 0
|
| 6 | #define CHUNK_GZIP 1 // version 1 only
|
| 7 | #define CHUNK_DEFLATE 2 // version 2 only
|
| 8 | #define CHUNK_RAW 3 // version 2 only
|
| 9 |
|
| 10 | // The gzip header size is actually variable, but we currently don't
|
| 11 | // support gzipped data with any of the optional fields, so for now it
|
| 12 | // will always be ten bytes. See RFC 1952 for the definition of the
|
| 13 | // gzip format.
|
| 14 | #define GZIP_HEADER_LEN 10
|
| 15 |
|
| 16 | // The gzip footer size really is fixed.
|
| 17 | #define GZIP_FOOTER_LEN 8
|
| 18 |
|
| 19 | int lzma_decompress(unsigned char *data_in, unsigned char *cpage_out,
|
| 20 | ssize_t srclen, ssize_t dstlen);
|
| 21 |
|
| 22 | int ApplyBSDiffPatch(const unsigned char *old_data, ssize_t old_size,
|
| 23 | unsigned char *patch, ssize_t patch_size, ssize_t patch_offset,
|
| 24 | unsigned char **new_data, ssize_t *new_size);
|
| 25 |
|
| 26 | int ApplyImagePatch(unsigned char *old_data, ssize_t old_size,
|
| 27 | unsigned char *patch, ssize_t patch_size,
|
| 28 | unsigned char **new_data, ssize_t *new_size,
|
| 29 | int seg_num);
|
| 30 |
|
| 31 | int ApplyOverridePatch(const unsigned char* old_data, ssize_t old_size,
|
| 32 | unsigned char* patch, ssize_t patch_size, ssize_t patch_offset,
|
| 33 | unsigned char** new_data, ssize_t* new_size);
|
| 34 |
|
| 35 | unsigned char *lzma_decode(const char *file_name, size_t *out_sz);
|
| 36 | int lzma_encode(const char *in, ssize_t in_len, char *out_file);
|
| 37 |
|
| 38 | #endif /*PATCH_H*/ |