Add Fast LZMA2 codec dll build; Fix 32-bit warnings

This commit is contained in:
conor42
2018-11-07 14:34:04 +10:00
parent ab10047253
commit 296c91d212
16 changed files with 111 additions and 18 deletions

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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 \

View File

@@ -0,0 +1,3 @@
// StdAfx.cpp
#include "StdAfx.h"

View File

@@ -0,0 +1,8 @@
// StdAfx.h
#ifndef __STDAFX_H
#define __STDAFX_H
#include "../../../Common/Common.h"
#endif

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 \

View File

@@ -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 \

View File

@@ -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 \

View File

@@ -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 \

View File

@@ -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")

View File

@@ -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;
}

View File

@@ -18,15 +18,5 @@ REGISTER_CODEC_E(LZMA2,
CEncoder(),
0x21,
"LZMA2")
}
namespace NFLzma2 {
REGISTER_CODEC_E(FLZMA2,
NCompress::NLzma2::CDecoder(),
NCompress::NLzma2::CFastEncoder(),
0x21,
"FLZMA2")
}
}
}}

View File

@@ -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%

View File

@@ -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%