From a5edc4e0925a83cecabfa9c4df9ee94cf9eb059d Mon Sep 17 00:00:00 2001 From: sisong Date: Sun, 19 Nov 2023 16:31:19 +0800 Subject: [PATCH 1/8] recode default cacheMemory code for import hpatchz; --- builds/android_ndk_jni_mk/hpatch.c | 12 ++++++++++-- builds/android_ndk_jni_mk/hpatch.h | 2 +- builds/android_ndk_jni_mk/hpatch_jni.c | 12 +----------- builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.m | 14 +++----------- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/builds/android_ndk_jni_mk/hpatch.c b/builds/android_ndk_jni_mk/hpatch.c index 43875835..0e61fdb9 100644 --- a/builds/android_ndk_jni_mk/hpatch.c +++ b/builds/android_ndk_jni_mk/hpatch.c @@ -29,8 +29,16 @@ void bz_internal_error(int errcode){ # endif #endif + static inline size_t getCacheMemory(int64_t cacheMemory){ + #define kPatchCacheSize_def (1024*256) + #define kPatchCacheSize_max ((int64_t)((size_t)(~(size_t)0))) + if (cacheMemory<0) return kPatchCacheSize_def; + if (sizeof(int64_t)<=sizeof(size_t)) return (size_t)cacheMemory; + return (size_t)((cacheMemoryReleaseStringUTFChars(jenv,jstr,cstr); } while(0) - - static size_t getCacheMemory(jlong cacheMemory){ - #define kPatchCacheSize_default (1024*256) - #define kPatchCacheSize_max ((jlong)((size_t)(~(size_t)0))) - if (cacheMemory<0) return kPatchCacheSize_default; - if (sizeof(jlong)<=sizeof(size_t)) return (size_t)cacheMemory; - return (size_t)((cacheMemory Date: Wed, 22 Nov 2023 17:19:20 +0800 Subject: [PATCH 2/8] recode android make file; --- Makefile | 2 +- README.md | 6 +- README_cn.md | 14 +- builds/android_ndk_jni_mk/Android.mk | 178 +++++++++++------------ builds/android_ndk_jni_mk/Application.mk | 4 +- builds/android_ndk_jni_mk/hpatch.h | 1 + libHDiffPatch/HPatch/patch_types.h | 1 + 7 files changed, 97 insertions(+), 109 deletions(-) diff --git a/Makefile b/Makefile index 541d54ef..be7128b9 100644 --- a/Makefile +++ b/Makefile @@ -334,7 +334,7 @@ else endif ifeq ($(MINS),0) else - DIFF_LINK += -Wl,--gc-sections,--as-needed + DIFF_LINK += -s -Wl,--gc-sections,--as-needed endif ifeq ($(CL),1) CXX := clang++ diff --git a/README.md b/README.md index f7467974..f22d3925 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/t9ow8dft8lt898cv/branch/master?svg=true)](https://ci.appveyor.com/project/sisong/hdiffpatch/branch/master) english | [中文版](README_cn.md) -[HDiffPatch] is a C\C++ library and command-line tools for **diff** & **patch** between binary files or directories(folder); cross-platform; runs fast; create small delta/differential; support large files and limit memory requires when diff & patch. +[HDiffPatch] is a C\C++ library and command-line tools for **diff** & **patch** between binary files or directories(folder); cross-platform; fast running; create small delta/differential; support large files and limit memory requires when diff & patch. [HDiffPatch] defines its own patch file format, this lib is also compatible with the [bsdiff4] patch file format and partially compatible with the [open-vcdiff] and [xdelta3] patch file format [VCDIFF(RFC 3284)]. @@ -266,7 +266,7 @@ special options: --- ## library API usage: -all **diff**&**patch** function in file: `libHDiffPatch/HDiff/diff.h` & `libHDiffPatch/HPatch/patch.h` +**diff**&**patch** function in file: `libHDiffPatch/HDiff/diff.h` & `libHDiffPatch/HPatch/patch.h` **dir_diff()** & **dir patch** in: `dirDiffPatch/dir_diff/dir_diff.h` & `dirDiffPatch/dir_patch/dir_patch.h` ### manual: * **create diff**(in newData,in oldData,out diffData); @@ -320,7 +320,7 @@ all **diff**&**patch** function in file: `libHDiffPatch/HDiff/diff.h` & `libHDif --- ## [HDiffPatch] vs [bsdiff4] & [xdelta3]: -case list([download from OneDrive](https://1drv.ms/u/s!Aj8ygMPeifoQgUIZxYac5_uflNoN)): +case list([download from OneDrive](https://1drv.ms/u/s!Aj8ygMPeifoQgULlawtabR9lhrQ8)): | |newFile <-- oldFile|newSize|oldSize| |----:|:----|----:|----:| |1|7-Zip_22.01.win.tar <-- 7-Zip_21.07.win.tar|5908992|5748224| diff --git a/README_cn.md b/README_cn.md index 40368113..a684098f 100644 --- a/README_cn.md +++ b/README_cn.md @@ -8,17 +8,17 @@ [![Build status](https://ci.appveyor.com/api/projects/status/t9ow8dft8lt898cv/branch/master?svg=true)](https://ci.appveyor.com/project/sisong/hdiffpatch/branch/master) 中文版 | [english](README.md) -[HDiffPatch] 是一个C\C++库和命令行工具,用于在二进制文件或文件夹之间执行**diff**(创建补丁)和**patch**(打补丁);跨平台、运行快、创建的补丁小、支持巨大的文件并且可控制diff和patch时的内存占用量。 +[HDiffPatch] 是一个C\C++库和命令行工具,用于在二进制文件或文件夹之间执行 **diff**(创建补丁) 和 **patch**(打补丁);跨平台、运行速度快、创建的补丁小、支持巨大的文件并且diff和patch时都可以控制内存占用量。 [HDiffPatch] 定义了自己的补丁包格式,同时这个库也完全兼容了 [bsdiff4] 的补丁包格式,并部分兼容 [open-vcdiff] 和 [xdelta3] 的补丁包格式 [VCDIFF(RFC 3284)]。 -如果需要在嵌入式系统(MCU、NB-IoT)等设备上进行增量更新(OTA), 可以看看例子 [HPatchLite], +[tinyuz] 解压缩器可以在1KB内存的设备上运行! +如果你需要在嵌入式系统(MCU、NB-IoT)等设备上进行增量更新(OTA), 可以看看例子 [HPatchLite], +[tinyuz] 解压缩器可以在1KB内存的设备上运行! -需要更新你自己的安卓apk? 需要对Jar或Zip文件执行 diff & patch ? 可以试试 [ApkDiffPatch], 可以创建更小的补丁! 注意: *ApkDiffPath 不能被安卓应用商店作为增量更新使用,因为该算法要求在diff前对apk文件进行重新签名。* +需要更新你自己的安卓apk? 需要对Jar或Zip文件执行 diff 和 patch ? 可以试试 [ApkDiffPatch], 可以创建更小的补丁! 注意: *ApkDiffPath 不能被安卓应用商店作为增量更新所用,因为该算法要求在diff前对apk文件进行重新签名。* [sfpatcher] 不要求对apk文件进行重新签名 (类似 [archive-patcher]),是为安卓应用商店专门设计优化的算法,patch速度是 archive-patcher 的xx倍,并且只需要O(1)内存。 -如果你没有旧版本的数据(或者旧版本非常多或者被修改),因此不能提前创建好所有补丁包。那你可以看看使用同步算法来进行增量更新的例子 [hsynz] (类似 [zsync]),新版本只需要发布处理一次,然后旧版本数据的拥有者可以根据获得的新版本的信息自己执行diff和patch。hsynz 支持 zstd 压缩算法并且比 zsync 速度更快。 +如果你没有旧版本的数据(或者旧版本非常多或者被修改),因此不能提前创建好补丁包。那你可以看看使用同步算法来进行增量更新的例子 [hsynz] (类似 [zsync]),新版本只需要发布处理一次,然后旧版本数据的拥有者可以根据获得的新版本的信息自己执行diff和patch。hsynz 支持 zstd 压缩算法并且比 zsync 速度更快。 注意: *本库不处理文件元数据,如文件最后写入时间、权限、链接文件等。对于这个库,文件就像一个字节流;如果需要您可以扩展此库或使用其他工具。* @@ -262,7 +262,7 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 --- ## 库 API 使用说明: -所有 **diff**和**patch** 函数在文件: `libHDiffPatch/HDiff/diff.h` & `libHDiffPatch/HPatch/patch.h` +**diff**和**patch** 函数在文件: `libHDiffPatch/HDiff/diff.h` & `libHDiffPatch/HPatch/patch.h` **dir_diff()** 和 **dir patch** 在: `dirDiffPatch/dir_diff/dir_diff.h` & `dirDiffPatch/dir_patch/dir_patch.h` ### 使用方式: * **create diff**(in newData,in oldData,out diffData); @@ -316,7 +316,7 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 --- ## [HDiffPatch] vs [bsdiff4] & [xdelta3]: -测试例子([从 OneDrive 下载](https://1drv.ms/u/s!Aj8ygMPeifoQgUIZxYac5_uflNoN)): +测试用例([从 OneDrive 下载](https://1drv.ms/u/s!Aj8ygMPeifoQgULlawtabR9lhrQ8)): | |newFile <-- oldFile|newSize|oldSize| |----:|:----|----:|----:| |1|7-Zip_22.01.win.tar <-- 7-Zip_21.07.win.tar|5908992|5748224| @@ -343,7 +343,7 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 **测试 PC**: Windows11, CPU R9-7945HX, SSD PCIe4.0x4 4T, DDR5 5200MHz 32Gx2 **参与测试的程序和版本**: HDiffPatch4.6.3, hsynz 0.9.3, BsDiff4.3, xdelta3.1, zstd1.5.2 -**参与测试程序的参数**: +**参与测试的程序的参数**: **zstd --patch-from** diff with `--ultra -21 --long=24 -f --patch-from={old} {new} -o {pat}` zstd patch with `-d -f --memory=2047MB --patch-from={old} {pat} -o {new}` **xdelta3** diff with `-S lzma -e -9 -n -f -s {old} {new} {pat}` diff --git a/builds/android_ndk_jni_mk/Android.mk b/builds/android_ndk_jni_mk/Android.mk index f3d455fd..203fbf39 100644 --- a/builds/android_ndk_jni_mk/Android.mk +++ b/builds/android_ndk_jni_mk/Android.mk @@ -4,146 +4,132 @@ include $(CLEAR_VARS) LOCAL_MODULE := hpatchz # args -ZSTD := 1 +ZLIB := 1 LZMA := 1 +ZSTD := 1 BROTLI:= 0 VCD := 0 # if open BSD,must open BZIP2 BSD := 0 BZIP2 := 0 -ifeq ($(BZIP2),0) - Bz2_Files := -else - # http://www.bzip.org https://github.com/sisong/bzip2 - BZ2_PATH := $(LOCAL_PATH)/../../../bzip2/ - Bz2_Files := $(BZ2_PATH)/blocksort.c \ - $(BZ2_PATH)/bzlib.c \ - $(BZ2_PATH)/compress.c \ - $(BZ2_PATH)/crctable.c \ - $(BZ2_PATH)/decompress.c \ - $(BZ2_PATH)/huffman.c \ - $(BZ2_PATH)/randtable.c -endif - -ifeq ($(LZMA),0) - Lzma_Files := -else - # https://github.com/sisong/lzma - LZMA_PATH := $(LOCAL_PATH)/../../../lzma/C/ - Lzma_Files := $(LZMA_PATH)/LzmaDec.c \ - $(LZMA_PATH)/Lzma2Dec.c - ifeq ($(TARGET_ARCH_ABI),arm64-v8a) - Lzma_Files += $(LZMA_PATH)/../Asm/arm64/LzmaDecOpt.S - endif - ifeq ($(VCD),0) - else - Lzma_Files+=$(LZMA_PATH)/7zCrc.c \ - $(LZMA_PATH)/7zCrcOpt.c \ - $(LZMA_PATH)/Bra.c \ - $(LZMA_PATH)/Bra86.c \ - $(LZMA_PATH)/BraIA64.c \ - $(LZMA_PATH)/Delta.c \ - $(LZMA_PATH)/Sha256.c \ - $(LZMA_PATH)/Sha256Opt.c \ - $(LZMA_PATH)/Xz.c \ - $(LZMA_PATH)/XzCrc64.c \ - $(LZMA_PATH)/XzCrc64Opt.c \ - $(LZMA_PATH)/XzDec.c \ - $(LZMA_PATH)/CpuArch.c - endif -endif - -ifeq ($(ZSTD),0) - Zstd_Files := -else - # https://github.com/sisong/zstd - ZSTD_PATH := $(LOCAL_PATH)/../../../zstd/lib/ - Zstd_Files := $(ZSTD_PATH)/common/debug.c \ - $(ZSTD_PATH)/common/entropy_common.c \ - $(ZSTD_PATH)/common/error_private.c \ - $(ZSTD_PATH)/common/fse_decompress.c \ - $(ZSTD_PATH)/common/xxhash.c \ - $(ZSTD_PATH)/common/zstd_common.c \ - $(ZSTD_PATH)/decompress/huf_decompress.c \ - $(ZSTD_PATH)/decompress/zstd_ddict.c \ - $(ZSTD_PATH)/decompress/zstd_decompress.c \ - $(ZSTD_PATH)/decompress/zstd_decompress_block.c -endif - -ifeq ($(BROTLI),0) - Brotli_Files:= -else - BROTLI_PATH := $(LOCAL_PATH)/../../../brotli/c/ - Brotli_Files:=$(BROTLI_PATH)/common/constants.c \ - $(BROTLI_PATH)/common/context.c \ - $(BROTLI_PATH)/common/dictionary.c \ - $(BROTLI_PATH)/common/platform.c \ - $(BROTLI_PATH)/common/shared_dictionary.c \ - $(BROTLI_PATH)/common/transform.c \ - $(BROTLI_PATH)/dec/bit_reader.c \ - $(BROTLI_PATH)/dec/decode.c \ - $(BROTLI_PATH)/dec/huffman.c \ - $(BROTLI_PATH)/dec/state.c -endif +DEF_FLAGS := -Os -DANDROID_NDK -DNDEBUG -D_LARGEFILE_SOURCE \ + -D_IS_NEED_CACHE_OLD_BY_COVERS=0 -D_IS_NEED_DEFAULT_CompressPlugin=0 +LINK_FLAGS:= -llog HDP_PATH := $(LOCAL_PATH)/../../ -Hdp_Files := $(HDP_PATH)/file_for_patch.c \ +Src_Files := $(HDP_PATH)/builds/android_ndk_jni_mk/hpatch_jni.c \ + $(HDP_PATH)/builds/android_ndk_jni_mk/hpatch.c \ + $(HDP_PATH)/file_for_patch.c \ $(HDP_PATH)/libHDiffPatch/HPatch/patch.c -ifeq ($(BSD),0) -else - Hdp_Files += $(HDP_PATH)/bsdiff_wrapper/bspatch_wrapper.c -endif -ifeq ($(VCD),0) -else - Hdp_Files += $(HDP_PATH)/vcdiff_wrapper/vcpatch_wrapper.c \ - $(HDP_PATH)/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c -endif - -Src_Files := $(LOCAL_PATH)/hpatch_jni.c \ - $(LOCAL_PATH)/hpatch.c -DEF_FLAGS := -D_IS_NEED_CACHE_OLD_BY_COVERS=0 -D_IS_NEED_DEFAULT_CompressPlugin=0 -DEF_FLAGS += -D_CompressPlugin_zlib ifeq ($(BSD),0) DEF_FLAGS += -D_IS_NEED_BSDIFF=0 else DEF_FLAGS += -D_IS_NEED_BSDIFF=1 + Src_Files += $(HDP_PATH)/bsdiff_wrapper/bspatch_wrapper.c endif + ifeq ($(VCD),0) DEF_FLAGS += -D_IS_NEED_VCDIFF=0 else DEF_FLAGS += -D_IS_NEED_VCDIFF=1 + Src_Files += $(HDP_PATH)/vcdiff_wrapper/vcpatch_wrapper.c \ + $(HDP_PATH)/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +endif + +ifeq ($(ZLIB),0) +else + DEF_FLAGS += -D_CompressPlugin_zlib + LINK_FLAGS+= -lz endif + ifeq ($(BZIP2),0) else + # http://www.bzip.org https://github.com/sisong/bzip2 + BZ2_PATH := $(HDP_PATH)/../bzip2/ DEF_FLAGS += -D_CompressPlugin_bz2 -DBZ_NO_STDIO -I$(BZ2_PATH) + Src_Files += $(BZ2_PATH)/blocksort.c \ + $(BZ2_PATH)/bzlib.c \ + $(BZ2_PATH)/compress.c \ + $(BZ2_PATH)/crctable.c \ + $(BZ2_PATH)/decompress.c \ + $(BZ2_PATH)/huffman.c \ + $(BZ2_PATH)/randtable.c endif + ifeq ($(LZMA),0) else + # https://github.com/sisong/lzma + LZMA_PATH := $(HDP_PATH)/../lzma/C/ DEF_FLAGS += -D_CompressPlugin_lzma -D_CompressPlugin_lzma2 -DZ7_ST -I$(LZMA_PATH) ifeq ($(TARGET_ARCH_ABI),arm64-v8a) DEF_FLAGS += -DZ7_LZMA_DEC_OPT endif + Src_Files += $(LZMA_PATH)/LzmaDec.c \ + $(LZMA_PATH)/Lzma2Dec.c + ifeq ($(TARGET_ARCH_ABI),arm64-v8a) + Src_Files += $(LZMA_PATH)/../Asm/arm64/LzmaDecOpt.S + endif ifeq ($(VCD),0) else DEF_FLAGS += -D_CompressPlugin_7zXZ + Src_Files +=$(LZMA_PATH)/7zCrc.c \ + $(LZMA_PATH)/7zCrcOpt.c \ + $(LZMA_PATH)/Bra.c \ + $(LZMA_PATH)/Bra86.c \ + $(LZMA_PATH)/BraIA64.c \ + $(LZMA_PATH)/Delta.c \ + $(LZMA_PATH)/Sha256.c \ + $(LZMA_PATH)/Sha256Opt.c \ + $(LZMA_PATH)/Xz.c \ + $(LZMA_PATH)/XzCrc64.c \ + $(LZMA_PATH)/XzCrc64Opt.c \ + $(LZMA_PATH)/XzDec.c \ + $(LZMA_PATH)/CpuArch.c endif endif + ifeq ($(ZSTD),0) else + # https://github.com/sisong/zstd + ZSTD_PATH := $(HDP_PATH)/../zstd/lib/ DEF_FLAGS += -D_CompressPlugin_zstd -I$(ZSTD_PATH) -I$(ZSTD_PATH)/common -I$(ZSTD_PATH)/decompress \ - -DZSTD_HAVE_WEAK_SYMBOLS=0 -DZSTD_TRACE=0 -DZSTD_DISABLE_ASM=1 -DZSTDLIB_VISIBLE= -DZSTDLIB_HIDDEN= \ - -DDYNAMIC_BMI2=0 -DZSTD_LEGACY_SUPPORT=0 -DZSTD_LIB_DEPRECATED=0 -DHUF_FORCE_DECOMPRESS_X1=1 \ - -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT=1 -DZSTD_NO_INLINE=1 -DZSTD_STRIP_ERROR_STRINGS=1 -DZSTDERRORLIB_VISIBILITY= + -DZSTD_HAVE_WEAK_SYMBOLS=0 -DZSTD_TRACE=0 -DZSTD_DISABLE_ASM=1 -DZSTDLIB_VISIBLE= -DZSTDLIB_HIDDEN= \ + -DDYNAMIC_BMI2=0 -DZSTD_LEGACY_SUPPORT=0 -DZSTD_LIB_DEPRECATED=0 -DHUF_FORCE_DECOMPRESS_X1=1 \ + -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT=1 -DZSTD_NO_INLINE=1 -DZSTD_STRIP_ERROR_STRINGS=1 -DZSTDERRORLIB_VISIBILITY= + Src_Files +=$(ZSTD_PATH)/common/debug.c \ + $(ZSTD_PATH)/common/entropy_common.c \ + $(ZSTD_PATH)/common/error_private.c \ + $(ZSTD_PATH)/common/fse_decompress.c \ + $(ZSTD_PATH)/common/xxhash.c \ + $(ZSTD_PATH)/common/zstd_common.c \ + $(ZSTD_PATH)/decompress/huf_decompress.c \ + $(ZSTD_PATH)/decompress/zstd_ddict.c \ + $(ZSTD_PATH)/decompress/zstd_decompress.c \ + $(ZSTD_PATH)/decompress/zstd_decompress_block.c endif + ifeq ($(BROTLI),0) else + # https://github.com/google/brotli + BROTLI_PATH := $(HDP_PATH)/../brotli/c/ DEF_FLAGS += -D_CompressPlugin_brotli -I$(BROTLI_PATH)/include + Src_Files +=$(BROTLI_PATH)/common/constants.c \ + $(BROTLI_PATH)/common/context.c \ + $(BROTLI_PATH)/common/dictionary.c \ + $(BROTLI_PATH)/common/platform.c \ + $(BROTLI_PATH)/common/shared_dictionary.c \ + $(BROTLI_PATH)/common/transform.c \ + $(BROTLI_PATH)/dec/bit_reader.c \ + $(BROTLI_PATH)/dec/decode.c \ + $(BROTLI_PATH)/dec/huffman.c \ + $(BROTLI_PATH)/dec/state.c endif -LOCAL_SRC_FILES := $(Src_Files) $(Bz2_Files) $(Lzma_Files) $(Zstd_Files) $(Hdp_Files) -LOCAL_LDLIBS := -llog -lz -LOCAL_CFLAGS := -Os -DANDROID_NDK -DNDEBUG -D_LARGEFILE_SOURCE $(DEF_FLAGS) + +LOCAL_SRC_FILES := $(Src_Files) +LOCAL_LDLIBS := $(LINK_FLAGS) +LOCAL_CFLAGS := $(DEF_FLAGS) include $(BUILD_SHARED_LIBRARY) diff --git a/builds/android_ndk_jni_mk/Application.mk b/builds/android_ndk_jni_mk/Application.mk index 611e5d52..fd17b7a4 100644 --- a/builds/android_ndk_jni_mk/Application.mk +++ b/builds/android_ndk_jni_mk/Application.mk @@ -1,7 +1,7 @@ APP_PLATFORM := android-14 -APP_CFLAGS += -Wno-error=format-security +APP_CFLAGS += -s -Wno-error=format-security APP_CFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden APP_CFLAGS += -ffunction-sections -fdata-sections -APP_LDFLAGS += -Wl,--gc-sections +APP_LDFLAGS += -s -Wl,--gc-sections,--as-needed APP_BUILD_SCRIPT := Android.mk APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64 diff --git a/builds/android_ndk_jni_mk/hpatch.h b/builds/android_ndk_jni_mk/hpatch.h index b94c63e7..1a4c637d 100644 --- a/builds/android_ndk_jni_mk/hpatch.h +++ b/builds/android_ndk_jni_mk/hpatch.h @@ -4,6 +4,7 @@ #define hpatch_h #include #include +#include //int64_t #ifdef __cplusplus extern "C" { #endif diff --git a/libHDiffPatch/HPatch/patch_types.h b/libHDiffPatch/HPatch/patch_types.h index ea3e5bc9..cb1892bd 100644 --- a/libHDiffPatch/HPatch/patch_types.h +++ b/libHDiffPatch/HPatch/patch_types.h @@ -44,6 +44,7 @@ extern "C" { #define _HDIFFPATCH_QUOTE(str) #str #define _HDIFFPATCH_EXPAND_AND_QUOTE(str) _HDIFFPATCH_QUOTE(str) #define HDIFFPATCH_VERSION_STRING _HDIFFPATCH_EXPAND_AND_QUOTE(_HDIFFPATCH_VERSION) +#define HDIFFPATCH_VERSION_NUMBER ((HDIFFPATCH_VERSION_MAJOR*1000+HDIFFPATCH_VERSION_MINOR)*1000+HDIFFPATCH_VERSION_RELEASE) #ifndef hpatch_int typedef int hpatch_int; From 58eb49833bfc791a37d33a4c0c7b046812ddf657 Mon Sep 17 00:00:00 2001 From: sisong Date: Fri, 24 Nov 2023 12:25:39 +0800 Subject: [PATCH 3/8] recode function getDirDiffInfo() & getDirDiffInfoByFile(); --- dirDiffPatch/dir_patch/dir_patch.c | 6 +++--- dirDiffPatch/dir_patch/dir_patch.h | 6 +++--- hdiffz.cpp | 4 ++-- hpatchz.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dirDiffPatch/dir_patch/dir_patch.c b/dirDiffPatch/dir_patch/dir_patch.c index 5017d627..c94b22e2 100644 --- a/dirDiffPatch/dir_patch/dir_patch.c +++ b/dirDiffPatch/dir_patch/dir_patch.c @@ -51,7 +51,7 @@ static const char* kVersionType="HDIFF19"; *(psize)=(size_t)v; } -hpatch_BOOL getDirDiffInfoByFile(const char* diffFileName,TDirDiffInfo* out_info, +hpatch_BOOL getDirDiffInfoByFile(TDirDiffInfo* out_info,const char* diffFileName, hpatch_StreamPos_t diffDataOffert,hpatch_StreamPos_t diffDataSize){ hpatch_BOOL result=hpatch_TRUE; hpatch_TFileStreamInput diffData; @@ -64,7 +64,7 @@ hpatch_BOOL getDirDiffInfoByFile(const char* diffFileName,TDirDiffInfo* out_info check(diffData.base.streamSize>=diffDataSize); diffData.base.streamSize=diffDataSize; } - result=getDirDiffInfo(&diffData.base,out_info); + result=getDirDiffInfo(out_info,&diffData.base); clear: if (!hpatch_TFileStreamInput_close(&diffData)) { LOG_ERR("dir_patch getDirDiffInfoByFile() file close error!\n"); result=hpatch_FALSE; } @@ -189,7 +189,7 @@ hpatch_BOOL read_dirdiff_head(TDirDiffInfo* out_info,_TDirDiffHead* out_head, return _read_dirdiff_head(out_info,out_head,dirDiffFile,0); } -hpatch_BOOL getDirDiffInfo(const hpatch_TStreamInput* diffFile,TDirDiffInfo* out_info){ +hpatch_BOOL getDirDiffInfo(TDirDiffInfo* out_info,const hpatch_TStreamInput* diffFile){ _TDirDiffHead head; return read_dirdiff_head(out_info,&head,diffFile); } diff --git a/dirDiffPatch/dir_patch/dir_patch.h b/dirDiffPatch/dir_patch/dir_patch.h index 543e02cc..72e25df2 100644 --- a/dirDiffPatch/dir_patch/dir_patch.h +++ b/dirDiffPatch/dir_patch/dir_patch.h @@ -66,13 +66,13 @@ typedef struct TDirDiffInfo{ } TDirDiffInfo; -hpatch_BOOL getDirDiffInfo(const hpatch_TStreamInput* diffFile,TDirDiffInfo* out_info); -hpatch_BOOL getDirDiffInfoByFile(const char* diffFileName,TDirDiffInfo* out_info, +hpatch_BOOL getDirDiffInfo(TDirDiffInfo* out_info,const hpatch_TStreamInput* diffFile); +hpatch_BOOL getDirDiffInfoByFile(TDirDiffInfo* out_info,const char* diffFileName, hpatch_StreamPos_t diffDataOffert,hpatch_StreamPos_t diffDataSize); static hpatch_inline hpatch_BOOL getIsDirDiffFile(const char* diffFileName){ TDirDiffInfo dirDiffInfo; - if (!getDirDiffInfoByFile(diffFileName,&dirDiffInfo,0,0)) return hpatch_FALSE; + if (!getDirDiffInfoByFile(&dirDiffInfo,diffFileName,0,0)) return hpatch_FALSE; return dirDiffInfo.isDirDiff; } diff --git a/hdiffz.cpp b/hdiffz.cpp index ab90a592..1cd2069e 100644 --- a/hdiffz.cpp +++ b/hdiffz.cpp @@ -1715,7 +1715,7 @@ int hdiff_resave(const char* diffFileName,const char* outDiffFileName, hpatch_TDecompress* decompressPlugin=&_decompressPlugin; check(hpatch_TFileStreamInput_open(&diffData_in,diffFileName),HDIFF_OPENREAD_ERROR,"open diffFile"); #if (_IS_NEED_DIR_DIFF_PATCH) - check(getDirDiffInfo(&diffData_in.base,&dirDiffInfo),HDIFF_OPENREAD_ERROR,"read diffFile"); + check(getDirDiffInfo(&dirDiffInfo,&diffData_in.base),HDIFF_OPENREAD_ERROR,"read diffFile"); isDirDiff=dirDiffInfo.isDirDiff; if (isDirDiff){ diffInfo=dirDiffInfo.hdiffInfo; @@ -1948,7 +1948,7 @@ int hdiff_dir(const char* _oldPath,const char* _newPath,const char* outDiffFileN hpatch_TChecksum* saved_checksumPlugin=0; { TDirDiffInfo dirinfo; - check(getDirDiffInfo(&diffData_in.base,&dirinfo),DIRDIFF_PATCH_ERROR,"get dir diff info"); + check(getDirDiffInfo(&dirinfo,&diffData_in.base),DIRDIFF_PATCH_ERROR,"get dir diff info"); check(dirinfo.isDirDiff,DIRDIFF_PATCH_ERROR,"dir diffFile data"); check(findDecompress(saved_decompressPlugin,dirinfo.hdiffInfo.compressType), DIRDIFF_PATCH_ERROR,"diff data saved compress type"); diff --git a/hpatchz.c b/hpatchz.c index dc0e834e..ddeaf70d 100644 --- a/hpatchz.c +++ b/hpatchz.c @@ -647,7 +647,7 @@ int hpatch_cmd_line(int argc, const char * argv[]){ if (isSamePath) _return_check(isForceOverwrite,HPATCH_PATHTYPE_ERROR,"oldPath outNewPath same path, overwrite"); #if (_IS_NEED_DIR_DIFF_PATCH) - _return_check(getDirDiffInfoByFile(diffFileName,&dirDiffInfo,diffDataOffert,diffDataSize), + _return_check(getDirDiffInfoByFile(&dirDiffInfo,diffFileName,diffDataOffert,diffDataSize), HPATCH_OPENREAD_ERROR,"input diffFile open read"); isOutDir=(dirDiffInfo.isDirDiff)&&(dirDiffInfo.newPathIsDir); #endif From 78007e233f304e5c5a097e4b679aaab782eb0324 Mon Sep 17 00:00:00 2001 From: sisong Date: Mon, 27 Nov 2023 11:10:02 +0800 Subject: [PATCH 4/8] init print diffFile's infos; --- README.md | 14 +++--- hdiffz.cpp | 21 +++++++-- hdiffz_import_patch.h | 1 + hpatchz.c | 102 ++++++++++++++++++++++++++++++++++++++---- 4 files changed, 118 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f22d3925..f311d109 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ manifest diff: **hdiffz** [options] **-M-old#oldManifestFile -M-new#newManifestF ``` oldPath newPath inputPath can be file or directory(folder), oldPath can empty, and input parameter "" -memory options: +options: -m[-matchScore] DEFAULT; all file load into Memory; best diffFileSize; requires (newFileSize+ oldFileSize*5(or *9 when oldFileSize>=2GB))+O(1) @@ -103,7 +103,6 @@ memory options: all file load as Stream; fast; requires O(oldFileSize*16/matchBlockSize+matchBlockSize*5*parallelThreadNumber)bytes of memory; matchBlockSize>=4, DEFAULT -s-64, recommended 16,32,48,1k,64k,1m etc... -special options: -block-fastMatchBlockSize must run with -m; set block match befor slow byte-by-byte match, DEFAULT -block-4k; @@ -202,9 +201,9 @@ special options: if used -f and write path is exist directory, will always return error. --patch swap to hpatchz mode. - -v output Version info. + -v print Version info. -h (or -?) - output usage info. + print usage info. ``` ## **patch** command line usage: @@ -214,7 +213,7 @@ create SFX: **hpatchz** [-X-exe#selfExecuteFile] **diffFile -X#outSelfExtractAr run SFX: **selfExtractArchive** [options] **oldPath -X outNewPath** extract SFX: **selfExtractArchive** (same as: selfExtractArchive -f "" -X "./") ``` -memory options: +options: -s[-cacheSize] DEFAULT -s-4m; oldPath loaded as Stream; cacheSize can like 262144 or 256k or 512m or 2g etc.... @@ -233,7 +232,6 @@ memory options: (oldFileSize + 3*decompress buffer size)+O(1) bytes of memory. if diffFile is VCDIFF(created by hdiffz -VCD,xdelta3,open-vcdiff), then requires (sourceWindowSize+targetWindowSize + 3*decompress buffer size)+O(1) bytes of memory. -special options: -C-checksumSets set Checksum data for directory patch, DEFAULT -C-new-copy; checksumSets support (can choose multiple): @@ -259,9 +257,9 @@ special options: if patch output file, will always return error; if patch output directory, will overwrite, but not delete needless existing files in directory. - -v output Version info. + -v print Version info. -h (or -?) - output usage info. + print usage info. ``` --- diff --git a/hdiffz.cpp b/hdiffz.cpp index 1cd2069e..24832067 100644 --- a/hdiffz.cpp +++ b/hdiffz.cpp @@ -134,7 +134,7 @@ static void printVersion(){ static void printHelpInfo(){ printf(" -h (or -?)\n" - " output usage info.\n"); + " print usage info.\n"); } static void printUsage(){ @@ -143,6 +143,7 @@ static void printUsage(){ printf("diff usage: hdiffz [options] oldPath newPath outDiffFile\n" "test usage: hdiffz -t oldPath newPath testDiffFile\n" "resave usage: hdiffz [-c-...] diffFile outDiffFile\n" + "print info: hdiffz -info diffFile\n" #if (_IS_NEED_DIR_DIFF_PATCH) "get manifest: hdiffz [-g#...] [-C-checksumType] inputPath -M#outManifestTxtFile\n" "manifest diff: hdiffz [options] -M-old#oldManifestFile -M-new#newManifestFile\n" @@ -150,7 +151,7 @@ static void printUsage(){ " oldPath newPath inputPath can be file or directory(folder),\n" #endif " oldPath can empty, and input parameter \"\"\n" - "memory options:\n" + "options:\n" " -m[-matchScore]\n" " DEFAULT; all file load into Memory; best diffFileSize;\n" " requires (newFileSize+ oldFileSize*5(or *9 when oldFileSize>=2GB))+O(1)\n" @@ -164,7 +165,6 @@ static void printUsage(){ #endif ")bytes of memory;\n" " matchBlockSize>=4, DEFAULT -s-64, recommended 16,32,48,1k,64k,1m etc...\n" - "special options:\n" " -block-fastMatchBlockSize \n" " must run with -m;\n" " set block match befor slow byte-by-byte match, DEFAULT -block-4k;\n" @@ -361,7 +361,9 @@ static void printUsage(){ " if used -f and write path is exist directory, will always return error.\n" " --patch\n" " swap to hpatchz mode.\n" - " -v output Version info.\n" + " -info\n" + " print infos of diffFile.\n" + " -v print Version info.\n" ); printHelpInfo(); printf("\n"); @@ -779,6 +781,7 @@ int hdiff_cmd_line(int argc, const char * argv[]){ diffSets.matchBlockSize=_kNULL_SIZE; diffSets.threadNum=_THREAD_NUMBER_NULL; diffSets.threadNumSearch_s=_THREAD_NUMBER_NULL; + hpatch_BOOL isPrintFileInfo=_kNULL_VALUE; hpatch_BOOL isForceOverwrite=_kNULL_VALUE; hpatch_BOOL isOutputHelp=_kNULL_VALUE; hpatch_BOOL isOutputVersion=_kNULL_VALUE; @@ -893,6 +896,11 @@ int hdiff_cmd_line(int argc, const char * argv[]){ } break; # endif #endif + case 'i':{ + _options_check((isPrintFileInfo==_kNULL_VALUE)&&(op[2]=='n')&&(op[3]=='f') + &&(op[4]=='o')&&(op[5]=='\0'),"-info"); + isPrintFileInfo=hpatch_TRUE; + } break; case '?': case 'h':{ _options_check((isOutputHelp==_kNULL_VALUE)&&(op[2]=='\0'),"-h"); @@ -1028,6 +1036,8 @@ int hdiff_cmd_line(int argc, const char * argv[]){ isOutputVersion=hpatch_FALSE; if (isForceOverwrite==_kNULL_VALUE) isForceOverwrite=hpatch_FALSE; + if (isPrintFileInfo==_kNULL_VALUE) + isPrintFileInfo=hpatch_FALSE; if (isOutputHelp||isOutputVersion){ if (isOutputHelp) printUsage();//with version @@ -1036,6 +1046,9 @@ int hdiff_cmd_line(int argc, const char * argv[]){ if (arg_values.empty()) return 0; //ok } + if (isPrintFileInfo){ + return hpatch_printFilesInfos((int)arg_values.size(),arg_values.data()); + } if (diffSets.isSingleCompressedDiff==_kNULL_VALUE) diffSets.isSingleCompressedDiff=hpatch_FALSE; #if (_IS_NEED_BSDIFF) diff --git a/hdiffz_import_patch.h b/hdiffz_import_patch.h index 9ed5997b..dde50095 100644 --- a/hdiffz_import_patch.h +++ b/hdiffz_import_patch.h @@ -34,6 +34,7 @@ extern "C" { int isSwapToPatchMode(int argc,const char* argv[]); int hpatch_cmd_line(int argc,const char* argv[]); +int hpatch_printFilesInfos(int fileCount,const char* fileNames[]); #ifdef __cplusplus } diff --git a/hpatchz.c b/hpatchz.c index ddeaf70d..606273e3 100644 --- a/hpatchz.c +++ b/hpatchz.c @@ -143,13 +143,16 @@ static void printVersion(){ static void printHelpInfo(){ printf(" -h (or -?)\n" - " output usage info.\n"); + " print usage info.\n"); } +int hpatch_printFilesInfos(int fileCount,const char* fileNames[]); + static void printUsage(){ printVersion(); printf("\n"); printf("patch usage: hpatchz [options] oldPath diffFile outNewPath\n" + "print info: hpatchz -info diffFile\n" #if (_IS_NEED_SFX) "create SFX: hpatchz [-X-exe#selfExecuteFile] diffFile -X#outSelfExtractArchive\n" "run SFX: selfExtractArchive [[options] oldPath -X outNewPath]\n" @@ -161,7 +164,7 @@ static void printUsage(){ # endif #endif " if oldPath is empty input parameter \"\"\n" - "memory options:\n" + "options:\n" " -s[-cacheSize] \n" " DEFAULT -s-4m; oldPath loaded as Stream;\n" " cacheSize can like 262144 or 256k or 512m or 2g etc....\n" @@ -195,7 +198,6 @@ static void printUsage(){ " if diffFile is VCDIFF(created by hdiffz -VCD,xdelta3,open-vcdiff), then requires\n" " (sourceWindowSize+targetWindowSize + 3*decompress buffer size)+O(1) bytes of memory.\n" #endif - "special options:\n" #if (_IS_NEED_DIR_DIFF_PATCH) " -C-checksumSets\n" " set Checksum data for directory patch, DEFAULT -C-new-copy;\n" @@ -239,7 +241,9 @@ static void printUsage(){ " if patch output directory, will overwrite, but not delete\n" " needless existing files in directory.\n" #endif - " -v output Version info.\n" + " -info\n" + " print infos of diffFile.\n" + " -v print Version info.\n" ); printHelpInfo(); printf("\n"); @@ -401,6 +405,7 @@ int isSwapToPatchMode(int argc,const char* argv[]){ } int hpatch_cmd_line(int argc, const char * argv[]){ + hpatch_BOOL isPrintFileInfo=_kNULL_VALUE; hpatch_BOOL isLoadOldAll=_kNULL_VALUE; hpatch_BOOL isForceOverwrite=_kNULL_VALUE; hpatch_BOOL isOutputHelp=_kNULL_VALUE; @@ -505,6 +510,11 @@ int hpatch_cmd_line(int argc, const char * argv[]){ _options_check((kMaxOpenFileNumber!=_kNULL_SIZE),"-n-?"); } break; #endif + case 'i':{ + _options_check((isPrintFileInfo==_kNULL_VALUE)&&(op[2]=='n')&&(op[3]=='f') + &&(op[4]=='o')&&(op[5]=='\0'),"-info"); + isPrintFileInfo=hpatch_TRUE; + } break; case '?': case 'h':{ _options_check((isOutputHelp==_kNULL_VALUE)&&(op[2]=='\0'),"-h"); @@ -526,6 +536,8 @@ int hpatch_cmd_line(int argc, const char * argv[]){ isOutputVersion=hpatch_FALSE; if (isForceOverwrite==_kNULL_VALUE) isForceOverwrite=hpatch_FALSE; + if (isPrintFileInfo==_kNULL_VALUE) + isPrintFileInfo=hpatch_FALSE; #if (_IS_NEED_SFX) if (isRunSFX==_kNULL_VALUE) isRunSFX=hpatch_FALSE; @@ -550,6 +562,9 @@ int hpatch_cmd_line(int argc, const char * argv[]){ #endif return 0; //ok } + if (isPrintFileInfo){ + return hpatch_printFilesInfos(arg_values_size,arg_values); + } #if (_IS_NEED_DIR_DIFF_PATCH) if (kMaxOpenFileNumber==_kNULL_SIZE) kMaxOpenFileNumber=kMaxOpenFileNumber_default_patch; @@ -891,6 +906,77 @@ static hpatch_BOOL findChecksum(hpatch_TChecksum** out_checksumPlugin,const char } #endif + +#if (_IS_NEED_CMDLINE) + +#if (_IS_NEED_DIR_DIFF_PATCH) +#include "dirDiffPatch/dir_patch/dir_patch_private.h" +#endif +static int _printFileInfos(const char* fileName){ + int result=HPATCH_SUCCESS; + int _isInClear=hpatch_FALSE; + hpatch_BOOL isDirDiffInfo=hpatch_FALSE; + hpatch_compressedDiffInfo diffInfo; +#if (_IS_NEED_SINGLE_STREAM_DIFF) + hpatch_BOOL isSingleCompressedDiff=hpatch_FALSE; + hpatch_singleCompressedDiffInfo sdiffInfo; +#endif +#if (_IS_NEED_BSDIFF) + hpatch_BOOL isBsDiff=hpatch_FALSE; + hpatch_BsDiffInfo bsdiffInfo; +#endif +#if (_IS_NEED_VCDIFF) + hpatch_BOOL isVcDiff=hpatch_FALSE; + hpatch_VcDiffInfo vcdiffInfo; +#endif + hpatch_TFileStreamInput diffData; + hpatch_TFileStreamInput_init(&diffData); + {//open + printf("\nfilename: \""); _log_info_utf8(fileName); printf("\"\n"); + check(hpatch_TFileStreamInput_open(&diffData,fileName), + HPATCH_OPENREAD_ERROR,"open file for read"); + printf("fileSize: %" PRIu64 "\n\n",diffData.base.streamSize); + } +#if (_IS_NEED_DIR_DIFF_PATCH) + { + TDirDiffInfo dirDiffInfo={0}; + _TDirDiffHead dirHead={0}; + check(read_dirdiff_head(&dirDiffInfo,&dirHead,&diffData.base),HPATCH_FILEREAD_ERROR,"getDirDiffInfo() read file"); + isDirDiffInfo=dirDiffInfo.isDirDiff; + if (isDirDiffInfo){ +#if (_IS_NEED_SINGLE_STREAM_DIFF) + if (dirDiffInfo.isSingleCompressedDiff){ + isSingleCompressedDiff=dirDiffInfo.isSingleCompressedDiff; + sdiffInfo=dirDiffInfo.sdiffInfo; + }else +#endif + diffInfo=dirDiffInfo.hdiffInfo; + //print dir diff + //todo: + + } + } +#endif +clear: + _isInClear=hpatch_TRUE; + check(hpatch_TFileStreamInput_close(&diffData),HPATCH_FILECLOSE_ERROR,"file close"); + return result; +} + +int hpatch_printFilesInfos(int fileCount,const char* fileNames[]){ + int i; + int result=0; + for (i=0;i=sdiffInfo.stepMemSize+hpatch_kStreamCacheSize*3,HPATCH_MEM_ERROR,"alloc cache memory"); if (!patch_single_compressed_diff(&newData.base,poldData,&diffData.base,sdiffInfo.diffDataPos, sdiffInfo.uncompressedSize,sdiffInfo.compressedSize,decompressPlugin, From b8ffde53d8cfaed6269916b8dcb2d8797b90fc57 Mon Sep 17 00:00:00 2001 From: sisong Date: Wed, 29 Nov 2023 11:45:38 +0800 Subject: [PATCH 5/8] recode: define _singleDiffInfoToHDiffInfo() & _printDirDiffInfos() --- dirDiffPatch/dir_patch/dir_patch.c | 5 +--- hdiffz.cpp | 5 +--- hpatchz.c | 42 +++++++++++++++++------------- libHDiffPatch/HPatch/patch_types.h | 7 +++++ 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/dirDiffPatch/dir_patch/dir_patch.c b/dirDiffPatch/dir_patch/dir_patch.c index c94b22e2..a7989c7c 100644 --- a/dirDiffPatch/dir_patch/dir_patch.c +++ b/dirDiffPatch/dir_patch/dir_patch.c @@ -161,10 +161,7 @@ static hpatch_BOOL _read_dirdiff_head(TDirDiffInfo* out_info,_TDirDiffHead* out_ memcpy(out_info->sdiffInfo.compressType,savedCompressType,savedCompressTypeLen+1); //with '\0' else check(0==strcmp(savedCompressType,out_info->sdiffInfo.compressType)); - out_info->hdiffInfo.newDataSize=out_info->sdiffInfo.newDataSize; - out_info->hdiffInfo.oldDataSize=out_info->sdiffInfo.oldDataSize; - out_info->hdiffInfo.compressedCount=(out_info->sdiffInfo.compressedSize>0)?1:0; - memcpy(out_info->hdiffInfo.compressType,out_info->sdiffInfo.compressType,strlen(out_info->sdiffInfo.compressType)+1); + _singleDiffInfoToHDiffInfo(&out_info->hdiffInfo,&out_info->sdiffInfo); }else #endif check(getCompressedDiffInfo(&out_info->hdiffInfo,&hdiffStream.base)); diff --git a/hdiffz.cpp b/hdiffz.cpp index 24832067..73cd08dc 100644 --- a/hdiffz.cpp +++ b/hdiffz.cpp @@ -1738,10 +1738,7 @@ int hdiff_resave(const char* diffFileName,const char* outDiffFileName, #endif if (getSingleCompressedDiffInfo(&singleDiffInfo,&diffData_in.base,0)){ isSingleDiff=hpatch_TRUE; - diffInfo.newDataSize=singleDiffInfo.newDataSize; - diffInfo.oldDataSize=singleDiffInfo.oldDataSize; - diffInfo.compressedCount=(singleDiffInfo.compressedSize>0)?1:0; - memcpy(diffInfo.compressType,singleDiffInfo.compressType,strlen(singleDiffInfo.compressType)+1); + _singleDiffInfoToHDiffInfo(&diffInfo,&singleDiffInfo); printf(" resave as single stream diffFile \n"); }else if(getCompressedDiffInfo(&diffInfo,&diffData_in.base)){ //ok diff --git a/hpatchz.c b/hpatchz.c index 606273e3..4430387c 100644 --- a/hpatchz.c +++ b/hpatchz.c @@ -911,6 +911,25 @@ static hpatch_BOOL findChecksum(hpatch_TChecksum** out_checksumPlugin,const char #if (_IS_NEED_DIR_DIFF_PATCH) #include "dirDiffPatch/dir_patch/dir_patch_private.h" + +static _printDirDiffInfos(const TDirDiffInfo* dirDiffInfo,const _TDirDiffHead* head){ + if (!dirDiffInfo->isDirDiff) return; + printf(" is dirDiffInfo: true\n"); + printf(" checksumType: \"%s\"\n",dirDiffInfo->checksumType); + printf(" oldPathIsDir: %s\n",dirDiffInfo->oldPathIsDir?"true":"false"); + printf(" newPathIsDir: %s\n",dirDiffInfo->newPathIsDir?"true":"false"); + printf(" new path count: %" PRIu64 " (fileCount:%" PRIu64 ")\n",(hpatch_StreamPos_t)head->newPathCount, + (hpatch_StreamPos_t)(head->sameFilePairCount+head->newRefFileCount)); + printf(" copy from old count: %" PRIu64 " (dataSize: %" PRIu64 ")\n", + (hpatch_StreamPos_t)head->sameFilePairCount,head->sameFileSize); + printf(" ref old file count: %" PRIu64 "\n",(hpatch_StreamPos_t)head->oldRefFileCount); + printf(" ref new file count: %" PRIu64 "\n",(hpatch_StreamPos_t)head->newRefFileCount); + printf(" oldRefSize : %" PRIu64 "\n",dirDiffInfo->hdiffInfo.oldDataSize); + printf(" newRefSize : %" PRIu64 " (all newSize: %" PRIu64 ")\n", + dirDiffInfo->hdiffInfo.newDataSize,dirDiffInfo->hdiffInfo.newDataSize+head->sameFileSize); + printf("\n"); +} + #endif static int _printFileInfos(const char* fileName){ int result=HPATCH_SUCCESS; @@ -1066,14 +1085,11 @@ int hpatch(const char* oldFileName,const char* diffFileName,const char* outNewFi check(!diffData.fileError,HPATCH_FILEREAD_ERROR,"read diffFile"); #if (_IS_NEED_SINGLE_STREAM_DIFF) if (getSingleCompressedDiffInfo(&sdiffInfo,&diffData.base,0)){ - memcpy(diffInfo.compressType,sdiffInfo.compressType,strlen(sdiffInfo.compressType)+1); - diffInfo.compressedCount=(sdiffInfo.compressType[0]!='\0')?1:0; - diffInfo.newDataSize=sdiffInfo.newDataSize; - diffInfo.oldDataSize=sdiffInfo.oldDataSize; + isSingleCompressedDiff=hpatch_TRUE; + _singleDiffInfoToHDiffInfo(&diffInfo,&sdiffInfo); check(sdiffInfo.stepMemSize==(size_t)sdiffInfo.stepMemSize,HPATCH_MEM_ERROR,"stepMemSize too large"); if (patchCacheSize0){ if (strlen(dirDiffInfo->checksumType)==0){ memset(checksumSet,0,sizeof(*checksumSet)); - printf(" NOTE: no checksum saved in diffFile,can not do checksum\n"); + printf(" WARNING: no checksum saved in diffFile,can not do checksum\n"); }else{ if (!findChecksum(&checksumSet->checksumPlugin,dirDiffInfo->checksumType)){ LOG_ERR("not found checksumType \"%s\" ERROR!\n",dirDiffInfo->checksumType); @@ -1299,18 +1315,8 @@ int hpatch_dir(const char* oldPath,const char* diffFileName,const char* outNewPa } } } - {//info - const _TDirDiffHead* head=&dirPatcher.dirDiffHead; - printf("DirPatch new path count: %" PRIu64 " (fileCount:%" PRIu64 ")\n",(hpatch_StreamPos_t)head->newPathCount, - (hpatch_StreamPos_t)(head->sameFilePairCount+head->newRefFileCount)); - printf(" copy from old count: %" PRIu64 " (dataSize: %" PRIu64 ")\n", - (hpatch_StreamPos_t)head->sameFilePairCount,head->sameFileSize); - printf(" ref old file count: %" PRIu64 "\n",(hpatch_StreamPos_t)head->oldRefFileCount); - printf(" ref new file count: %" PRIu64 "\n",(hpatch_StreamPos_t)head->newRefFileCount); - printf("oldRefSize : %" PRIu64 "\ndiffDataSize: %" PRIu64 "\nnewRefSize : %" PRIu64 " (all newSize: %" PRIu64 ")\n", - dirDiffInfo->hdiffInfo.oldDataSize,diffData.base.streamSize,dirDiffInfo->hdiffInfo.newDataSize, - dirDiffInfo->hdiffInfo.newDataSize+head->sameFileSize); - } + _printDirDiffInfos(dirDiffInfo,&dirPatcher.dirDiffHead); + {//mem cache size_t mustAppendMemSize=0; #if (_IS_NEED_SINGLE_STREAM_DIFF) diff --git a/libHDiffPatch/HPatch/patch_types.h b/libHDiffPatch/HPatch/patch_types.h index cb1892bd..52218f7a 100644 --- a/libHDiffPatch/HPatch/patch_types.h +++ b/libHDiffPatch/HPatch/patch_types.h @@ -289,6 +289,13 @@ typedef hpatch_BOOL hpatch_FileError_t;// 0: no error; other: error; hpatch_StreamPos_t stepMemSize; char compressType[hpatch_kMaxPluginTypeLength+1]; //ascii cstring } hpatch_singleCompressedDiffInfo; + + hpatch_inline static void _singleDiffInfoToHDiffInfo(hpatch_compressedDiffInfo* out_diffInfo,const hpatch_singleCompressedDiffInfo* singleDiffInfo){ + out_diffInfo->newDataSize=singleDiffInfo->newDataSize; + out_diffInfo->oldDataSize=singleDiffInfo->oldDataSize; + out_diffInfo->compressedCount=(singleDiffInfo->compressedSize>0)?1:0; + memcpy(out_diffInfo->compressType,singleDiffInfo->compressType,strlen(singleDiffInfo->compressType)+1); + } typedef struct sspatch_listener_t{ void* import; From 78a36038b5954ad3f380ab461659ab5c159f03fd Mon Sep 17 00:00:00 2001 From: sisong Date: Fri, 1 Dec 2023 16:36:20 +0800 Subject: [PATCH 6/8] recode hpatchz printf log, add _getHDiffInfos() & _printHDiffInfos(); --- builds/vc/HPatchZ.vcxproj | 16 +- hdiffz.cpp | 11 +- hpatchz.c | 354 +++++++++++++++++++++++--------------- 3 files changed, 225 insertions(+), 156 deletions(-) diff --git a/builds/vc/HPatchZ.vcxproj b/builds/vc/HPatchZ.vcxproj index c47e12cc..294886be 100644 --- a/builds/vc/HPatchZ.vcxproj +++ b/builds/vc/HPatchZ.vcxproj @@ -194,7 +194,7 @@ Level3 Disabled - WIN32;_ChecksumPlugin_md5;_DEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) Default /wd4819 %(AdditionalOptions) $(IntDir)/obj/_/_/_/%(RelativeDir)/ @@ -213,7 +213,7 @@ Level3 Disabled - WIN32;_ChecksumPlugin_md5;_DEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) Default /wd4819 %(AdditionalOptions) $(IntDir)/obj/_/_/_/%(RelativeDir)/ @@ -232,7 +232,7 @@ Level3 Disabled - WIN32;_ChecksumPlugin_md5;_DEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) Default /wd4819 %(AdditionalOptions) $(IntDir)/obj/_/_/_/%(RelativeDir)/ @@ -251,7 +251,7 @@ Level3 Disabled - WIN32;_ChecksumPlugin_md5;_DEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) Default /wd4819 %(AdditionalOptions) $(IntDir)/obj/_/_/_/%(RelativeDir)/ @@ -269,7 +269,7 @@ Level3 - WIN32;_ChecksumPlugin_md5;NDEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) Default true Speed @@ -299,7 +299,7 @@ Level3 - WIN32;_ChecksumPlugin_md5;NDEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) Default true Speed @@ -329,7 +329,7 @@ Level3 - WIN32;_ChecksumPlugin_md5;NDEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) Default true Speed @@ -359,7 +359,7 @@ Level3 - WIN32;_ChecksumPlugin_md5;NDEBUG;%(PreprocessorDefinitions) + WIN32;_ChecksumPlugin_md5;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) Default true Speed diff --git a/hdiffz.cpp b/hdiffz.cpp index 73cd08dc..8781bee2 100644 --- a/hdiffz.cpp +++ b/hdiffz.cpp @@ -1841,14 +1841,13 @@ struct DirDiffListener:public IDirDiffListener{ virtual void diffRefInfo(size_t oldPathCount,size_t newPathCount,size_t sameFilePairCount, hpatch_StreamPos_t sameFileSize,size_t refOldFileCount,size_t refNewFileCount, hpatch_StreamPos_t refOldFileSize,hpatch_StreamPos_t refNewFileSize){ - printf("\n"); - printf("DirDiff old path count: %" PRIu64 "\n",(hpatch_StreamPos_t)oldPathCount); - printf(" new path count: %" PRIu64 " (fileCount:%" PRIu64 ")\n", + printf(" old path count: %" PRIu64 "\n",(hpatch_StreamPos_t)oldPathCount); + printf(" new path count: %" PRIu64 " (fileCount:%" PRIu64 ")\n", (hpatch_StreamPos_t)newPathCount,(hpatch_StreamPos_t)(sameFilePairCount+refNewFileCount)); - printf(" same file count: %" PRIu64 " (dataSize: %" PRIu64 ")\n", + printf(" same file count: %" PRIu64 " (dataSize: %" PRIu64 ")\n", (hpatch_StreamPos_t)sameFilePairCount,sameFileSize); - printf(" ref old file count: %" PRIu64 "\n",(hpatch_StreamPos_t)refOldFileCount); - printf(" diff new file count: %" PRIu64 "\n",(hpatch_StreamPos_t)refNewFileCount); + printf(" ref old file count: %" PRIu64 "\n",(hpatch_StreamPos_t)refOldFileCount); + printf(" diff new file count: %" PRIu64 "\n",(hpatch_StreamPos_t)refNewFileCount); printf("\nrun hdiffz:\n"); printf(" oldRefSize : %" PRIu64 "\n",refOldFileSize); printf(" newRefSize : %" PRIu64 " (all newSize: %" PRIu64 ")\n",refNewFileSize,refNewFileSize+sameFileSize); diff --git a/hpatchz.c b/hpatchz.c index 4430387c..0e13e216 100644 --- a/hpatchz.c +++ b/hpatchz.c @@ -829,8 +829,6 @@ static hpatch_BOOL getVcDiffDecompressPlugin(hpatch_TDecompress* out_decompressP #endif default: return hpatch_FALSE; //now unsupport } - if (strlen(out_compressType)>0) - printf("hpatchz run vcpatch with decompress plugin: \"%s\"\n",out_compressType); if (decompressPlugin){ *out_decompressPlugin=*decompressPlugin; out_decompressPlugin->decError=hpatch_dec_ok; @@ -847,9 +845,6 @@ static hpatch_BOOL getDecompressPlugin(const hpatch_compressedDiffInfo* diffInfo decompressPlugin=__find_decompressPlugin(diffInfo->compressType); if ((0==decompressPlugin)||(decompressPlugin->open==0)) return hpatch_FALSE; //error } - if (strlen(diffInfo->compressType)>0) - printf("hpatchz run with decompress plugin: \"%s\" (need decompress %d)\n", - diffInfo->compressType,diffInfo->compressedCount); if (decompressPlugin){ *out_decompressPlugin=*decompressPlugin; out_decompressPlugin->decError=hpatch_dec_ok; @@ -907,75 +902,194 @@ static hpatch_BOOL findChecksum(hpatch_TChecksum** out_checksumPlugin,const char #endif -#if (_IS_NEED_CMDLINE) +typedef struct _THDiffInfos{ + hpatch_BOOL isSingleCompressedDiff; + hpatch_BOOL isBsDiff; + hpatch_BOOL isVcDiff; + hpatch_compressedDiffInfo diffInfo; +#if (_IS_NEED_SINGLE_STREAM_DIFF) + hpatch_singleCompressedDiffInfo sdiffInfo; +#endif +#if (_IS_NEED_BSDIFF) + hpatch_BsDiffInfo bsdiffInfo; +#endif +#if (_IS_NEED_VCDIFF) + hpatch_VcDiffInfo vcdiffInfo; +#endif + hpatch_TDecompress _decompressPlugin; +} _THDiffInfos; + +#define _kUnavailableSize hpatch_kNullStreamPos + +static int _getHDiffInfos(_THDiffInfos* out_diffInfos,const hpatch_TFileStreamInput* diffData){ + int result=HPATCH_SUCCESS; + int _isInClear=hpatch_FALSE; + hpatch_TDecompress* decompressPlugin=&out_diffInfos->_decompressPlugin; + hpatch_compressedDiffInfo* diffInfo=&out_diffInfos->diffInfo; + if (getCompressedDiffInfo(diffInfo,&diffData->base)){ + check(diffInfo->oldDataSize!=_kUnavailableSize,HPATCH_HDIFFINFO_ERROR,"saved oldDataSize"); + }else{ +#if (_IS_NEED_SINGLE_STREAM_DIFF) + if (getSingleCompressedDiffInfo(&out_diffInfos->sdiffInfo,&diffData->base,0)){ + out_diffInfos->isSingleCompressedDiff=hpatch_TRUE; + _singleDiffInfoToHDiffInfo(diffInfo,&out_diffInfos->sdiffInfo); + check(diffInfo->oldDataSize!=_kUnavailableSize,HPATCH_HDIFFINFO_ERROR,"saved oldDataSize"); + }else +#endif +#if (_IS_NEED_BSDIFF) + if (getBsDiffInfo(&out_diffInfos->bsdiffInfo,&diffData->base)){ + const char* bsCompressType="bz2"; + *decompressPlugin=_bz2DecompressPlugin_unsz; + decompressPlugin->decError=hpatch_dec_ok; + memcpy(diffInfo->compressType,bsCompressType,strlen(bsCompressType)+1); + diffInfo->compressedCount=out_diffInfos->bsdiffInfo.isEsBsd?1:3; + diffInfo->newDataSize=out_diffInfos->bsdiffInfo.newDataSize; + diffInfo->oldDataSize=_kUnavailableSize; //not saved oldDataSize + out_diffInfos->isBsDiff=hpatch_TRUE; + }else +#endif +#if (_IS_NEED_VCDIFF) + if (getVcDiffInfo(&out_diffInfos->vcdiffInfo,&diffData->base,hpatch_TRUE)){ + diffInfo->newDataSize=out_diffInfos->vcdiffInfo.sumTargetWindowsSize; + diffInfo->oldDataSize=_kUnavailableSize; //not saved oldDataSize + out_diffInfos->isVcDiff=hpatch_TRUE; + if (getVcDiffDecompressPlugin(decompressPlugin,&out_diffInfos->vcdiffInfo,out_diffInfos->diffInfo.compressType)){ + if (decompressPlugin->open) out_diffInfos->diffInfo.compressedCount=3; + else diffInfo->compressedCount=0; + }else{ + LOG_ERR("can not decompress VCDIFF compressID \"%d\" data ERROR!\n",out_diffInfos->vcdiffInfo.compressorID); + check_on_error(HPATCH_COMPRESSTYPE_ERROR); + } + }else +#endif + check(hpatch_FALSE,HPATCH_HDIFFINFO_ERROR,"is hdiff file? get diffInfo"); + } + if (decompressPlugin->open==0){ + if (getDecompressPlugin(diffInfo,decompressPlugin)){ + }else{ + LOG_ERR("can not decompress \"%s\" data ERROR!\n",out_diffInfos->diffInfo.compressType); + check_on_error(HPATCH_COMPRESSTYPE_ERROR); + } + } +clear: + _isInClear=hpatch_TRUE; + check(!diffData->fileError,HPATCH_FILEREAD_ERROR,"read file"); + return result; +} +static void _printHDiffInfos(const _THDiffInfos* diffInfos,hpatch_BOOL isInDirDiff){ + const hpatch_compressedDiffInfo* diffInfo=&diffInfos->diffInfo; + { + const char* typeTag="HDiff"; +#if (_IS_NEED_SINGLE_STREAM_DIFF) + if (diffInfos->isSingleCompressedDiff) typeTag="SHDiff"; +#endif +#if (_IS_NEED_BSDIFF) + if (diffInfos->isBsDiff){ + if (diffInfos->bsdiffInfo.isEsBsd) + typeTag="BSDiff (ENDSLEY)"; + else + typeTag="BSDiff"; + } +#endif +#if (_IS_NEED_VCDIFF) + if (diffInfos->isVcDiff){ + if (diffInfos->vcdiffInfo.isHDiffzAppHead_a) + typeTag="VCDiff (with hdiffz tag)"; + else if (diffInfos->vcdiffInfo.isGoogleVersion) + typeTag="VCDiff (with google tag)"; + else + typeTag="VCDiff"; + } +#endif + printf(" diffDataType: %s %s\n",typeTag,isInDirDiff?"(in DirHDiff)":""); + } + if (diffInfo->oldDataSize==_kUnavailableSize) + printf(" saved oldDataSize: unavailable\n"); + else + printf(" saved oldDataSize: %" PRIu64 "\n",diffInfo->oldDataSize); + printf(" saved newDataSize: %" PRIu64 "\n",diffInfo->newDataSize); + printf(" compressType: \"%s\" (need decompress %d)\n",diffInfo->compressType,diffInfo->compressedCount); +#if (_IS_NEED_SINGLE_STREAM_DIFF) + if (diffInfos->isSingleCompressedDiff) + printf(" stepMemSize: %" PRIu64 "\n",diffInfos->sdiffInfo.stepMemSize); +#endif +#if (_IS_NEED_VCDIFF) + if (diffInfos->isVcDiff){ + printf(" maxSrcWindows: %" PRIu64 "\n",diffInfos->vcdiffInfo.maxSrcWindowsSize); + printf(" maxTargetWindows: %" PRIu64 "\n",diffInfos->vcdiffInfo.maxTargetWindowsSize); + } +#endif +} + + +#if (_IS_NEED_CMDLINE) #if (_IS_NEED_DIR_DIFF_PATCH) #include "dirDiffPatch/dir_patch/dir_patch_private.h" -static _printDirDiffInfos(const TDirDiffInfo* dirDiffInfo,const _TDirDiffHead* head){ +static void _printDirDiffInfos(const TDirDiffInfo* dirDiffInfo,const _TDirDiffHead* head){ if (!dirDiffInfo->isDirDiff) return; - printf(" is dirDiffInfo: true\n"); + printf(" diffDataType: DirHDiff\n"); printf(" checksumType: \"%s\"\n",dirDiffInfo->checksumType); printf(" oldPathIsDir: %s\n",dirDiffInfo->oldPathIsDir?"true":"false"); printf(" newPathIsDir: %s\n",dirDiffInfo->newPathIsDir?"true":"false"); - printf(" new path count: %" PRIu64 " (fileCount:%" PRIu64 ")\n",(hpatch_StreamPos_t)head->newPathCount, - (hpatch_StreamPos_t)(head->sameFilePairCount+head->newRefFileCount)); - printf(" copy from old count: %" PRIu64 " (dataSize: %" PRIu64 ")\n", + printf(" new path count: %" PRIu64 " (fileCount:%" PRIu64 ")\n", + (hpatch_StreamPos_t)head->newPathCount,(hpatch_StreamPos_t)(head->sameFilePairCount+head->newRefFileCount)); + printf(" copy from old count: %" PRIu64 " (copySize: %" PRIu64 ")\n", (hpatch_StreamPos_t)head->sameFilePairCount,head->sameFileSize); - printf(" ref old file count: %" PRIu64 "\n",(hpatch_StreamPos_t)head->oldRefFileCount); - printf(" ref new file count: %" PRIu64 "\n",(hpatch_StreamPos_t)head->newRefFileCount); - printf(" oldRefSize : %" PRIu64 "\n",dirDiffInfo->hdiffInfo.oldDataSize); - printf(" newRefSize : %" PRIu64 " (all newSize: %" PRIu64 ")\n", - dirDiffInfo->hdiffInfo.newDataSize,dirDiffInfo->hdiffInfo.newDataSize+head->sameFileSize); - printf("\n"); + printf(" ref old file count: %" PRIu64 " (oldRefSize: %" PRIu64 ")\n", + (hpatch_StreamPos_t)head->oldRefFileCount,dirDiffInfo->hdiffInfo.oldDataSize); + printf(" ref new file count: %" PRIu64 " (newRefSize: %" PRIu64 ")\n", + (hpatch_StreamPos_t)head->newRefFileCount,dirDiffInfo->hdiffInfo.newDataSize); + printf(" oldSumSize: %" PRIu64 "\n",dirDiffInfo->hdiffInfo.oldDataSize+head->sameFileSize); + printf(" newSumSize: %" PRIu64 "\n",dirDiffInfo->hdiffInfo.newDataSize+head->sameFileSize); + + {//hdiffInfo + _THDiffInfos diffInfos={0}; + diffInfos.diffInfo=dirDiffInfo->hdiffInfo; + #if (_IS_NEED_SINGLE_STREAM_DIFF) + if (dirDiffInfo->isSingleCompressedDiff){ + diffInfos.isSingleCompressedDiff=dirDiffInfo->isSingleCompressedDiff; + diffInfos.sdiffInfo=dirDiffInfo->sdiffInfo; + } + #endif + _printHDiffInfos(&diffInfos,hpatch_TRUE); + } } #endif -static int _printFileInfos(const char* fileName){ + +static int _printFileInfos(const char* fileName,const char* fileTag){ int result=HPATCH_SUCCESS; int _isInClear=hpatch_FALSE; - hpatch_BOOL isDirDiffInfo=hpatch_FALSE; - hpatch_compressedDiffInfo diffInfo; -#if (_IS_NEED_SINGLE_STREAM_DIFF) - hpatch_BOOL isSingleCompressedDiff=hpatch_FALSE; - hpatch_singleCompressedDiffInfo sdiffInfo; -#endif -#if (_IS_NEED_BSDIFF) - hpatch_BOOL isBsDiff=hpatch_FALSE; - hpatch_BsDiffInfo bsdiffInfo; -#endif -#if (_IS_NEED_VCDIFF) - hpatch_BOOL isVcDiff=hpatch_FALSE; - hpatch_VcDiffInfo vcdiffInfo; -#endif + hpatch_BOOL isDirDiff=hpatch_FALSE; hpatch_TFileStreamInput diffData; hpatch_TFileStreamInput_init(&diffData); {//open - printf("\nfilename: \""); _log_info_utf8(fileName); printf("\"\n"); + printf("%sName: \"",fileTag); _log_info_utf8(fileName); printf("\"\n"); check(hpatch_TFileStreamInput_open(&diffData,fileName), HPATCH_OPENREAD_ERROR,"open file for read"); - printf("fileSize: %" PRIu64 "\n\n",diffData.base.streamSize); + printf("%sSize: %" PRIu64 "\n",fileTag,diffData.base.streamSize); } #if (_IS_NEED_DIR_DIFF_PATCH) { TDirDiffInfo dirDiffInfo={0}; _TDirDiffHead dirHead={0}; - check(read_dirdiff_head(&dirDiffInfo,&dirHead,&diffData.base),HPATCH_FILEREAD_ERROR,"getDirDiffInfo() read file"); - isDirDiffInfo=dirDiffInfo.isDirDiff; - if (isDirDiffInfo){ -#if (_IS_NEED_SINGLE_STREAM_DIFF) - if (dirDiffInfo.isSingleCompressedDiff){ - isSingleCompressedDiff=dirDiffInfo.isSingleCompressedDiff; - sdiffInfo=dirDiffInfo.sdiffInfo; - }else -#endif - diffInfo=dirDiffInfo.hdiffInfo; - //print dir diff - //todo: - - } + if (read_dirdiff_head(&dirDiffInfo,&dirHead,&diffData.base)) + isDirDiff=dirDiffInfo.isDirDiff; + check(!diffData.fileError,HPATCH_FILEREAD_ERROR,"read file"); + if (isDirDiff) + _printDirDiffInfos(&dirDiffInfo,&dirHead); } #endif + if (!isDirDiff){ + _THDiffInfos diffInfos={0}; + result=_getHDiffInfos(&diffInfos,&diffData); + if ((result!=HPATCH_SUCCESS)&&(result!=HPATCH_COMPRESSTYPE_ERROR)) + check_on_error(result); + _printHDiffInfos(&diffInfos,isDirDiff); + } + clear: _isInClear=hpatch_TRUE; check(hpatch_TFileStreamInput_close(&diffData),HPATCH_FILECLOSE_ERROR,"file close"); @@ -986,7 +1100,8 @@ int hpatch_printFilesInfos(int fileCount,const char* fileNames[]){ int i; int result=0; for (i=0;i0) printf("\n"); + int ret=_printFileInfos(fileNames[i],"file"); if (result==0) result=ret; } if (fileCount==0) @@ -1030,27 +1145,14 @@ int hpatch(const char* oldFileName,const char* diffFileName,const char* outNewFi int result=HPATCH_SUCCESS; int _isInClear=hpatch_FALSE; double time0=clock_s(); -#if (_IS_NEED_SINGLE_STREAM_DIFF) - hpatch_BOOL isSingleCompressedDiff=hpatch_FALSE; - hpatch_singleCompressedDiffInfo sdiffInfo; -#endif -#if (_IS_NEED_BSDIFF) - hpatch_BOOL isBsDiff=hpatch_FALSE; - hpatch_BsDiffInfo bsdiffInfo; -#endif -#if (_IS_NEED_VCDIFF) - hpatch_BOOL isVcDiff=hpatch_FALSE; - hpatch_VcDiffInfo vcdiffInfo; -#endif - hpatch_TDecompress _decompressPlugin={0}; - hpatch_TDecompress* decompressPlugin=&_decompressPlugin; + _THDiffInfos diffInfos={0}; + hpatch_TDecompress* decompressPlugin=&diffInfos._decompressPlugin; hpatch_TFileStreamOutput newData; hpatch_TFileStreamInput diffData; hpatch_TFileStreamInput oldData; hpatch_TStreamInput* poldData=&oldData.base; TByte* temp_cache=0; size_t temp_cache_size; - hpatch_StreamPos_t savedNewSize=0; int patch_result=HPATCH_SUCCESS; hpatch_TFileStreamInput_init(&oldData); hpatch_TFileStreamInput_init(&diffData); @@ -1078,109 +1180,72 @@ int hpatch(const char* oldFileName,const char* diffFileName,const char* outNewFi } #endif } + printf(" input oldDataSize: %" PRIu64 "\n",poldData->streamSize); + printf(" diffDataSize: %" PRIu64 "\n",diffData.base.streamSize); - { - hpatch_compressedDiffInfo diffInfo; - if (!getCompressedDiffInfo(&diffInfo,&diffData.base)){ - check(!diffData.fileError,HPATCH_FILEREAD_ERROR,"read diffFile"); -#if (_IS_NEED_SINGLE_STREAM_DIFF) - if (getSingleCompressedDiffInfo(&sdiffInfo,&diffData.base,0)){ - isSingleCompressedDiff=hpatch_TRUE; - _singleDiffInfoToHDiffInfo(&diffInfo,&sdiffInfo); - check(sdiffInfo.stepMemSize==(size_t)sdiffInfo.stepMemSize,HPATCH_MEM_ERROR,"stepMemSize too large"); - if (patchCacheSizedecError=hpatch_dec_ok; - memcpy(diffInfo.compressType,bsCompressType,strlen(bsCompressType)+1); - diffInfo.compressedCount=bsdiffInfo.isEsBsd?1:3; - diffInfo.newDataSize=bsdiffInfo.newDataSize; - diffInfo.oldDataSize=poldData->streamSize; //not saved oldDataSize - isBsDiff=hpatch_TRUE; - printf("patch bsdiff4 diffData!\n"); - }else -#endif -#if (_IS_NEED_VCDIFF) - if (getVcDiffInfo(&vcdiffInfo,&diffData.base,hpatch_TRUE)){ - if (getVcDiffDecompressPlugin(decompressPlugin,&vcdiffInfo,diffInfo.compressType)){ - if (decompressPlugin->open) diffInfo.compressedCount=3; - else diffInfo.compressedCount=0; - }else{ - LOG_ERR("can not decompress VCDIFF compressID \"%d\" data ERROR!\n",vcdiffInfo.compressorID); - check_on_error(HPATCH_COMPRESSTYPE_ERROR); - } - diffInfo.newDataSize=vcdiffInfo.sumTargetWindowsSize; - diffInfo.oldDataSize=poldData->streamSize; //not saved oldDataSize - isVcDiff=hpatch_TRUE; - if ((vcpatch_isInMem)&&(!vcdiffInfo.isHDiffzAppHead_a)) - isLoadOldAll=hpatch_TRUE; - printf("patch VCDIFF diffData!\n"); - }else + {//info + int ret=_getHDiffInfos(&diffInfos,&diffData); +#if (_IS_NEED_PRINT_LOG) + if ((ret!=HPATCH_SUCCESS)&&(ret!=HPATCH_COMPRESSTYPE_ERROR)) + check_on_error(ret); + _printHDiffInfos(&diffInfos,hpatch_FALSE); + printf("\n"); #endif - check(hpatch_FALSE,HPATCH_HDIFFINFO_ERROR,"is hdiff file? get diffInfo"); - } - if (poldData->streamSize!=diffInfo.oldDataSize){ - LOG_ERR("oldFile dataSize %" PRIu64 " != diffFile saved oldDataSize %" PRIu64 " ERROR!\n", - poldData->streamSize,diffInfo.oldDataSize); - check_on_error(HPATCH_FILEDATA_ERROR); - } - if ((decompressPlugin->open==0)&&(!getDecompressPlugin(&diffInfo,decompressPlugin))){ - LOG_ERR("can not decompress \"%s\" data ERROR!\n",diffInfo.compressType); - check_on_error(HPATCH_COMPRESSTYPE_ERROR); - } - if (decompressPlugin->open==0) decompressPlugin=0; - savedNewSize=diffInfo.newDataSize; + if (ret!=HPATCH_SUCCESS) + check_on_error(ret); + } + if (decompressPlugin->open==0) decompressPlugin=0; + if ((poldData->streamSize!=diffInfos.diffInfo.oldDataSize)&&(diffInfos.diffInfo.oldDataSize!=_kUnavailableSize)){ + LOG_ERR("input oldFile oldDataSize %" PRIu64 " != diffFile saved oldDataSize %" PRIu64 " ERROR!\n", + poldData->streamSize,diffInfos.diffInfo.oldDataSize); + check_on_error(HPATCH_FILEDATA_ERROR); } - check(hpatch_TFileStreamOutput_open(&newData, outNewFileName,savedNewSize), + + check(hpatch_TFileStreamOutput_open(&newData, outNewFileName,diffInfos.diffInfo.newDataSize), HPATCH_OPENWRITE_ERROR,"open out newFile for write"); #if (_IS_NEED_VCDIFF) - if (isVcDiff) - hpatch_TFileStreamOutput_setRandomOut(&newData,hpatch_TRUE); + if (diffInfos.isVcDiff) hpatch_TFileStreamOutput_setRandomOut(&newData,hpatch_TRUE); #endif - printf("oldDataSize : %" PRIu64 "\ndiffDataSize: %" PRIu64 "\nnewDataSize : %" PRIu64 "\n", - poldData->streamSize,diffData.base.streamSize,newData.base.streamSize); { hpatch_StreamPos_t maxWindowSize=poldData->streamSize; hpatch_size_t mustAppendMemSize=0; #if (_IS_NEED_VCDIFF) - if (isVcDiff){ - hpatch_StreamPos_t maxSrcTargetSize=vcdiffInfo.maxSrcWindowsSize+vcdiffInfo.maxTargetWindowsSize; - maxWindowSize=((!vcdiffInfo.isHDiffzAppHead_a)&&(maxSrcTargetSize<=maxWindowSize+64*(1<<20)))? - maxSrcTargetSize:vcdiffInfo.maxSrcWindowsSize; + if (diffInfos.isVcDiff){ + hpatch_StreamPos_t maxSrcTargetSize=diffInfos.vcdiffInfo.maxSrcWindowsSize+diffInfos.vcdiffInfo.maxTargetWindowsSize; + maxWindowSize=((!diffInfos.vcdiffInfo.isHDiffzAppHead_a)&&(maxSrcTargetSize<=maxWindowSize+64*(1<<20)))? + maxSrcTargetSize:diffInfos.vcdiffInfo.maxSrcWindowsSize; + if ((vcpatch_isInMem)&&(!diffInfos.vcdiffInfo.isHDiffzAppHead_a)) + isLoadOldAll=hpatch_TRUE; } #endif #if (_IS_NEED_SINGLE_STREAM_DIFF) - if (isSingleCompressedDiff) - mustAppendMemSize=(size_t)sdiffInfo.stepMemSize; + if (diffInfos.isSingleCompressedDiff){ + check(diffInfos.sdiffInfo.stepMemSize==(size_t)diffInfos.sdiffInfo.stepMemSize,HPATCH_MEM_ERROR,"stepMemSize too large"); + mustAppendMemSize=(size_t)diffInfos.sdiffInfo.stepMemSize; + } #endif temp_cache=getPatchMemCache(isLoadOldAll,patchCacheSize,mustAppendMemSize,maxWindowSize, &temp_cache_size); } check(temp_cache,HPATCH_MEM_ERROR,"alloc cache memory"); #if (_IS_NEED_SINGLE_STREAM_DIFF) - if (isSingleCompressedDiff){ - check(temp_cache_size>=sdiffInfo.stepMemSize+hpatch_kStreamCacheSize*3,HPATCH_MEM_ERROR,"alloc cache memory"); - if (!patch_single_compressed_diff(&newData.base,poldData,&diffData.base,sdiffInfo.diffDataPos, - sdiffInfo.uncompressedSize,sdiffInfo.compressedSize,decompressPlugin, - sdiffInfo.coverCount,(size_t)sdiffInfo.stepMemSize, + if (diffInfos.isSingleCompressedDiff){ + check(temp_cache_size>=diffInfos.sdiffInfo.stepMemSize+hpatch_kStreamCacheSize*3,HPATCH_MEM_ERROR,"alloc cache memory"); + if (!patch_single_compressed_diff(&newData.base,poldData,&diffData.base,diffInfos.sdiffInfo.diffDataPos, + diffInfos.sdiffInfo.uncompressedSize,diffInfos.sdiffInfo.compressedSize,decompressPlugin, + diffInfos.sdiffInfo.coverCount,(size_t)diffInfos.sdiffInfo.stepMemSize, temp_cache,temp_cache+temp_cache_size,0)) patch_result=HPATCH_SPATCH_ERROR; }else #endif #if (_IS_NEED_BSDIFF) - if (isBsDiff){ + if (diffInfos.isBsDiff){ if (!bspatch_with_cache(&newData.base,poldData,&diffData.base,decompressPlugin, temp_cache,temp_cache+temp_cache_size)) patch_result=HPATCH_BSPATCH_ERROR; }else #endif #if (_IS_NEED_VCDIFF) - if (isVcDiff){ + if (diffInfos.isVcDiff){ if (!vcpatch_with_cache(&newData.base,poldData,&diffData.base,decompressPlugin, vcpatch_isChecksum,temp_cache,temp_cache+temp_cache_size)) patch_result=HPATCH_VCPATCH_ERROR; @@ -1195,7 +1260,7 @@ int hpatch(const char* oldFileName,const char* diffFileName,const char* outNewFi check(!oldData.fileError,HPATCH_FILEREAD_ERROR,"oldFile read"); check(!diffData.fileError,HPATCH_FILEREAD_ERROR,"diffFile read"); check_ferr(newData.fileError,HPATCH_FILEWRITE_ERROR,"out newFile write"); - check_dec(_decompressPlugin.decError); + if (decompressPlugin) check_dec(decompressPlugin->decError); check(hpatch_FALSE,patch_result,"patch run"); } if (newData.out_length!=newData.base.streamSize){ @@ -1275,6 +1340,11 @@ int hpatch_dir(const char* oldPath,const char* diffFileName,const char* outNewPa _log_info_utf8(outNewPath); if (dirDiffInfo->newPathIsDir&&(!hpatch_getIsDirName(outNewPath))) printf("%c",kPatch_dirSeparator); printf("\"\n"); + printf(" diffDataSize: %" PRIu64 "\n",diffData.base.streamSize); +#if (_IS_NEED_PRINT_LOG) + _printDirDiffInfos(dirDiffInfo,&dirPatcher.dirDiffHead); + printf("\n"); +#endif } {//decompressPlugin hpatch_TDecompress* decompressPlugin=&_decompressPlugin; @@ -1305,8 +1375,9 @@ int hpatch_dir(const char* oldPath,const char* diffFileName,const char* outNewPa LOG_ERR("not found checksumType \"%s\" ERROR!\n",dirDiffInfo->checksumType); check_on_error(DIRPATCH_CHECKSUMTYPE_ERROR); } - printf("hpatchz run with checksum plugin: \"%s\" (need checksum %d)\n", - dirDiffInfo->checksumType,wantChecksumCount); + printf("hpatchz run with checksum plugin: \"%s\" (checksumSets:%s%s%s%s)\n",dirDiffInfo->checksumType, + checksumSet->isCheck_dirDiffData?" diff":"",checksumSet->isCheck_oldRefData?" old":"", + checksumSet->isCheck_newRefData?" new":"",checksumSet->isCheck_copyFileData?" copy":""); if (!TDirPatcher_checksum(&dirPatcher,checksumSet)){ check(!TDirPatcher_isDiffDataChecksumError(&dirPatcher), DIRPATCH_CHECKSUM_DIFFDATA_ERROR,"diffFile checksum"); @@ -1315,7 +1386,6 @@ int hpatch_dir(const char* oldPath,const char* diffFileName,const char* outNewPa } } } - _printDirDiffInfos(dirDiffInfo,&dirPatcher.dirDiffHead); {//mem cache size_t mustAppendMemSize=0; From f0fbb7416b919a98ccd2697e893ef12870dc4066 Mon Sep 17 00:00:00 2001 From: sisong Date: Fri, 1 Dec 2023 18:01:30 +0800 Subject: [PATCH 7/8] update version & readme; --- README.md | 11 +++++++++-- README_cn.md | 17 +++++++++++------ libHDiffPatch/HPatch/patch_types.h | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f311d109..186ddcaf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # [HDiffPatch] -[![release](https://img.shields.io/badge/release-v4.6.8-blue.svg)](https://github.com/sisong/HDiffPatch/releases) +[![release](https://img.shields.io/badge/release-v4.6.9-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) @@ -88,6 +88,7 @@ diff usage: **hdiffz** [options] **oldPath newPath outDiffFile** compress usage: **hdiffz** [-c-...] **"" newPath outDiffFile** test usage: **hdiffz** -t **oldPath newPath testDiffFile** resave usage: **hdiffz** [-c-...] **diffFile outDiffFile** +print info: **hdiffz** -info **diffFile** get manifest: **hdiffz** [-g#...] [-C-checksumType] **inputPath -M#outManifestTxtFile** manifest diff: **hdiffz** [options] **-M-old#oldManifestFile -M-new#newManifestFile oldPath newPath outDiffFile** ``` @@ -158,7 +159,7 @@ options: support run by multi-thread parallel, fast! WARNING: code not compatible with it compressed by -c-lzma! -c-zstd[-{0..22}[-dictBits]] DEFAULT level 20 - dictBits can 10--31, DEFAULT 23. + dictBits can 10--30, DEFAULT 23. support run by multi-thread parallel, fast! -C-checksumType set outDiffFile Checksum type for directory diff, DEFAULT -C-fadler64; @@ -201,6 +202,8 @@ options: if used -f and write path is exist directory, will always return error. --patch swap to hpatchz mode. + -info + print infos of diffFile. -v print Version info. -h (or -?) print usage info. @@ -209,10 +212,12 @@ options: ## **patch** command line usage: patch usage: **hpatchz** [options] **oldPath diffFile outNewPath** uncompress usage: **hpatchz** [options] **"" diffFile outNewPath** +print info: **hpatchz** -info **diffFile** create SFX: **hpatchz** [-X-exe#selfExecuteFile] **diffFile -X#outSelfExtractArchive** run SFX: **selfExtractArchive** [options] **oldPath -X outNewPath** extract SFX: **selfExtractArchive** (same as: selfExtractArchive -f "" -X "./") ``` + if oldPath is empty input parameter "" options: -s[-cacheSize] DEFAULT -s-4m; oldPath loaded as Stream; @@ -257,6 +262,8 @@ options: if patch output file, will always return error; if patch output directory, will overwrite, but not delete needless existing files in directory. + -info + print infos of diffFile. -v print Version info. -h (or -?) print usage info. diff --git a/README_cn.md b/README_cn.md index a684098f..25d94af4 100644 --- a/README_cn.md +++ b/README_cn.md @@ -1,5 +1,5 @@ # [HDiffPatch] -[![release](https://img.shields.io/badge/release-v4.6.8-blue.svg)](https://github.com/sisong/HDiffPatch/releases) +[![release](https://img.shields.io/badge/release-v4.6.9-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) @@ -88,12 +88,13 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 压缩一个文件或文件夹: **hdiffz** [-c-...] **"" newPath outDiffFile** 测试补丁是否正确: **hdiffz** -t **oldPath newPath testDiffFile** 补丁使用新的压缩插件另存: **hdiffz** [-c-...] **diffFile outDiffFile** +显示补丁的信息: **hdiffz** -info **diffFile** 创建该版本的校验清单: **hdiffz** [-g#...] [-C-checksumType] **inputPath -M#outManifestTxtFile** 校验输入数据后创建补丁: **hdiffz** [options] **-M-old#oldManifestFile -M-new#newManifestFile oldPath newPath outDiffFile** ``` oldPath、newPath、inputPath 可以是文件或文件夹, oldPath可以为空, 输入参数为 "" -内存选项: +选项: -m[-matchScore] 默认选项; 所有文件都会被加载到内存; 一般生成的补丁文件比较小; 需要的内存大小:(新版本文件大小+ 旧版本文件大小*5(或*9 当旧版本文件大小>=2GB时))+O(1); @@ -104,7 +105,6 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 需要的内存大小: O(旧版本文件大小*16/matchBlockSize+matchBlockSize*5*parallelThreadNumber); 匹配块大小matchBlockSize>=4, 默认为64, 推荐16,32,48,1k,64k,1m等; 一般匹配块越大,内存占用越小,速度越快,但补丁包可能变大。 -其他选项: -block-fastMatchBlockSize 必须和-m配合使用; 在使用较慢的逐字节匹配之前使用基于块的快速匹配, 默认-block-4k; @@ -157,7 +157,7 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 支持多线程并行压缩,很快。 警告: lzma和lzma2是不同的压缩编码格式。 -c-zstd[-{0..22}[-dictBits]] 默认级别 20 - 压缩字典比特数dictBits 可以为10到31, 默认为24。 + 压缩字典比特数dictBits 可以为10到30, 默认为23。 支持多线程并行压缩,很快。 -C-checksumType 为文件夹间diff设置数据校验算法, 默认为fadler64; @@ -198,6 +198,8 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 如果设置了-f,但路径已经存在并且是一个文件夹, 那么会始终返回错误。 --patch 切换到 hpatchz 模式; 可以支持hpatchz命令行的相关参数和功能。 + -info + 显示补丁的信息。 -v 输出程序版本信息。 -h 或 -? 输出命令行帮助信息 (该说明)。 @@ -206,13 +208,15 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 ## patch 命令行用法和参数说明: 打补丁: **hpatchz** [options] **oldPath diffFile outNewPath** 解压缩一个文件或文件夹: **hpatchz** [options] **"" diffFile outNewPath** +显示补丁的信息: **hpatchz** -info **diffFile** 创建一个自释放包: **hpatchz** [-X-exe#selfExecuteFile] **diffFile -X#outSelfExtractArchive** (将目标平台的hpatchz可执行文件和补丁包文件合并成一个可执行文件, 称作自释放包SFX) 执行一个自释放包: **selfExtractArchive** [options] **oldPath -X outNewPath** (利用自释放包来打补丁,将包中自带的补丁数据应用到oldPath上, 合成outNewPath) 执行一个自解压包: **selfExtractArchive** (等价于: selfExtractArchive -f "" -X "./") ``` -内存选项: + oldPath可以为空, 输入参数为 "" +选项: -s[-cacheSize] 默认选项,并且默认设置为-s-4m; oldPath所有文件被当作文件流来加载; cacheSize可以设置为262144 或 256k, 512m, 2g等 @@ -231,7 +235,6 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 那需要的内存大小: (oldFileSize + 3*解压缩缓冲区); 如果diffFile是VCDIFF格式补丁文件(用hdiffz -VCD、xdelta3、open-vcdiff所创建) 那需要的内存大小: (源窗口大小+目标窗口大小 + 3*解压缩缓冲区); -其他选项: -C-checksumSets 为文件夹patch设置校验方式, 默认设置为 -C-new-copy; 校验设置支持(可以多选): @@ -255,6 +258,8 @@ $ git clone https://github.com/sisong/bzip2.git ../bzip2 如果设置了-f,但outNewPath已经存在并且是一个文件夹: 如果patch输出一个文件, 那么会始终返回错误; 如果patch输出一个文件夹, 那么会执行写覆盖, 但不会删除文件夹中已经存在的无关文件。 + -info + 显示补丁的信息。 -v 输出程序版本信息。 -h 或 -? 输出命令行帮助信息 (该说明)。 diff --git a/libHDiffPatch/HPatch/patch_types.h b/libHDiffPatch/HPatch/patch_types.h index 52218f7a..cf8ede96 100644 --- a/libHDiffPatch/HPatch/patch_types.h +++ b/libHDiffPatch/HPatch/patch_types.h @@ -38,7 +38,7 @@ extern "C" { #define HDIFFPATCH_VERSION_MAJOR 4 #define HDIFFPATCH_VERSION_MINOR 6 -#define HDIFFPATCH_VERSION_RELEASE 8 +#define HDIFFPATCH_VERSION_RELEASE 9 #define _HDIFFPATCH_VERSION HDIFFPATCH_VERSION_MAJOR.HDIFFPATCH_VERSION_MINOR.HDIFFPATCH_VERSION_RELEASE #define _HDIFFPATCH_QUOTE(str) #str From 3a923662568d408a9da0e84b99682ba15defdd9c Mon Sep 17 00:00:00 2001 From: sisong Date: Fri, 1 Dec 2023 20:41:32 +0800 Subject: [PATCH 8/8] update changelog; --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34fdd0fa..2bb2a80b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ full changelog at: https://github.com/sisong/HDiffPatch/commits +## [v4.6.9](https://github.com/sisong/HDiffPatch/tree/v4.6.9) - 2023-12-01 +### Added +* cmdline hdiffz & hpatchz support option "-info diffFile", print infos of diffFile; + ## [v4.6.8](https://github.com/sisong/HDiffPatch/tree/v4.6.8) - 2023-11-02 ### Changed * hdiffz.exe&hpatchz.exe support long path on Windows OS;