#ifndef PATCH_H | |
#define PATCH_H | |
// Image patch chunk types | |
#define CHUNK_NORMAL 0 | |
#define CHUNK_GZIP 1 // version 1 only | |
#define CHUNK_DEFLATE 2 // version 2 only | |
#define CHUNK_RAW 3 // version 2 only | |
// The gzip header size is actually variable, but we currently don't | |
// support gzipped data with any of the optional fields, so for now it | |
// will always be ten bytes. See RFC 1952 for the definition of the | |
// gzip format. | |
#define GZIP_HEADER_LEN 10 | |
// The gzip footer size really is fixed. | |
#define GZIP_FOOTER_LEN 8 | |
int lzma_decompress(unsigned char *data_in, unsigned char *cpage_out, | |
ssize_t srclen, ssize_t dstlen); | |
int ApplyBSDiffPatch(const unsigned char *old_data, ssize_t old_size, | |
unsigned char *patch, ssize_t patch_size, ssize_t patch_offset, | |
unsigned char **new_data, ssize_t *new_size); | |
int ApplyImagePatch(unsigned char *old_data, ssize_t old_size, | |
unsigned char *patch, ssize_t patch_size, | |
unsigned char **new_data, ssize_t *new_size, | |
int seg_num); | |
int ApplyOverridePatch(const unsigned char* old_data, ssize_t old_size, | |
unsigned char* patch, ssize_t patch_size, ssize_t patch_offset, | |
unsigned char** new_data, ssize_t* new_size); | |
unsigned char *lzma_decode(const char *file_name, size_t *out_sz); | |
int lzma_encode(const char *in, ssize_t in_len, char *out_file); | |
#endif /*PATCH_H*/ |