Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

full changelog at: https://github.com/sisong/HDiffPatch/commits

## [v5.1.0](https://github.com/sisong/HDiffPatch/tree/v5.1.0) - 2026-07-14
### Added
* optimize `$hdiffz -m` required memory size when oldData different newData;
default opened by diff with -block or -cache opened;
* add lzma2mtDecompressPlugin, support lzma2 decompress by multi-thread;

## [v5.0.0](https://github.com/sisong/HDiffPatch/tree/v5.0.0) - 2026-06-25
### Added
* add new format Window Diff(`HDIFFW26`) for optimize patch speed, by `$hdiffz -WD[-stepSize]`;
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ ifeq ($(LZMA),1)
ifeq ($(MT),0)
else
HPATCH_OBJ+=$(LZMA_PATH)/MtDec.o \
$(LZMA_PATH)/Threads.o
$(LZMA_PATH)/Threads.o \
$(LZMA_PATH)/Lzma2DecMt.o
endif
HDIFF_OBJ += $(LZMA_PATH)/LzFind.o \
$(LZMA_PATH)/LzFindOpt.o \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [HDiffPatch]
[![release](https://img.shields.io/badge/release-v5.0.1-blue.svg)](https://github.com/sisong/HDiffPatch/releases)
[![release](https://img.shields.io/badge/release-v5.1.0-blue.svg)](https://github.com/sisong/HDiffPatch/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sisong/HDiffPatch/blob/master/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/sisong/HDiffPatch/pulls)
[![+issue Welcome](https://img.shields.io/github/issues-raw/sisong/HDiffPatch?color=green&label=%2Bissue%20welcome)](https://github.com/sisong/HDiffPatch/issues)
Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [HDiffPatch]
[![release](https://img.shields.io/badge/release-v5.0.1-blue.svg)](https://github.com/sisong/HDiffPatch/releases)
[![release](https://img.shields.io/badge/release-v5.1.0-blue.svg)](https://github.com/sisong/HDiffPatch/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sisong/HDiffPatch/blob/master/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/sisong/HDiffPatch/pulls)
[![+issue Welcome](https://img.shields.io/github/issues-raw/sisong/HDiffPatch?color=green&label=%2Bissue%20welcome)](https://github.com/sisong/HDiffPatch/issues)
Expand Down
2 changes: 1 addition & 1 deletion bsdiff_wrapper/bsdiff_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace hdiff_private{
:curPos(0),curi(0),bufi(0),covers(_covers){
streamImport=this;
read=_read;
streamSize=(covers.size()-1)*(hpatch_StreamPos_t)(3*8);
streamSize=(covers.size()>1)?((hpatch_StreamPos_t)covers.size()-1)*(3*8):0;
buf.reserve(hdiff_kFileIOBufBestSize);
}
private:
Expand Down
5 changes: 3 additions & 2 deletions builds/android_ndk_jni_mk/hpatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ void bz_internal_error(int errcode){

int hpatchz(const char *oldFileName,const char *diffFileName,const char *outNewFileName,
int64_t cacheMemory,size_t threadNum,hpatch_BOOL isChecksumNewData){
size_t dec_threadNum=1;//now only support lzma2 decompressor,& used large memory!
TPatchChecksumSet checksumSet={0,hpatch_FALSE,isChecksumNewData,isChecksumNewData,hpatch_FALSE};
#if (_IS_NEED_DIR_DIFF_PATCH)
const hpatch_BOOL isDirDiff=getIsDirDiffFile(diffFileName);
if (isDirDiff){
return hpatch_dir(oldFileName,diffFileName,outNewFileName,
hpatch_FALSE,limitCacheMemory(cacheMemory),kMaxOpenFileNumber_default_patch,
&checksumSet,&defaultPatchDirlistener,0,0,threadNum);
&checksumSet,&defaultPatchDirlistener,0,0,threadNum,dec_threadNum);
} else
#endif
return hpatch(oldFileName,diffFileName,outNewFileName,
hpatch_FALSE,limitCacheMemory(cacheMemory),0,0,&checksumSet,threadNum);
hpatch_FALSE,limitCacheMemory(cacheMemory),0,0,&checksumSet,threadNum,dec_threadNum);
}
9 changes: 7 additions & 2 deletions compress_plugin_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,15 @@ int _default_setParallelThreadNumber(hdiff_TCompress* compressPlugin,int threadN
#ifdef _CompressPlugin_lzma2
#if (_IsNeedIncludeDefaultCompressHead)
# include "MtCoder.h" // "lzma/C/MtCoder.h" for MTCODER__THREADS_MAX
#endif
#ifndef LZMA2DECMT_OUT_BLOCK_MAX_DEFAULT
# define LZMA2DECMT_OUT_BLOCK_MAX_DEFAULT (1<<28) // 256M
#endif
struct TCompressPlugin_lzma2{
hdiff_TCompress base;
int compress_level; //0..9
UInt32 dict_size; //patch decompress need 4?*lzma_dictSize memory
UInt32 block_size; //1M--256M; 0=AUTO, LZMA2 chunk size, affects decompress parallelism
int thread_num; //1..(64?)
};
static int _lzma2_setThreadNumber(hdiff_TCompress* compressPlugin,int threadNum){
Expand Down Expand Up @@ -848,7 +852,8 @@ int _default_setParallelThreadNumber(hdiff_TCompress* compressPlugin,int threadN
props.lzmaProps.level=plugin->compress_level;
props.lzmaProps.dictSize=dictSize;
props.lzmaProps.reduceSize=in_data->streamSize;
props.blockSize=LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO;
props.blockSize=(plugin->block_size==0)?LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO:
(plugin->block_size<LZMA2DECMT_OUT_BLOCK_MAX_DEFAULT)?plugin->block_size:LZMA2DECMT_OUT_BLOCK_MAX_DEFAULT;
props.numTotalThreads=plugin->thread_num;
Lzma2EncProps_Normalize(&props);
if (SZ_OK!=Lzma2Enc_SetProps(s,&props)) _compress_error_return("Lzma2Enc_SetProps()");
Expand Down Expand Up @@ -885,7 +890,7 @@ int _default_setParallelThreadNumber(hdiff_TCompress* compressPlugin,int threadN
_def_fun_compressType(_lzma2_compressType,"lzma2");
static const TCompressPlugin_lzma2 lzma2CompressPlugin={
{_lzma2_compressType,_default_maxCompressedSize,_lzma2_setThreadNumber,_lzma2_compress},
7,(1<<23),kDefaultCompressThreadNumber};
7,(1<<23),0,kDefaultCompressThreadNumber};
#endif//_CompressPlugin_lzma2

#ifdef _CompressPlugin_7zXZ
Expand Down
Loading
Loading