Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support long path on Windows OS #364

Merged
merged 5 commits into from
Nov 3, 2023
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
16 changes: 10 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

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

## [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;

## [v4.6.7](https://github.com/sisong/HDiffPatch/tree/v4.6.7) - 2023-08-31
### Added
* patch compatible with another BSDIFF format "ENDSLEY/BSDIFF43", https://github.com/mendsley/bsdiff

## [v4.6.6](https://github.com/sisong/HDiffPatch/tree/v4.6.6) - 2023-08-27
### Added
* patch demo SDK for iOS, out lib file libhpatchz.a;
* patch SDK support iOS & MacOS, out lib file libhpatchz.a;

## [v4.6.3](https://github.com/sisong/HDiffPatch/tree/v4.6.3) - 2023-05-19
### Added
* support for block devices on linux; by author [Alexander Zakharov](https://github.com/uglym8);
* support block devices on linux OS; by contributor [Alexander Zakharov](https://github.com/uglym8);

## [v4.6.0](https://github.com/sisong/HDiffPatch/tree/v4.6.0) - 2023-04-20
### Added
Expand Down Expand Up @@ -91,7 +95,7 @@ full changelog at: https://github.com/sisong/HDiffPatch/commits
## [v3.0.7](https://github.com/sisong/HDiffPatch/tree/v3.0.7) - 2019-12-19
### Fixed
* fix a bug when create dir's manifest file without checksum (`$hdiffz -C-no -M...`);
* fix a bug when create dir's manifest file on windows operating system;
* fix a bug when create dir's manifest file on Windows OS;

## [v3.0.6](https://github.com/sisong/HDiffPatch/tree/v3.0.6) - 2019-09-18
### Fixed
Expand All @@ -103,7 +107,7 @@ full changelog at: https://github.com/sisong/HDiffPatch/commits

## [v3.0.4](https://github.com/sisong/HDiffPatch/tree/v3.0.4) - 2019-09-06
### Fixed
* fix dir_patch can't remove some files bug when patch to same dir on Windows operating system;
* fix dir_patch can't remove some files bug when patch to same dir on Windows OS;

## [v3.0.0](https://github.com/sisong/HDiffPatch/tree/v3.0.0) - 2019-03-01
### Added
Expand Down Expand Up @@ -179,7 +183,7 @@ full changelog at: https://github.com/sisong/HDiffPatch/commits

## [v1.1.4](https://github.com/sisong/HDiffPatch/tree/v1.1.4) - 2017-06-10
### Added
* add MakeFile for support make; by author [JayXon](https://github.com/JayXon);
* add MakeFile for support make; by contributor [JayXon](https://github.com/JayXon);
### Changed
* slightly optimize diff required memory size;

Expand All @@ -189,7 +193,7 @@ full changelog at: https://github.com/sisong/HDiffPatch/commits

## [v1.1.2](https://github.com/sisong/HDiffPatch/tree/v1.1.2) - 2016-09-01
### Fixed
* fix a bug when write out diffFile on Windows operating system; by author [Wenhai Lin](https://github.com/WenhaiLin);
* fix a bug when write out diffFile on Windows OS; by contributor [Wenhai Lin](https://github.com/WenhaiLin);

## [v1.1.0](https://github.com/sisong/HDiffPatch/tree/v1.1.0) - 2014-09-13
### Added
Expand Down
35 changes: 23 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DIR_DIFF := 1
MT := 1
# 0: not need zlib; 1: compile zlib source code; 2: used -lz to link zlib lib;
ZLIB := 2
# 0: not need lzma; 1: compile lzma source code; 2: used -llzma to link lzma lib;
LZMA := 1
ARM64ASM := 0
RISCV32 := 0
Expand Down Expand Up @@ -66,8 +67,8 @@ else
endif

LZMA_PATH := ../lzma/C
ifeq ($(LZMA),0)
else # https://www.7-zip.org https://github.com/sisong/lzma
ifeq ($(LZMA),1)
# https://www.7-zip.org https://github.com/sisong/lzma
HPATCH_OBJ += $(LZMA_PATH)/LzmaDec.o \
$(LZMA_PATH)/Lzma2Dec.o \
$(LZMA_PATH)/CpuArch.o \
Expand Down Expand Up @@ -272,22 +273,29 @@ else
endif
ifeq ($(LZMA),0)
else
DEF_FLAGS += -D_CompressPlugin_lzma -D_CompressPlugin_lzma2 -I$(LZMA_PATH)
DEF_FLAGS += -D_CompressPlugin_lzma -D_CompressPlugin_lzma2
ifeq ($(VCD),0)
else
DEF_FLAGS += -D_CompressPlugin_7zXZ -DUSE_CRC_EMU
DEF_FLAGS += -D_CompressPlugin_7zXZ
endif
ifeq ($(ARM64ASM),0)
else
DEF_FLAGS += -DZ7_LZMA_DEC_OPT
ifeq ($(LZMA),1)
DEF_FLAGS += -I$(LZMA_PATH)
ifeq ($(ARM64ASM),0)
else
DEF_FLAGS += -DZ7_LZMA_DEC_OPT
endif
ifeq ($(VCD),0)
else
DEF_FLAGS += -DUSE_CRC_EMU
endif
endif
endif
ifeq ($(ZSTD),0)
else
DEF_FLAGS += -D_CompressPlugin_zstd
ifeq ($(ZSTD),1)
DEF_FLAGS += -DZSTD_HAVE_WEAK_SYMBOLS=0 -DZSTD_TRACE=0 -DZSTD_DISABLE_ASM=1 -DZSTDLIB_VISIBLE= -DZSTDLIB_HIDDEN= \
-I$(ZSTD_PATH) -I$(ZSTD_PATH)/common -I$(ZSTD_PATH)/compress -I$(ZSTD_PATH)/decompress
DEF_FLAGS += -D_CompressPlugin_zstd
ifeq ($(ZSTD),1)
DEF_FLAGS += -DZSTD_HAVE_WEAK_SYMBOLS=0 -DZSTD_TRACE=0 -DZSTD_DISABLE_ASM=1 -DZSTDLIB_VISIBLE= -DZSTDLIB_HIDDEN= \
-I$(ZSTD_PATH) -I$(ZSTD_PATH)/common -I$(ZSTD_PATH)/compress -I$(ZSTD_PATH)/decompress
endif
endif

Expand All @@ -299,7 +307,7 @@ else
DEF_FLAGS += \
-DZSTD_MULTITHREAD=1 \
-D_IS_USED_MULTITHREAD=1 \
-D_IS_USED_PTHREAD=1
-D_IS_USED_CPP11THREAD=1
endif

PATCH_LINK :=
Expand All @@ -312,6 +320,9 @@ endif
ifeq ($(ZSTD),2)
PATCH_LINK += -lzstd # link zstd
endif
ifeq ($(LZMA),2)
PATCH_LINK += -llzma # link lzma
endif
ifeq ($(MT),0)
else
PATCH_LINK += -lpthread # link pthread
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# [HDiffPatch](https://github.com/sisong/HDiffPatch)
[![release](https://img.shields.io/badge/release-v4.6.7-blue.svg)](https://github.com/sisong/HDiffPatch/releases)
[![release](https://img.shields.io/badge/release-v4.6.8-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)

[![release](https://img.shields.io/github/downloads/sisong/HDiffPatch/total?color=blue)](https://github.com/sisong/HDiffPatch/releases)
[![Build Status](https://github.com/sisong/HDiffPatch/workflows/ci/badge.svg?branch=master)](https://github.com/sisong/HDiffPatch/actions?query=workflow%3Aci+branch%3Amaster)
[![Build status](https://ci.appveyor.com/api/projects/status/t9ow8dft8lt898cv/branch/master?svg=true)](https://ci.appveyor.com/project/sisong/hdiffpatch/branch/master)

Expand Down Expand Up @@ -481,10 +482,10 @@ adding test hpatchz&hsynz&sfpatcher on Android, CPU Kirin980(2×A76 2.6G + 2×A7
|hsynz p1 zstd|57.74%|534M|2.7MB/s|24M|28M|151MB/s|52MB/s|
|hsynz p8 zstd|57.74%|3434M|13.2MB/s|24M|28M|265MB/s|95MB/s|
|archive-patcher|31.65%|1448M|0.9MB/s|558M|587M|14MB/s|
|sfpatcher-1 zstd|31.08%|818M|2.3MB/s|15M|19M|201MB/s|92MB/s|
|sfpatcher-1 zstd|31.07%|1025M|4.6MB/s|18M|25M|424MB/s|189MB/s|
|sfpatcher-2 lzma2|24.11%|976M|2.1MB/s|15M|20M|37MB/s|19MB/s|
|sfpatcher-2 lzma2|24.15%|968M|5.0MB/s|20M|26M|108MB/s|45MB/s|
|sfpatcher-1 p1 zstd|31.08%|818M|2.3MB/s|15M|19M|201MB/s|92MB/s|
|sfpatcher-1 p8 zstd|31.07%|1025M|4.6MB/s|18M|25M|424MB/s|189MB/s|
|sfpatcher-2 p1 lzma2|24.11%|976M|2.1MB/s|15M|20M|37MB/s|19MB/s|
|sfpatcher-2 p8 lzma2|24.15%|968M|5.0MB/s|20M|26M|108MB/s|45MB/s|


---
Expand Down
2 changes: 1 addition & 1 deletion builds/android_ndk_jni_mk/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ else
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
-DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT=1 -DZSTD_NO_INLINE=1 -DZSTD_STRIP_ERROR_STRINGS=1 -DZSTDERRORLIB_VISIBILITY=
endif
ifeq ($(BROTLI),0)
else
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 @@ -2,6 +2,7 @@
// Created by sisong on 2019-12-30.
#include "hpatch.h"

#define _IS_NEED_PRINT_LOG 0
#ifndef _IS_USED_MULTITHREAD
#define _IS_USED_MULTITHREAD 0
#endif
Expand All @@ -18,9 +19,9 @@
extern "C" {
#endif
void bz_internal_error(int errcode){
fprintf(stderr,"\n\nbzip2 v%s: internal error number %d.\n",
LOG_ERR("\n\nbzip2 v%s: internal error number %d.\n",
BZ2_bzlibVersion(),errcode);
exit(3);
exit(HPATCH_DECOMPRESSER_DECOMPRESS_ERROR);
}
#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion builds/codeblocks/HDiffZ.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Add option="-fexceptions" />
<Add option="-D_LARGEFILE_SOURCE" />
<Add option="-D_FILE_OFFSET_BITS=64" />
<Add option="-D_IS_USED_PTHREAD=1" />
<Add option="-D_IS_USED_CPP11THREAD=1" />
<Add option="-D_ChecksumPlugin_md5" />
<Add option="-DZSTD_MULTITHREAD=1" />
<Add option="-DZSTD_HAVE_WEAK_SYMBOLS=0" />
Expand Down
24 changes: 24 additions & 0 deletions builds/vc/HDiffZ.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
Expand All @@ -221,6 +224,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
Expand All @@ -237,6 +243,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
Expand All @@ -253,6 +262,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand Down Expand Up @@ -280,6 +292,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
Expand Down Expand Up @@ -307,6 +322,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
Expand Down Expand Up @@ -334,6 +352,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
Expand Down Expand Up @@ -362,6 +383,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\libmd5\md5.c" />
Expand Down
24 changes: 24 additions & 0 deletions builds/vc/HPatchZ.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
Expand All @@ -221,6 +224,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
Expand All @@ -237,6 +243,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
Expand All @@ -253,6 +262,9 @@
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand Down Expand Up @@ -280,6 +292,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
Expand Down Expand Up @@ -307,6 +322,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
Expand Down Expand Up @@ -334,6 +352,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
Expand Down Expand Up @@ -362,6 +383,9 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Manifest>
<AdditionalManifestFiles>longPathAware.exe.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\libmd5\md5.c" />
Expand Down
7 changes: 7 additions & 0 deletions builds/vc/longPathAware.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<assembly>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>
2 changes: 2 additions & 0 deletions compress_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "libParallel/parallel_channel.h"
#include "libHDiffPatch/HDiff/private_diff/mem_buf.h"

namespace{
#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -149,6 +150,7 @@ void _threadRunCallBack(int threadIndex,void* _workData){
#undef _check_br
}

} // namespace

hpatch_StreamPos_t parallel_compress_blocks(hdiff_TParallelCompress* pc,
int threadNum,size_t blockDictSize,size_t blockSize,
Expand Down
Loading
Loading