diff --git a/C/fast-lzma2/lzma2_enc.c b/C/fast-lzma2/lzma2_enc.c index 2aae5058..2201ef45 100644 --- a/C/fast-lzma2/lzma2_enc.c +++ b/C/fast-lzma2/lzma2_enc.c @@ -352,7 +352,7 @@ static size_t RMF_bitpackExtendMatch(const BYTE* const data, ptrdiff_t dist = start_index - link; if (limit > start_index + (ptrdiff_t)kMatchLenMax) limit = start_index + kMatchLenMax; - while (end_index < limit && end_index - (table[end_index] & RADIX_LINK_MASK) == dist) { + while (end_index < limit && end_index - (ptrdiff_t)(table[end_index] & RADIX_LINK_MASK) == dist) { end_index += table[end_index] >> RADIX_LINK_BITS; } if (end_index >= limit) { @@ -381,7 +381,7 @@ static size_t RMF_structuredExtendMatch(const BYTE* const data, ptrdiff_t dist = start_index - link; if (limit > start_index + (ptrdiff_t)kMatchLenMax) limit = start_index + kMatchLenMax; - while (end_index < limit && end_index - GetMatchLink(table, end_index) == dist) { + while (end_index < limit && end_index - (ptrdiff_t)GetMatchLink(table, end_index) == dist) { end_index += GetMatchLength(table, end_index); } if (end_index >= limit) { diff --git a/C/fast-lzma2/radix_engine.h b/C/fast-lzma2/radix_engine.h index a5190414..1697f942 100644 --- a/C/fast-lzma2/radix_engine.h +++ b/C/fast-lzma2/radix_engine.h @@ -1028,7 +1028,7 @@ static size_t ExtendMatch(const FL2_matchTable* const tbl, { ptrdiff_t end_index = start_index + length; ptrdiff_t const dist = start_index - link; - while (end_index < limit && end_index - GetMatchLink(end_index) == dist) { + while (end_index < limit && end_index - (ptrdiff_t)GetMatchLink(end_index) == dist) { end_index += GetMatchLength(end_index); } if (end_index >= limit) { diff --git a/CPP/7zip/Bundles/Alone/makefile b/CPP/7zip/Bundles/Alone/makefile index f93205b8..43524082 100644 --- a/CPP/7zip/Bundles/Alone/makefile +++ b/CPP/7zip/Bundles/Alone/makefile @@ -234,6 +234,7 @@ COMPRESS_OBJS = $(COMPRESS_OBJS) \ $O\ZstdDecoder.obj \ $O\ZstdEncoder.obj \ $O\ZstdRegister.obj \ + $O\FastLzma2Register.obj \ BROTLI_OBJS = \ $O/br_backward_references.obj \ diff --git a/CPP/7zip/Bundles/Codec_flzma2/StdAfx.cpp b/CPP/7zip/Bundles/Codec_flzma2/StdAfx.cpp new file mode 100644 index 00000000..d0feea85 --- /dev/null +++ b/CPP/7zip/Bundles/Codec_flzma2/StdAfx.cpp @@ -0,0 +1,3 @@ +// StdAfx.cpp + +#include "StdAfx.h" diff --git a/CPP/7zip/Bundles/Codec_flzma2/StdAfx.h b/CPP/7zip/Bundles/Codec_flzma2/StdAfx.h new file mode 100644 index 00000000..2854ff3e --- /dev/null +++ b/CPP/7zip/Bundles/Codec_flzma2/StdAfx.h @@ -0,0 +1,8 @@ +// StdAfx.h + +#ifndef __STDAFX_H +#define __STDAFX_H + +#include "../../../Common/Common.h" + +#endif diff --git a/CPP/7zip/Bundles/Codec_flzma2/makefile b/CPP/7zip/Bundles/Codec_flzma2/makefile new file mode 100644 index 00000000..30b42cb2 --- /dev/null +++ b/CPP/7zip/Bundles/Codec_flzma2/makefile @@ -0,0 +1,50 @@ +PROG = flzma2.dll +DEF_FILE = ../../Compress/Codec.def +CFLAGS = $(CFLAGS) -DNEED_7ZIP_GUID -DNO_XXHASH + +7ZIP_COMMON_OBJS = \ + $O\CWrappers.obj \ + $O\StreamUtils.obj \ + +WIN_OBJS = \ + $O\System.obj \ + +COMPRESS_OBJS = \ + $O\CodecExports.obj \ + $O\DllExportsCompress.obj \ + +C_OBJS = \ + $O\Alloc.obj \ + $O\Threads.obj \ + $O\LzFind.obj \ + $O\LzFindMt.obj \ + $O\Lzma2Dec.obj \ + $O\Lzma2DecMt.obj \ + $O\Lzma2Enc.obj \ + $O\LzmaDec.obj \ + $O\LzmaEnc.obj \ + $O\MtCoder.obj \ + $O\MtDec.obj \ + +!include "../../LzmaDec.mak" + +COMPRESS_OBJS = $(COMPRESS_OBJS) \ + $O\Lzma2Decoder.obj \ + $O\Lzma2Encoder.obj \ + $O\LzmaDecoder.obj \ + $O\LzmaEncoder.obj \ + $O\FastLzma2Register.obj \ + +FASTLZMA2_OBJS = \ + $O\fl2_error_private.obj \ + $O\fl2pool.obj \ + $O\fl2threading.obj \ + $O\fl2_common.obj \ + $O\fl2_compress.obj \ + $O\lzma2_enc.obj \ + $O\radix_bitpack.obj \ + $O\radix_mf.obj \ + $O\radix_struct.obj \ + $O\range_enc.obj \ + +!include "../../7zip.mak" diff --git a/CPP/7zip/Bundles/Codec_flzma2/resource.rc b/CPP/7zip/Bundles/Codec_flzma2/resource.rc new file mode 100644 index 00000000..8d3c33ec --- /dev/null +++ b/CPP/7zip/Bundles/Codec_flzma2/resource.rc @@ -0,0 +1,6 @@ +#include "../../../../C/7zVersionTr.h" +#include "../../../../C/7zVersion.rc" + +MY_VERSION_INFO_DLL("7-Zip Fast LZMA2 Plugin v0.9.2", "FLZMA2") + +101 ICON "../../Archive/Icons/7z.ico" diff --git a/CPP/7zip/Bundles/Format7z/makefile b/CPP/7zip/Bundles/Format7z/makefile index 8e11500d..dafcf4ae 100644 --- a/CPP/7zip/Bundles/Format7z/makefile +++ b/CPP/7zip/Bundles/Format7z/makefile @@ -156,6 +156,7 @@ COMPRESS_OBJS = $(COMPRESS_OBJS) \ $O\ZstdDecoder.obj \ $O\ZstdEncoder.obj \ $O\ZstdRegister.obj \ + $O\FastLzma2Register.obj \ BROTLI_OBJS = \ $O/br_backward_references.obj \ diff --git a/CPP/7zip/Bundles/Format7zF/makefile b/CPP/7zip/Bundles/Format7zF/makefile index 7274402a..ecf51975 100644 --- a/CPP/7zip/Bundles/Format7zF/makefile +++ b/CPP/7zip/Bundles/Format7zF/makefile @@ -31,6 +31,7 @@ COMPRESS_OBJS = $(COMPRESS_OBJS) \ $O\ZstdDecoder.obj \ $O\ZstdEncoder.obj \ $O\ZstdRegister.obj \ + $O\FastLzma2Register.obj \ BROTLI_OBJS = \ $O/br_backward_references.obj \ diff --git a/CPP/7zip/Bundles/Format7zFO/makefile b/CPP/7zip/Bundles/Format7zFO/makefile index 4da2018f..f7d39a9c 100644 --- a/CPP/7zip/Bundles/Format7zFO/makefile +++ b/CPP/7zip/Bundles/Format7zFO/makefile @@ -32,6 +32,7 @@ COMPRESS_OBJS = $(COMPRESS_OBJS) \ $O\ZstdDecoder.obj \ $O\ZstdEncoder.obj \ $O\ZstdRegister.obj \ + $O\FastLzma2Register.obj \ BROTLI_OBJS = \ $O/br_backward_references.obj \ diff --git a/CPP/7zip/Bundles/Format7zUSB/makefile b/CPP/7zip/Bundles/Format7zUSB/makefile index b1609727..58c45033 100644 --- a/CPP/7zip/Bundles/Format7zUSB/makefile +++ b/CPP/7zip/Bundles/Format7zUSB/makefile @@ -155,6 +155,7 @@ COMPRESS_OBJS = $(COMPRESS_OBJS) \ $O\ZstdDecoder.obj \ $O\ZstdEncoder.obj \ $O\ZstdRegister.obj \ + $O\FastLzma2Register.obj \ BROTLI_OBJS = \ $O/br_backward_references.obj \ diff --git a/CPP/7zip/Compress/FastLzma2Register.cpp b/CPP/7zip/Compress/FastLzma2Register.cpp new file mode 100644 index 00000000..b1ba9870 --- /dev/null +++ b/CPP/7zip/Compress/FastLzma2Register.cpp @@ -0,0 +1,18 @@ +// FastLzma2Register.cpp + +#include "StdAfx.h" + +#include "../Common/RegisterCodec.h" + +#include "Lzma2Decoder.h" + +#ifndef EXTRACT_ONLY +#include "Lzma2Encoder.h" +#endif + +REGISTER_CODEC_E( + FLZMA2, + NCompress::NLzma2::CDecoder(), + NCompress::NLzma2::CFastEncoder(), + 0x21, + "FLZMA2") diff --git a/CPP/7zip/Compress/Lzma2Encoder.cpp b/CPP/7zip/Compress/Lzma2Encoder.cpp index da5b7b31..5eb88d50 100644 --- a/CPP/7zip/Compress/Lzma2Encoder.cpp +++ b/CPP/7zip/Compress/Lzma2Encoder.cpp @@ -190,7 +190,9 @@ STDMETHODIMP CFastEncoder::SetCoderProperties(const PROPID *propIDs, if (lzma2Props.lzmaProps.pb >= 0) CHECK_F(FL2_CCtx_setParameter(_encoder, FL2_p_posBits, lzma2Props.lzmaProps.pb)); FL2_CCtx_setParameter(_encoder, FL2_p_omitProperties, 1); +#ifndef NO_XXHASH FL2_CCtx_setParameter(_encoder, FL2_p_doXXHash, 0); +#endif return S_OK; } diff --git a/CPP/7zip/Compress/Lzma2Register.cpp b/CPP/7zip/Compress/Lzma2Register.cpp index 42089e3b..43671056 100644 --- a/CPP/7zip/Compress/Lzma2Register.cpp +++ b/CPP/7zip/Compress/Lzma2Register.cpp @@ -14,19 +14,9 @@ namespace NCompress { namespace NLzma2 { REGISTER_CODEC_E(LZMA2, - CDecoder(), - CEncoder(), - 0x21, - "LZMA2") -} + CDecoder(), + CEncoder(), + 0x21, + "LZMA2") -namespace NFLzma2 { - -REGISTER_CODEC_E(FLZMA2, - NCompress::NLzma2::CDecoder(), - NCompress::NLzma2::CFastEncoder(), - 0x21, - "FLZMA2") -} - -} +}} diff --git a/CPP/build-x32.cmd b/CPP/build-x32.cmd index c2fb6476..d10c3f47 100644 --- a/CPP/build-x32.cmd +++ b/CPP/build-x32.cmd @@ -2,6 +2,7 @@ set ROOT=%cd%\7zip if not defined OUTDIR set OUTDIR=%ROOT%\bin32 +if not defined ERRFILE set ERRFILE=%cd%\error.txt mkdir %OUTDIR% set OPTS=MY_STATIC_LINK=1 /NOLOGO @@ -77,6 +78,11 @@ nmake %OPTS% IF %errorlevel% NEQ 0 echo "Error x32 @ zstd-x32.dll" >> %ERRFILE% copy O\zstd.dll %OUTDIR%\zstd-x32.dll +cd %ROOT%\Bundles\Codec_flzma2 +nmake %OPTS% +IF %errorlevel% NEQ 0 echo "Error x32 @ flzma2-x32.dll" >> %ERRFILE% +copy O\flzma2.dll %OUTDIR%\flzma2-x32.dll + cd %ROOT%\..\..\C\Util\7zipInstall nmake %OPTS% IF %errorlevel% NEQ 0 echo "Error x32 @ Install-x32.exe" >> %ERRFILE% diff --git a/CPP/build-x64.cmd b/CPP/build-x64.cmd index 1ec02fac..a649fa1f 100644 --- a/CPP/build-x64.cmd +++ b/CPP/build-x64.cmd @@ -78,6 +78,11 @@ nmake %OPTS% IF %errorlevel% NEQ 0 echo "Error x64 @ zstd-x64.dll" >> %ERRFILE% copy AMD64\zstd.dll %OUTDIR%\zstd-x64.dll +cd %ROOT%\Bundles\Codec_flzma2 +nmake %OPTS% +IF %errorlevel% NEQ 0 echo "Error x64 @ flzma2-x64.dll" >> %ERRFILE% +copy AMD64\flzma2.dll %OUTDIR%\flzma2-x64.dll + cd %ROOT%\..\..\C\Util\7zipInstall nmake %OPTS% IF %errorlevel% NEQ 0 echo "Error x64 @ Install-x64.exe" >> %ERRFILE%