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

build .so files ok

This commit is contained in:
sisong 2021-04-05 11:32:01 +08:00
parent e6a8855502
commit 9d9fbd3315
4 changed files with 26 additions and 13 deletions

@ -3,6 +3,14 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := rnupdate
Hdp_Files := \
hpatch.c \
HDiffPatch/libHDiffPatch/HPatch/patch.c \
HDiffPatch/file_for_patch.c \
lzma/C/LzmaDec.c \
lzma/C/Lzma2Dec.c
LOCAL_SRC_FILES := \
DownloadTask.c \
blocksort.c \
@ -12,6 +20,7 @@ LOCAL_SRC_FILES := \
compress.c \
decompress.c \
huffman.c \
randtable.c
randtable.c \
$(Hdp_Files)
include $(BUILD_SHARED_LIBRARY)

@ -6,9 +6,11 @@
#include <stdlib.h>
#include "bzlib.h"
#include "bspatch.h"
#include "hpatch.h"
#include <string.h> //for memcmp
#include <android/log.h>
#include "hpatch.h"
static int64_t offtin(uint8_t *buf)
{
int64_t y;
@ -129,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,patchPtr,patchLength),"Error info in hpatch");
_check(0!=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))
@ -142,8 +144,8 @@ JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdi
_check(outPtr,"Corrupt JNIEnv::GetByteArrayElements");
}
_check(0!=hpatch_by_mem(originPtr,originLength,outPtr,newsize,
pat,patsize,&patInfo),"hpacth");
_check(0!=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));
@ -156,8 +158,8 @@ _clear:
ret = NULL;
}
newExcCls = (*env)->FindClass(env, "java/lang/Error");
if (newExcCls != NULL) /* Unable to find the new exception class, give up. */
if (newExcCls != NULL) // Unable to find the new exception class, give up.
(*env)->ThrowNew(env, newExcCls, _errInfo);
}
return ret;
}
}

@ -8,6 +8,8 @@
//#define _CompressPlugin_bz2
//#define _CompressPlugin_lzma
#define _CompressPlugin_lzma2
#define _IsNeedIncludeDefaultCompressHead 0
#include "lzma/C/Lzma2Dec.h"
#include "HDiffPatch/decompress_plugin_demo.h"
#define kMaxLoadMemOldSize ((1<<20)*8)
@ -34,7 +36,7 @@ enum {
#define _check(v,errorType) do{ \
if (!(v)){ if (result==kHPatch_ok) result=errorType; if (!_isInClear){ goto _clear; }; } }while(0)
int hpatch_getInfo_by_mem(struct hpatch_singleCompressedDiffInfo* out_patinfo,
int hpatch_getInfo_by_mem(hpatch_singleCompressedDiffInfo* out_patinfo,
const uint8_t* pat,size_t patsize){
hpatch_TStreamInput patStream;
mem_as_hStreamInput(&patStream,pat,pat+patsize);
@ -100,7 +102,7 @@ static int hpatch_by_stream(const hpatch_TStreamInput* old,hpatch_BOOL isLoadOld
}
}
_check(patch_single_compressed_diff(&out_new,old,pat,patInfo->diffDataPos,
_check(patch_single_compressed_diff(out_new,old,pat,patInfo->diffDataPos,
patInfo->uncompressedSize,decompressPlugin,patInfo->coverCount,
patInfo->stepMemSize,temp_cache,temp_cache+temp_cache_size),kHPatch_error_patch);
@ -111,7 +113,7 @@ _clear:
}
int hpatch_by_mem(const uint8_t* old,size_t oldsize,uint8_t* newBuf,size_t newsize,
const uint8_t* pat,size_t patsize,const struct hpatch_singleCompressedDiffInfo* patInfo){
const uint8_t* pat,size_t patsize,const hpatch_singleCompressedDiffInfo* patInfo){
hpatch_TStreamInput oldStream;
hpatch_TStreamInput patStream;
hpatch_TStreamOutput newStream;

@ -5,14 +5,14 @@
#ifndef HDIFFPATCH_PATCH_H
#define HDIFFPATCH_PATCH_H
# include <stdint.h> //for uint8_t
#include "HDiffPatch/libHDiffPatch/HPatch/patch_types.h" //for hpatch_singleCompressedDiffInfo
struct hpatch_singleCompressedDiffInfo;
int hpatch_getInfo_by_mem(struct hpatch_singleCompressedDiffInfo* out_patinfo,
int hpatch_getInfo_by_mem(hpatch_singleCompressedDiffInfo* out_patinfo,
const uint8_t* pat,size_t patsize);
//patInfo can NULL
int hpatch_by_mem(const uint8_t* old,size_t oldsize, uint8_t* newBuf,size_t newsize,
const uint8_t* pat,size_t patsize,const struct hpatch_singleCompressedDiffInfo* patInfo);
const uint8_t* pat,size_t patsize,const hpatch_singleCompressedDiffInfo* patInfo);
int hpatch_by_file(const char* oldfile, const char* newfile, const char* patchfile);
#endif //HDIFFPATCH_PATCH_H