Skip to content

Commit

Permalink
update lib: HDiffPatch,lzma;
Browse files Browse the repository at this point in the history
  • Loading branch information
sisong committed Sep 10, 2023
1 parent 20f9e89 commit 98d4bcc
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion HDiffPatch
Submodule HDiffPatch updated 33 files
+16 −0 CHANGELOG.md
+9 −3 Makefile
+8 −8 README.md
+1 −1 README_cmdline_cn.md
+3 −0 bsdiff_wrapper/bsdiff_wrapper.cpp
+51 −22 bsdiff_wrapper/bspatch_wrapper.c
+1 −0 bsdiff_wrapper/bspatch_wrapper.h
+30 −9 builds/android_ndk_jni_mk/Android.mk
+1 −1 builds/android_ndk_jni_mk/hpatch.c
+8 −3 builds/android_ndk_jni_mk/hpatch.h
+11 −13 builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java
+3 −0 builds/codeblocks/HDiffZ.cbp
+2 −1 builds/vc/lzma.vcxproj
+4 −4 builds/xcode/hdiffz.xcodeproj/project.pbxproj
+17 −4 builds/xcode/hpatchz.xcodeproj/project.pbxproj
+167 −3 builds/xcode/lzma.xcodeproj/project.pbxproj
+1 −0 builds/xcode/zstd.xcodeproj/project.pbxproj
+30 −0 builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.h
+40 −0 builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.m
+719 −0 builds/xcode_iOS_hpatchz/hpatchz.xcodeproj/project.pbxproj
+7 −0 builds/xcode_iOS_hpatchz/hpatchz.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+8 −0 builds/xcode_iOS_hpatchz/hpatchz.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+3 −3 compress_plugin_demo.h
+1 −1 dirDiffPatch/dir_diff/dir_diff.cpp
+1 −1 dirDiffPatch/dir_patch/ref_stream.c
+1 −1 dirDiffPatch/dir_patch/ref_stream.h
+64 −18 file_for_patch.c
+2 −2 hdiffz.cpp
+10 −8 hpatchz.c
+13 −6 libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp
+1 −1 libHDiffPatch/HPatch/patch_types.h
+21 −11 vcdiff_wrapper/vcdiff_wrapper.cpp
+13 −9 vcdiff_wrapper/vcpatch_wrapper.c
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ZIPDIFF_OBJ := \
HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.o \
lzma/C/Lzma2Enc.o \
lzma/C/LzmaEnc.o \
lzma/C/7zStream.o \
lzma/C/LzFind.o \
lzma/C/LzFindMt.o \
lzma/C/LzFindOpt.o \
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 @@ -43,7 +43,7 @@ ifneq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -DUNALIGNED_OK
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_CFLAGS += -D_LZMA_DEC_OPT
LOCAL_CFLAGS += -DZ7_LZMA_DEC_OPT
endif

include $(BUILD_SHARED_LIBRARY)
Expand Down
6 changes: 3 additions & 3 deletions builds/android_ndk_jni_mk/Android_DEBUG.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Src_Files := $(LOCAL_PATH)/apk_patch_jni.cpp \

LOCAL_SRC_FILES := $(Src_Files) $(Lzma_Files) $(Zlib_Files) $(Hdp_Files) $(Adp_Files)

DEF_FLAGS := -O1 -D_7ZIP_ST -D_IS_USED_MULTITHREAD=1 -D_IS_USED_PTHREAD=1
DEF_FLAGS := -O1 -DZ7_ST -D_IS_USED_MULTITHREAD=1 -D_IS_USED_PTHREAD=1
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
DEF_FLAGS += -D_LZMA_DEC_OPT
DEF_FLAGS += -DZ7_LZMA_DEC_OPT
endif

LOCAL_LDLIBS := -llog
Expand All @@ -49,7 +49,7 @@ ifneq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -DUNALIGNED_OK
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_CFLAGS += -D_LZMA_DEC_OPT
LOCAL_CFLAGS += -DZ7_LZMA_DEC_OPT
endif

