1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

run hpatch in .so on android

This commit is contained in:
sisong 2021-04-06 00:13:53 +08:00
parent c4d2523a92
commit 2097ce3128
5 changed files with 17 additions and 17 deletions

View File

@ -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(kHPatch_ok!=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,7 +144,7 @@ JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdi
_check(outPtr,"Corrupt JNIEnv::GetByteArrayElements");
}
_check(kHPatch_ok!=hpatch_by_mem((const uint8_t*)originPtr,originLength,(uint8_t*)outPtr,newsize,
_check(kHPatch_ok==hpatch_by_mem((const uint8_t*)originPtr,originLength,(uint8_t*)outPtr,newsize,
(const uint8_t*)patchPtr,patchLength,&patInfo),"hpacth");
_clear:

View File

@ -1,5 +1,5 @@
// hpatch.h
// import HDiffPatch, support patchfile created by "hdiffz -SD -C-lzma2 oldfile newfile patchfile"
// import HDiffPatch, support patchData created by "hdiffz -SD -c-lzma2 oldfile newfile patchfile"
// Copyright 2021 housisong, All rights reserved
#ifndef HDIFFPATCH_PATCH_H

View File

@ -498,11 +498,11 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
break;
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_APK:
case DownloadTaskParams.TASK_TYPE_HPATCH_FROM_APK:
doPatchFromApk(params[0],type);
doPatchFromApk(params[0],taskType);
break;
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_PPK:
case DownloadTaskParams.TASK_TYPE_HPATCH_FROM_PPK:
doPatchFromPpk(params[0],type);
doPatchFromPpk(params[0],taskType);
break;
case DownloadTaskParams.TASK_TYPE_CLEANUP:
doCleanUp(params[0]);

View File

@ -92,15 +92,15 @@ public class UpdateContext {
private String zipExtension(int patchType){
switch (patchType) {
case TASK_TYPE_PATCH_FULL:
case DownloadTaskParams.TASK_TYPE_PATCH_FULL:
return ".ppk";
case TASK_TYPE_PATCH_FROM_APK:
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_APK:
return ".apk.patch";
case TASK_TYPE_PATCH_FROM_PPK:
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_PPK:
return ".ppk.patch";
case TASK_TYPE_HPATCH_FROM_APK:
case DownloadTaskParams.TASK_TYPE_HPATCH_FROM_APK:
return ".apk.hpatch";
case TASK_TYPE_HPATCH_FROM_PPK:
case DownloadTaskParams.TASK_TYPE_HPATCH_FROM_PPK:
return ".ppk.hpatch";
default:
return "";//unknown type