add hpatch interface code
This commit is contained in:
parent
29e258c131
commit
69aed18b78
@ -109,3 +109,10 @@ JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_bsd
|
|||||||
(*env)->ReleaseByteArrayElements(env, patch, patchPtr, JNI_ABORT);
|
(*env)->ReleaseByteArrayElements(env, patch, patchPtr, JNI_ABORT);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdiffPatch
|
||||||
|
(JNIEnv *env, jobject self, jbyteArray origin, jbyteArray patch){
|
||||||
|
//todo:
|
||||||
|
return 0;
|
||||||
|
}
|
@ -15,6 +15,14 @@ extern "C" {
|
|||||||
JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_bsdiffPatch
|
JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_bsdiffPatch
|
||||||
(JNIEnv *, jclass, jbyteArray, jbyteArray);
|
(JNIEnv *, jclass, jbyteArray, jbyteArray);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: cn_reactnative_modules_update_DownloadTask
|
||||||
|
* Method: hdiffPatch
|
||||||
|
* Signature: ([B[B)[B
|
||||||
|
*/
|
||||||
|
JNIEXPORT jbyteArray JNICALL Java_cn_reactnative_modules_update_DownloadTask_hdiffPatch
|
||||||
|
(JNIEnv *, jclass, jbyteArray, jbyteArray);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
13
android/jni/hpatch.c
Normal file
13
android/jni/hpatch.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// hpatch.c
|
||||||
|
// Copyright 2021 housisong, All rights reserved
|
||||||
|
|
||||||
|
int hpatch_by_mem(const uint8_t* old,size_t oldsize, uint8_t* newBuf,size_t newsize,
|
||||||
|
const uint8_t* pat,size_t patsize){
|
||||||
|
//todo:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hpatch_by_file(const char* oldfile, const char* newfile, const char* patchfile){
|
||||||
|
//todo:
|
||||||
|
return -1;
|
||||||
|
}
|
13
android/jni/hpatch.h
Normal file
13
android/jni/hpatch.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// hpatch.h
|
||||||
|
// import HDiffPatch, support patchfile created by "hdiffz -SD -C-lzma2 oldfile newfile patchfile"
|
||||||
|
// Copyright 2021 housisong, All rights reserved
|
||||||
|
|
||||||
|
#ifndef HDIFFPATCH_PATCH_H
|
||||||
|
#define HDIFFPATCH_PATCH_H
|
||||||
|
# include <stdint.h> //for uint8_t
|
||||||
|
|
||||||
|
int hpatch_by_mem(const uint8_t* old,size_t oldsize, uint8_t* newBuf,size_t newsize,
|
||||||
|
const uint8_t* pat,size_t patsize);
|
||||||
|
int hpatch_by_file(const char* oldfile, const char* newfile, const char* patchfile);
|
||||||
|
|
||||||
|
#endif //HDIFFPATCH_PATCH_H
|
@ -134,9 +134,10 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024*4];
|
||||||
|
|
||||||
private static native byte[] bsdiffPatch(byte[] origin, byte[] patch);
|
private static native byte[] bsdiffPatch(byte[] origin, byte[] patch);
|
||||||
|
private static native byte[] hdiffPatch(byte[] origin, byte[] patch);
|
||||||
|
|
||||||
private void unzipToFile(ZipInputStream zis, File fmd) throws IOException {
|
private void unzipToFile(ZipInputStream zis, File fmd) throws IOException {
|
||||||
int count;
|
int count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user