2023-02-19 18:20:21 +08:00
|
|
|
// hpatch.h
|
|
|
|
// import HDiffPatch, support patchData created by "hdiffz -SD -c-lzma2 oldfile newfile patchfile"
|
2021-04-04 12:17:57 +08:00
|
|
|
// Copyright 2021 housisong, All rights reserved
|
|
|
|
|
|
|
|
#ifndef HDIFFPATCH_PATCH_H
|
|
|
|
#define HDIFFPATCH_PATCH_H
|
|
|
|
# include <stdint.h> //for uint8_t
|
2021-04-05 11:32:01 +08:00
|
|
|
#include "HDiffPatch/libHDiffPatch/HPatch/patch_types.h" //for hpatch_singleCompressedDiffInfo
|
2021-04-09 19:57:56 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2021-04-04 12:17:57 +08:00
|
|
|
|
2021-04-05 13:40:38 +08:00
|
|
|
//result
|
|
|
|
enum {
|
|
|
|
kHPatch_ok = 0,
|
|
|
|
kHPatch_error_malloc =-1,
|
|
|
|
kHPatch_error_info =-2,
|
|
|
|
kHPatch_error_compressType =-3,
|
|
|
|
kHPatch_error_patch =-4,
|
|
|
|
kHPatch_error_old_fopen =-5,
|
|
|
|
kHPatch_error_old_fread =-6,
|
|
|
|
kHPatch_error_old_fclose =-7,
|
|
|
|
kHPatch_error_pat_fopen =-8,
|
|
|
|
kHPatch_error_pat_fread =-9,
|
|
|
|
kHPatch_error_pat_fclose =-10,
|
|
|
|
kHPatch_error_new_fopen =-11,
|
|
|
|
kHPatch_error_new_fwrite =-12,
|
|
|
|
kHPatch_error_new_fclose =-13,
|
|
|
|
kHPatch_error_old_size =-14,
|
|
|
|
kHPatch_error_new_size =-15,
|
|
|
|
};
|
|
|
|
|
2021-04-05 11:32:01 +08:00
|
|
|
int hpatch_getInfo_by_mem(hpatch_singleCompressedDiffInfo* out_patinfo,
|
2021-04-04 15:50:40 +08:00
|
|
|
const uint8_t* pat,size_t patsize);
|
|
|
|
|
|
|
|
//patInfo can NULL
|
2021-04-04 12:17:57 +08:00
|
|
|
int hpatch_by_mem(const uint8_t* old,size_t oldsize, uint8_t* newBuf,size_t newsize,
|
2021-04-05 11:32:01 +08:00
|
|
|
const uint8_t* pat,size_t patsize,const hpatch_singleCompressedDiffInfo* patInfo);
|
2021-04-04 12:17:57 +08:00
|
|
|
int hpatch_by_file(const char* oldfile, const char* newfile, const char* patchfile);
|
|
|
|
|
2021-04-09 19:57:56 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2023-02-19 18:20:21 +08:00
|
|
|
#endif //HDIFFPATCH_PATCH_H
|