recode hpatch result code
This commit is contained in:
parent
9d9fbd3315
commit
48e0849804
@ -131,7 +131,7 @@ JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdi
|
||||
hpatch_singleCompressedDiffInfo patInfo;
|
||||
|
||||
_check(((originLength==0)||originPtr) && patchPtr && (patchLength>0),"Corrupt patch");
|
||||
_check(0!=hpatch_getInfo_by_mem(&patInfo,(const uint8_t*)patchPtr,patchLength),"Error info in hpatch");
|
||||
_check(kHPatch_ok!=hpatch_getInfo_by_mem(&patInfo,(const uint8_t*)patchPtr,patchLength),"Error info in hpatch");
|
||||
_check(originLength==patInfo.oldDataSize,"Error oldDataSize in hpatch");
|
||||
newsize=(size_t)patInfo.newDataSize;
|
||||
if (sizeof(size_t)!=sizeof(hpatch_StreamPos_t))
|
||||
@ -144,8 +144,8 @@ JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdi
|
||||
_check(outPtr,"Corrupt JNIEnv::GetByteArrayElements");
|
||||
}
|
||||
|
||||
_check(0!=hpatch_by_mem((const uint8_t*)originPtr,originLength,(uint8_t*)outPtr,newsize,
|
||||
(const uint8_t*)patchPtr,patchLength,&patInfo),"hpacth");
|
||||
_check(kHPatch_ok!=hpatch_by_mem((const uint8_t*)originPtr,originLength,(uint8_t*)outPtr,newsize,
|
||||
(const uint8_t*)patchPtr,patchLength,&patInfo),"hpacth");
|
||||
|
||||
_clear:
|
||||
if (outPtr) (*env)->ReleaseByteArrayElements(env, ret, outPtr, (_isError?JNI_ABORT:0));
|
||||
|
@ -6,33 +6,15 @@
|
||||
|
||||
//#define _CompressPlugin_zlib
|
||||
//#define _CompressPlugin_bz2
|
||||
//#define _CompressPlugin_lzma
|
||||
#define _CompressPlugin_lzma
|
||||
#define _CompressPlugin_lzma2
|
||||
#define _IsNeedIncludeDefaultCompressHead 0
|
||||
#include "lzma/C/LzmaDec.h"
|
||||
#include "lzma/C/Lzma2Dec.h"
|
||||
#include "HDiffPatch/decompress_plugin_demo.h"
|
||||
|
||||
#define kMaxLoadMemOldSize ((1<<20)*8)
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
#define _check(v,errorType) do{ \
|
||||
if (!(v)){ if (result==kHPatch_ok) result=errorType; if (!_isInClear){ goto _clear; }; } }while(0)
|
||||
|
||||
|
@ -7,6 +7,26 @@
|
||||
# include <stdint.h> //for uint8_t
|
||||
#include "HDiffPatch/libHDiffPatch/HPatch/patch_types.h" //for hpatch_singleCompressedDiffInfo
|
||||
|
||||
//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,
|
||||
};
|
||||
|
||||
int hpatch_getInfo_by_mem(hpatch_singleCompressedDiffInfo* out_patinfo,
|
||||
const uint8_t* pat,size_t patsize);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user