1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-31 21:33:12 +08:00
Code Issues 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

View File

@@ -3,6 +3,14 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := rnupdate 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 := \ LOCAL_SRC_FILES := \
DownloadTask.c \ DownloadTask.c \
blocksort.c \ blocksort.c \
@@ -12,6 +20,7 @@ LOCAL_SRC_FILES := \
compress.c \ compress.c \
decompress.c \ decompress.c \
huffman.c \ huffman.c \
randtable.c randtable.c \
$(Hdp_Files)
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View File

@@ -6,9 +6,11 @@
#include <stdlib.h> #include <stdlib.h>
#include "bzlib.h" #include "bzlib.h"
#include "bspatch.h" #include "bspatch.h"
#include "hpatch.h" #include <string.h> //for memcmp
#include <android/log.h> #include <android/log.h>
#include "hpatch.h"
static int64_t offtin(uint8_t *buf) static int64_t offtin(uint8_t *buf)
{ {
int64_t y; int64_t y;
@@ -129,7 +131,7 @@ JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdi
hpatch_singleCompressedDiffInfo patInfo; hpatch_singleCompressedDiffInfo patInfo;
_check(((originLength==0)||originPtr) && patchPtr && (patchLength>0),"Corrupt patch"); _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"); _check(originLength==patInfo.oldDataSize,"Error oldDataSize in hpatch");
newsize=(size_t)patInfo.newDataSize; newsize=(size_t)patInfo.newDataSize;
if (sizeof(size_t)!=sizeof(hpatch_StreamPos_t)) 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(outPtr,"Corrupt JNIEnv::GetByteArrayElements");
} }
_check(0!=hpatch_by_mem(originPtr,originLength,outPtr,newsize, _check(0!=hpatch_by_mem((const uint8_t*)originPtr,originLength,(uint8_t*)outPtr,newsize,
pat,patsize,&patInfo),"hpacth"); (const uint8_t*)patchPtr,patchLength,&patInfo),"hpacth");
_clear: _clear:
if (outPtr) (*env)->ReleaseByteArrayElements(env, ret, outPtr, (_isError?JNI_ABORT:0)); if (outPtr) (*env)->ReleaseByteArrayElements(env, ret, outPtr, (_isError?JNI_ABORT:0));
@@ -156,8 +158,8 @@ _clear:
ret = NULL; ret = NULL;
} }
newExcCls = (*env)->FindClass(env, "java/lang/Error"); 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); (*env)->ThrowNew(env, newExcCls, _errInfo);
} }
return ret; return ret;
} }

View File

@@ -8,6 +8,8 @@
//#define _CompressPlugin_bz2 //#define _CompressPlugin_bz2
//#define _CompressPlugin_lzma //#define _CompressPlugin_lzma
#define _CompressPlugin_lzma2 #define _CompressPlugin_lzma2
#define _IsNeedIncludeDefaultCompressHead 0
#include "lzma/C/Lzma2Dec.h"
#include "HDiffPatch/decompress_plugin_demo.h" #include "HDiffPatch/decompress_plugin_demo.h"
#define kMaxLoadMemOldSize ((1<<20)*8) #define kMaxLoadMemOldSize ((1<<20)*8)
@@ -34,7 +36,7 @@ enum {
#define _check(v,errorType) do{ \ #define _check(v,errorType) do{ \
if (!(v)){ if (result==kHPatch_ok) result=errorType; if (!_isInClear){ goto _clear; }; } }while(0) 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){ const uint8_t* pat,size_t patsize){
hpatch_TStreamInput patStream; hpatch_TStreamInput patStream;
mem_as_hStreamInput(&patStream,pat,pat+patsize); 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->uncompressedSize,decompressPlugin,patInfo->coverCount,
patInfo->stepMemSize,temp_cache,temp_cache+temp_cache_size),kHPatch_error_patch); 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, 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 oldStream;
hpatch_TStreamInput patStream; hpatch_TStreamInput patStream;
hpatch_TStreamOutput newStream; hpatch_TStreamOutput newStream;

View File

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