LOCAL_SANITIZE := address
Expand Down
3 changes: 3 additions & 0 deletions builds/codeblocks/ZipDiff.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
<Unit filename="../../lzma/C/Lzma2Enc.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/7zStream.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/LzmaDec.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
20 changes: 18 additions & 2 deletions builds/vc/ApkDiffPatch.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31402.337
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApkNormalized", "ApkNormalized.vcxproj", "{B7BA5C32-5DC9-431D-BFD7-35ED679CD797}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipPatch", "ZipPatch.vcxproj", "{69753A53-0320-4AF9-ADE7-A70F0C38358F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipDiff", "ZipDiff.vcxproj", "{96E107FE-4A2E-4008-9FDE-8CEAA695BFCA}"
ProjectSection(ProjectDependencies) = postProject
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF} = {0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzma", "..\..\HDiffPatch\builds\vc\lzma.vcxproj", "{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -41,8 +46,19 @@ Global
{96E107FE-4A2E-4008-9FDE-8CEAA695BFCA}.Release|x64.Build.0 = Release|x64
{96E107FE-4A2E-4008-9FDE-8CEAA695BFCA}.Release|x86.ActiveCfg = Release|Win32
{96E107FE-4A2E-4008-9FDE-8CEAA695BFCA}.Release|x86.Build.0 = Release|Win32
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Debug|x64.ActiveCfg = Debug|x64
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Debug|x64.Build.0 = Debug|x64
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Debug|x86.ActiveCfg = Debug|Win32
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Debug|x86.Build.0 = Debug|Win32
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Release|x64.ActiveCfg = Release|x64
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Release|x64.Build.0 = Release|x64
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Release|x86.ActiveCfg = Release|Win32
{0849CD0E-1B9B-44EB-8937-A278B6A7E2CF}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AAE76966-D194-4E24-AFFF-7E3CAB6E7F9C}
EndGlobalSection
EndGlobal
17 changes: 5 additions & 12 deletions builds/vc/ZipDiff.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@
<ClCompile Include="..\..\HDiffPatch\libHDiffPatch\HPatch\patch.c" />
<ClCompile Include="..\..\HDiffPatch\libParallel\parallel_channel.cpp" />
<ClCompile Include="..\..\HDiffPatch\libParallel\parallel_import.cpp" />
<ClCompile Include="..\..\lzma\C\Alloc.c" />
<ClCompile Include="..\..\lzma\C\CpuArch.c" />
<ClCompile Include="..\..\lzma\C\LzFind.c" />
<ClCompile Include="..\..\lzma\C\LzFindMt.c" />
<ClCompile Include="..\..\lzma\C\LzFindOpt.c" />
<ClCompile Include="..\..\lzma\C\Lzma2Enc.c" />
<ClCompile Include="..\..\lzma\C\LzmaDec.c" />
<ClCompile Include="..\..\lzma\C\Lzma2Dec.c" />
<ClCompile Include="..\..\lzma\C\LzmaEnc.c" />
<ClCompile Include="..\..\lzma\C\MtCoder.c" />
<ClCompile Include="..\..\lzma\C\MtDec.c" />
<ClCompile Include="..\..\lzma\C\Threads.c" />
<ClCompile Include="..\..\src\diff\DiffData.cpp" />
<ClCompile Include="..\..\src\diff\Differ.cpp" />
<ClCompile Include="..\..\src\diff\OldRef.cpp" />
Expand All @@ -67,6 +55,11 @@
<ClCompile Include="..\..\zlib1.2.11\uncompr.c" />
<ClCompile Include="..\..\zlib1.2.11\zutil.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\HDiffPatch\builds\vc\lzma.vcxproj">
<Project>{0849cd0e-1b9b-44eb-8937-a278b6a7e2cf}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{96E107FE-4A2E-4008-9FDE-8CEAA695BFCA}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
Expand Down
8 changes: 6 additions & 2 deletions builds/xcode/lzma.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
0D5B125B28F1862700D12B51 /* Lzma2Dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5B125A28F1862700D12B51 /* Lzma2Dec.c */; };
0D5B125D28F1865800D12B51 /* Lzma2Enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5B125C28F1865800D12B51 /* Lzma2Enc.c */; };
0D5B125D28F1865800D12B51 /* 7zStream.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5B125C28F1865800D12B51 /* 7zStream.c */; };
0D5B126328F189B300D12B51 /* CpuArch.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5B126028F189B300D12B51 /* CpuArch.c */; };
0D5B126428F189B300D12B51 /* LzFindOpt.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5B126128F189B300D12B51 /* LzFindOpt.c */; };
0D5B126528F189B300D12B51 /* MtCoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5B126228F189B300D12B51 /* MtCoder.c */; };
Expand All @@ -22,6 +23,7 @@
/* Begin PBXFileReference section */
0D5B125A28F1862700D12B51 /* Lzma2Dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Lzma2Dec.c; path = ../../lzma/C/Lzma2Dec.c; sourceTree = "<group>"; };
0D5B125C28F1865800D12B51 /* Lzma2Enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Lzma2Enc.c; path = ../../lzma/C/Lzma2Enc.c; sourceTree = "<group>"; };
0D5B125C28F1865800D12B51 /* 7zStream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = 7zStream.c; path = ../../lzma/C/7zStream.c; sourceTree = "<group>"; };
0D5B126028F189B300D12B51 /* CpuArch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CpuArch.c; path = ../../lzma/C/CpuArch.c; sourceTree = "<group>"; };
0D5B126128F189B300D12B51 /* LzFindOpt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = LzFindOpt.c; path = ../../lzma/C/LzFindOpt.c; sourceTree = "<group>"; };
0D5B126228F189B300D12B51 /* MtCoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = MtCoder.c; path = ../../lzma/C/MtCoder.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -51,6 +53,7 @@
0D5B126128F189B300D12B51 /* LzFindOpt.c */,
0D5B126228F189B300D12B51 /* MtCoder.c */,
0D5B125C28F1865800D12B51 /* Lzma2Enc.c */,
0D5B125C28F1865800D12B51 /* 7zStream.c */,
0D5B125A28F1862700D12B51 /* Lzma2Dec.c */,
D676B254220FB46900874D63 /* LzFindMt.c */,
D676B253220FB46900874D63 /* Threads.c */,
Expand Down Expand Up @@ -139,6 +142,7 @@
files = (
0D5B126328F189B300D12B51 /* CpuArch.c in Sources */,
0D5B125D28F1865800D12B51 /* Lzma2Enc.c in Sources */,
0D5B125D28F1865800D12B51 /* 7zStream.c in Sources */,
D68B02D7205A4551001F3C40 /* LzmaEnc.c in Sources */,
0D5B125B28F1862700D12B51 /* Lzma2Dec.c in Sources */,
D68B02D9205A4626001F3C40 /* LzFind.c in Sources */,
Expand Down Expand Up @@ -196,7 +200,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
_7ZIP_ST,
Z7_ST,
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -252,7 +256,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PREPROCESSOR_DEFINITIONS = _7ZIP_ST;
GCC_PREPROCESSOR_DEFINITIONS = Z7_ST;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand Down
2 changes: 1 addition & 1 deletion lzma
Submodule lzma updated 514 files
21 changes: 10 additions & 11 deletions src/normalized/normalized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
struct TFileValue{
std::string fileName;
int fileIndex;
static bool inline isInSignDir(const std::string& s){
return (s.find("META-INF/")==0)||(s.find("META-INF\\")==0);
}
static bool inline isEndWith(const std::string& s,const char* sub){
return (s.find(sub)==s.size()-strlen(sub));
}
static bool inline isSignMFFile(const std::string& s){
return (s=="META-INF/MANIFEST.MF")||(s=="META-INF\\MANIFEST.MF");
}
struct TCmp{
inline TCmp(int fileCount):_fileCount(fileCount){}
static bool inline isInSignDir(const std::string& s){
return (s.find("META-INF/")==0)||(s.find("META-INF\\")==0);
}
static bool inline isEndWith(const std::string& s,const char* sub){
return (s.find(sub)==s.size()-strlen(sub));
}
static bool inline isSignMFFile(const std::string& s){
return (s=="META-INF/MANIFEST.MF")||(s=="META-INF\\MANIFEST.MF");
}
size_t _v(const TFileValue& x)const{
size_t xi=x.fileIndex;
if (isInSignDir(x.fileName)){
Expand Down Expand Up @@ -111,8 +111,7 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,
if (UnZipper_file_isApkV1Sign(&unzipper,fileIndex)){
++jarSignFileCount;
if (isHaveApkV2Sign){
const char* fn=UnZipper_file_nameBegin(&unzipper,fileIndex);
removedFiles.push_back(std::string(fn,fn+UnZipper_file_nameLen(&unzipper,fileIndex)));
removedFiles.push_back(files[i].fileName);
continue; //remove JarSign(ApkV1Sign) when found ApkV2Sign
}
}
Expand Down

0 comments on commit 98d4bcc

Please sign in to comment.