Update to LZMA 16.0 [Vas Crabb]

This commit is contained in:
Vas Crabb 2016-05-12 00:06:54 +10:00
parent 6a53a6aeff
commit 7a423d0160
38 changed files with 277 additions and 114 deletions

View File

@ -1,5 +1,5 @@
/* 7zArcIn.c -- 7z Input functions
2015-11-18 : Igor Pavlov : Public domain */
2016-03-31 : Igor Pavlov : Public domain */
#include "Precomp.h"
@ -788,13 +788,9 @@ static SRes ReadUnpackInfo(CSzAr *p,
numCodersOutStreams += numCoders;
if (numCodersOutStreams < numCoders)
return SZ_ERROR_UNSUPPORTED;
packStreamIndex += numPackStreams;
if (packStreamIndex < numPackStreams)
return SZ_ERROR_UNSUPPORTED;
if (packStreamIndex > p->NumPackStreams)
if (numPackStreams > p->NumPackStreams - packStreamIndex)
return SZ_ERROR_ARCHIVE;
packStreamIndex += numPackStreams;
}
}

View File

@ -1,14 +1,14 @@
#define MY_VER_MAJOR 15
#define MY_VER_MINOR 14
#define MY_VER_MAJOR 16
#define MY_VER_MINOR 00
#define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "15.14"
#define MY_VERSION "15.14"
#define MY_DATE "2015-12-31"
#define MY_VERSION_NUMBERS "16.00"
#define MY_VERSION "16.00"
#define MY_DATE "2016-05-10"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"
#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2015 Igor Pavlov"
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2016 Igor Pavlov"
#ifdef USE_COPYRIGHT_CR
#define MY_COPYRIGHT MY_COPYRIGHT_CR

View File

@ -1,5 +1,5 @@
/* CpuArch.c -- CPU specific code
2015-03-25: Igor Pavlov : Public domain */
2016-02-25: Igor Pavlov : Public domain */
#include "Precomp.h"
@ -45,7 +45,8 @@ static UInt32 CheckFlag(UInt32 flag)
"push %%EDX\n\t"
"popf\n\t"
"andl %%EAX, %0\n\t":
"=c" (flag) : "c" (flag));
"=c" (flag) : "c" (flag) :
"%eax", "%edx");
#endif
return flag;
}
@ -79,7 +80,13 @@ void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
#else
__asm__ __volatile__ (
#if defined(MY_CPU_X86) && defined(__PIC__)
#if defined(MY_CPU_AMD64) && defined(__PIC__)
"mov %%rbx, %%rdi;"
"cpuid;"
"xchg %%rbx, %%rdi;"
: "=a" (*a) ,
"=D" (*b) ,
#elif defined(MY_CPU_X86) && defined(__PIC__)
"mov %%ebx, %%edi;"
"cpuid;"
"xchgl %%ebx, %%edi;"

View File

@ -93,6 +93,8 @@ void CStreamSwitch::Set(CInArchive *archive, const CObjectVector<CByteBuffer> *d
Byte external = archive->ReadByte();
if (external != 0)
{
if (!dataVector)
ThrowIncorrect();
CNum dataIndex = archive->ReadNum();
if (dataIndex >= dataVector->Size())
ThrowIncorrect();
@ -761,6 +763,8 @@ void CInArchive::ReadUnpackInfo(
folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams;
numCodersOutStreams += numCoders;
folders.FoStartPackStreamIndex[fo] = packStreamIndex;
if (numPackStreams > folders.NumPackStreams - packStreamIndex)
ThrowIncorrect();
packStreamIndex += numPackStreams;
folders.FoToMainUnpackSizeIndex[fo] = (Byte)indexOfMainStream;
}
@ -770,6 +774,8 @@ void CInArchive::ReadUnpackInfo(
folders.FoStartPackStreamIndex[fo] = packStreamIndex;
folders.FoCodersDataOffset[fo] = _inByteBack->GetPtr() - startBufPtr;
folders.CodersData.CopyFrom(startBufPtr, dataSize);
// if (folders.NumPackStreams != packStreamIndex) ThrowUnsupported();
}
WaitId(NID::kCodersUnpackSize);

View File

@ -380,13 +380,16 @@ static inline bool IsExeFilter(CMethodId m)
return false;
}
static unsigned Get_FilterGroup_for_Folder(CRecordVector<CFilterMode2> &filters, const CFolderEx &f)
static unsigned Get_FilterGroup_for_Folder(
CRecordVector<CFilterMode2> &filters, const CFolderEx &f, bool extractFilter)
{
CFilterMode2 m;
m.Id = 0;
m.Delta = 0;
m.Encrypted = f.IsEncrypted();
if (extractFilter)
{
const CCoderInfo &coder = f.Coders[f.UnpackCoder];
if (coder.MethodID == k_Delta)
@ -404,6 +407,7 @@ static unsigned Get_FilterGroup_for_Folder(CRecordVector<CFilterMode2> &filters,
m.Id = k_BCJ;
m.SetDelta();
}
}
return GetGroup(filters, m);
}
@ -1577,7 +1581,7 @@ HRESULT Update(
return E_NOTIMPL;
*/
UInt64 startBlockSize = db != 0 ? db->ArcInfo.StartPosition: 0;
UInt64 startBlockSize = db ? db->ArcInfo.StartPosition: 0;
if (startBlockSize > 0 && !options.RemoveSfxBlock)
{
RINOK(WriteRange(inStream, seqOutStream, 0, startBlockSize, NULL));
@ -1592,7 +1596,20 @@ HRESULT Update(
CObjectVector<CSolidGroup> groups;
bool thereAreRepacks = false;
if (db != 0)
bool useFilters = options.UseFilters;
if (useFilters)
{
const CCompressionMethodMode &method = *options.Method;
FOR_VECTOR (i, method.Methods)
if (IsFilterMethod(method.Methods[i].Id))
{
useFilters = false;
break;
}
}
if (db)
{
fileIndexToUpdateIndexMap.Alloc(db->Files.Size());
unsigned i;
@ -1638,16 +1655,18 @@ HRESULT Update(
CFolderEx f;
db->ParseFolderEx(i, f);
bool isEncrypted = f.IsEncrypted();
const bool isEncrypted = f.IsEncrypted();
const bool needCopy = (numCopyItems == numUnpackStreams);
const bool extractFilter = (useFilters || needCopy);
unsigned groupIndex = Get_FilterGroup_for_Folder(filters, f);
unsigned groupIndex = Get_FilterGroup_for_Folder(filters, f, extractFilter);
while (groupIndex >= groups.Size())
groups.AddNew();
groups[groupIndex].folderRefs.Add(rep);
if (numCopyItems == numUnpackStreams)
if (needCopy)
complexity += db->GetFolderFullPackSize(i);
else
{
@ -1732,22 +1751,8 @@ HRESULT Update(
// ---------- Split files to groups ----------
bool useFilters = options.UseFilters;
const CCompressionMethodMode &method = *options.Method;
if (useFilters)
for (i = 0; i < method.Methods.Size(); i++)
if (IsFilterMethod(method.Methods[i].Id))
{
useFilters = false;
break;
}
/*
if (!method.Bonds.IsEmpty())
useFilters = false;
*/
for (i = 0; i < updateItems.Size(); i++)
{
const CUpdateItem &ui = updateItems[i];
@ -2156,7 +2161,13 @@ HRESULT Update(
#ifndef _7ZIP_ST
if (options.MultiThreadMixer)
{
// 16.00: hang was fixed : for case if decoding was not finished.
// We close CBinderInStream and it calls CStreamBinder::CloseRead()
inStreamSizeCount.Release();
sbInStream.Release();
threadDecoder.WaitExecuteFinish();
HRESULT decodeRes = threadDecoder.Result;
// if (res == k_My_HRESULT_CRC_ERROR)
if (decodeRes == S_FALSE)

View File

@ -110,7 +110,7 @@ HRESULT CDecoder::Create(bool filteredMode, ISequentialInStream *inStream)
{
_filterCoder = new CFilterCoder(false);
CMyComPtr<ICompressCoder> coder = _filterCoder;
_filterCoder->Filter = new CBcjCoder(false);
_filterCoder->Filter = new NCompress::NBcj::CCoder(false);
_bcjStream = _filterCoder;
}
}

View File

@ -187,11 +187,15 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
UInt64 size;
{
/*
NCOM::CPropVariant prop;
RINOK(volumeCallback->GetProperty(kpidSize, &prop));
if (prop.vt != VT_UI8)
return E_INVALIDARG;
size = prop.uhVal.QuadPart;
*/
RINOK(stream->Seek(0, STREAM_SEEK_END, &size));
RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
}
_totalSize += size;
@ -217,11 +221,15 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
if (!stream)
break;
{
/*
NCOM::CPropVariant prop;
RINOK(volumeCallback->GetProperty(kpidSize, &prop));
if (prop.vt != VT_UI8)
return E_INVALIDARG;
size = prop.uhVal.QuadPart;
*/
RINOK(stream->Seek(0, STREAM_SEEK_END, &size));
RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
}
_totalSize += size;
_sizes.Add(size);

View File

@ -10,6 +10,8 @@
#include "../../Common/Defs.h"
#include "../../Common/IntToString.h"
#include "../../Windows/PropVariant.h"
#include "../ICoder.h"
#include "../Common/CWrappers.h"
@ -21,7 +23,9 @@
#include "IArchive.h"
#ifndef EXTRACT_ONLY
#include "Common/HandlerOut.h"
#endif
#include "XzHandler.h"
@ -83,15 +87,20 @@ class CHandler:
CMyComPtr<IInStream> _stream;
CMyComPtr<ISequentialInStream> _seqStream;
UInt32 _filterId;
AString _methodsString;
#ifndef EXTRACT_ONLY
UInt32 _filterId;
void Init()
{
_filterId = 0;
CMultiMethodProps::Init();
}
#endif
HRESULT Open2(IInStream *inStream, /* UInt32 flags, */ IArchiveOpenCallback *callback);
HRESULT Decode2(ISequentialInStream *seqInStream, ISequentialOutStream *outStream,
@ -126,9 +135,12 @@ public:
CHandler::CHandler()
{
#ifndef EXTRACT_ONLY
Init();
#endif
}
static const Byte kProps[] =
{
kpidSize,

View File

@ -5,16 +5,19 @@
#include <string.h>
#include "LimitedStreams.h"
#include "../../Common/Defs.h"
STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize = 0;
UInt32 sizeToRead = (UInt32)MyMin((_size - _pos), (UInt64)size);
HRESULT result = S_OK;
if (sizeToRead > 0)
{
result = _stream->Read(data, sizeToRead, &realProcessedSize);
const UInt64 rem = _size - _pos;
if (size > rem)
size = (UInt32)rem;
}
HRESULT result = S_OK;
if (size != 0)
{
result = _stream->Read(data, size, &realProcessedSize);
_pos += realProcessedSize;
if (realProcessedSize == 0)
_wasFinished = true;
@ -34,9 +37,11 @@ STDMETHODIMP CLimitedInStream::Read(void *data, UInt32 size, UInt32 *processedSi
return S_OK;
// return (_virtPos == _size) ? S_OK: E_FAIL; // ERROR_HANDLE_EOF
}
UInt64 rem = _size - _virtPos;
if (rem < size)
{
const UInt64 rem = _size - _virtPos;
if (size > rem)
size = (UInt32)rem;
}
UInt64 newPos = _startOffset + _virtPos;
if (newPos != _physPos)
{

View File

@ -30,6 +30,7 @@ public:
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
UInt64 GetSize() const { return _pos; }
UInt64 GetRem() const { return _size - _pos; }
bool WasFinished() const { return _wasFinished; }
};

View File

@ -6,9 +6,12 @@
#include "Bcj2Coder.h"
REGISTER_CODEC_CREATE_2(CreateCodec, NCompress::NBcj2::CDecoder(), ICompressCoder2)
namespace NCompress {
namespace NBcj2 {
REGISTER_CODEC_CREATE_2(CreateCodec, CDecoder(), ICompressCoder2)
#ifndef EXTRACT_ONLY
REGISTER_CODEC_CREATE_2(CreateCodecOut, NCompress::NBcj2::CEncoder(), ICompressCoder2)
REGISTER_CODEC_CREATE_2(CreateCodecOut, CEncoder(), ICompressCoder2)
#else
#define CreateCodecOut NULL
#endif
@ -17,3 +20,5 @@ REGISTER_CODEC_VAR
{ CreateCodec, CreateCodecOut, 0x303011B, "BCJ2", 4, false };
REGISTER_CODEC(BCJ2)
}}

View File

@ -4,16 +4,21 @@
#include "BcjCoder.h"
STDMETHODIMP CBcjCoder::Init()
namespace NCompress {
namespace NBcj {
STDMETHODIMP CCoder::Init()
{
_bufferPos = 0;
x86_Convert_Init(_prevMask);
return S_OK;
}
STDMETHODIMP_(UInt32) CBcjCoder::Filter(Byte *data, UInt32 size)
STDMETHODIMP_(UInt32) CCoder::Filter(Byte *data, UInt32 size)
{
UInt32 processed = (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, _encode);
_bufferPos += processed;
return processed;
}
}}

View File

@ -9,7 +9,10 @@
#include "../ICoder.h"
class CBcjCoder:
namespace NCompress {
namespace NBcj {
class CCoder:
public ICompressFilter,
public CMyUnknownImp
{
@ -17,10 +20,12 @@ class CBcjCoder:
UInt32 _prevMask;
int _encode;
public:
MY_UNKNOWN_IMP;
MY_UNKNOWN_IMP1(ICompressFilter);
INTERFACE_ICompressFilter(;)
CBcjCoder(int encode): _bufferPos(0), _encode(encode) { x86_Convert_Init(_prevMask); }
CCoder(int encode): _bufferPos(0), _encode(encode) { x86_Convert_Init(_prevMask); }
};
}}
#endif

View File

@ -6,7 +6,12 @@
#include "BcjCoder.h"
namespace NCompress {
namespace NBcj {
REGISTER_FILTER_E(BCJ,
CBcjCoder(false),
CBcjCoder(true),
CCoder(false),
CCoder(true),
0x3030103, "BCJ")
}}

View File

@ -4,15 +4,20 @@
#include "BranchMisc.h"
STDMETHODIMP CBranchCoder::Init()
namespace NCompress {
namespace NBranch {
STDMETHODIMP CCoder::Init()
{
_bufferPos = 0;
return S_OK;
}
STDMETHODIMP_(UInt32) CBranchCoder::Filter(Byte *data, UInt32 size)
STDMETHODIMP_(UInt32) CCoder::Filter(Byte *data, UInt32 size)
{
UInt32 processed = (UInt32)BraFunc(data, size, _bufferPos, _encode);
_bufferPos += processed;
return processed;
}
}}

View File

@ -13,7 +13,10 @@ typedef SizeT (*Func_Bra)(Byte *data, SizeT size, UInt32 ip, int encoding);
EXTERN_C_END
class CBranchCoder:
namespace NCompress {
namespace NBranch {
class CCoder:
public ICompressFilter,
public CMyUnknownImp
{
@ -21,10 +24,12 @@ class CBranchCoder:
int _encode;
Func_Bra BraFunc;
public:
MY_UNKNOWN_IMP;
MY_UNKNOWN_IMP1(ICompressFilter);
INTERFACE_ICompressFilter(;)
CBranchCoder(Func_Bra bra, int encode): _bufferPos(0), _encode(encode), BraFunc(bra) {}
CCoder(Func_Bra bra, int encode): _bufferPos(0), _encode(encode), BraFunc(bra) {}
};
}}
#endif

View File

@ -8,9 +8,12 @@
#include "BranchMisc.h"
namespace NCompress {
namespace NBranch {
#define CREATE_BRA(n) \
REGISTER_FILTER_CREATE(CreateBra_Decoder_ ## n, CBranchCoder(n ## _Convert, false)) \
REGISTER_FILTER_CREATE(CreateBra_Encoder_ ## n, CBranchCoder(n ## _Convert, true)) \
REGISTER_FILTER_CREATE(CreateBra_Decoder_ ## n, CCoder(n ## _Convert, false)) \
REGISTER_FILTER_CREATE(CreateBra_Encoder_ ## n, CCoder(n ## _Convert, true)) \
CREATE_BRA(PPC)
CREATE_BRA(IA64)
@ -34,3 +37,5 @@ REGISTER_CODECS_VAR
};
REGISTER_CODECS(Branch)
}}

View File

@ -8,12 +8,15 @@
#include "../Common/RegisterCodec.h"
namespace NCompress {
namespace NByteSwap {
class CByteSwap2:
public ICompressFilter,
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP
MY_UNKNOWN_IMP1(ICompressFilter);
INTERFACE_ICompressFilter(;)
};
@ -22,7 +25,7 @@ class CByteSwap4:
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP
MY_UNKNOWN_IMP1(ICompressFilter);
INTERFACE_ICompressFilter(;)
};
@ -85,3 +88,5 @@ REGISTER_CODECS_VAR
};
REGISTER_CODECS(ByteSwap)
}}

View File

@ -6,6 +6,10 @@
#include "CopyCoder.h"
REGISTER_CODEC_CREATE(CreateCodec, NCompress::CCopyCoder())
namespace NCompress {
REGISTER_CODEC_CREATE(CreateCodec, CCopyCoder())
REGISTER_CODEC_2(Copy, CreateCodec, CreateCodec, 0, "Copy")
}

View File

@ -10,6 +10,9 @@
#include "../Common/RegisterCodec.h"
namespace NCompress {
namespace NDelta {
struct CDelta
{
unsigned _delta;
@ -22,7 +25,7 @@ struct CDelta
#ifndef EXTRACT_ONLY
class CDeltaEncoder:
class CEncoder:
public ICompressFilter,
public ICompressSetCoderProperties,
public ICompressWriteCoderProperties,
@ -30,25 +33,25 @@ class CDeltaEncoder:
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties)
MY_UNKNOWN_IMP3(ICompressFilter, ICompressSetCoderProperties, ICompressWriteCoderProperties)
INTERFACE_ICompressFilter(;)
STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
};
STDMETHODIMP CDeltaEncoder::Init()
STDMETHODIMP CEncoder::Init()
{
DeltaInit();
return S_OK;
}
STDMETHODIMP_(UInt32) CDeltaEncoder::Filter(Byte *data, UInt32 size)
STDMETHODIMP_(UInt32) CEncoder::Filter(Byte *data, UInt32 size)
{
Delta_Encode(_state, _delta, data, size);
return size;
}
STDMETHODIMP CDeltaEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
{
UInt32 delta = _delta;
for (UInt32 i = 0; i < numProps; i++)
@ -75,7 +78,7 @@ STDMETHODIMP CDeltaEncoder::SetCoderProperties(const PROPID *propIDs, const PROP
return S_OK;
}
STDMETHODIMP CDeltaEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
{
Byte prop = (Byte)(_delta - 1);
return outStream->Write(&prop, 1, NULL);
@ -84,31 +87,31 @@ STDMETHODIMP CDeltaEncoder::WriteCoderProperties(ISequentialOutStream *outStream
#endif
class CDeltaDecoder:
class CDecoder:
public ICompressFilter,
public ICompressSetDecoderProperties2,
CDelta,
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
MY_UNKNOWN_IMP2(ICompressFilter, ICompressSetDecoderProperties2)
INTERFACE_ICompressFilter(;)
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
};
STDMETHODIMP CDeltaDecoder::Init()
STDMETHODIMP CDecoder::Init()
{
DeltaInit();
return S_OK;
}
STDMETHODIMP_(UInt32) CDeltaDecoder::Filter(Byte *data, UInt32 size)
STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
{
Delta_Decode(_state, _delta, data, size);
return size;
}
STDMETHODIMP CDeltaDecoder::SetDecoderProperties2(const Byte *props, UInt32 size)
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *props, UInt32 size)
{
if (size != 1)
return E_INVALIDARG;
@ -118,6 +121,8 @@ STDMETHODIMP CDeltaDecoder::SetDecoderProperties2(const Byte *props, UInt32 size
REGISTER_FILTER_E(Delta,
CDeltaDecoder(),
CDeltaEncoder(),
CDecoder(),
CEncoder(),
3, "Delta")
}}

View File

@ -20,7 +20,7 @@ class CEncoder:
{
CLzma2EncHandle _encoder;
public:
MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties)
MY_UNKNOWN_IMP3(ICompressCoder, ICompressSetCoderProperties, ICompressWriteCoderProperties)
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);

View File

@ -10,8 +10,13 @@
#include "Lzma2Encoder.h"
#endif
namespace NCompress {
namespace NLzma2 {
REGISTER_CODEC_E(LZMA2,
NCompress::NLzma2::CDecoder(),
NCompress::NLzma2::CEncoder(),
CDecoder(),
CEncoder(),
0x21,
"LZMA2")
}}

View File

@ -21,7 +21,7 @@ class CEncoder:
CLzmaEncHandle _encoder;
UInt64 _inputProcessed;
public:
MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties)
MY_UNKNOWN_IMP3(ICompressCoder, ICompressSetCoderProperties, ICompressWriteCoderProperties)
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);

View File

@ -10,8 +10,13 @@
#include "LzmaEncoder.h"
#endif
namespace NCompress {
namespace NLzma {
REGISTER_CODEC_E(LZMA,
NCompress::NLzma::CDecoder(),
NCompress::NLzma::CEncoder(),
CDecoder(),
CEncoder(),
0x30101,
"LZMA")
}}

View File

@ -41,7 +41,8 @@ class CEncoder :
CPpmd7 _ppmd;
CEncProps _props;
public:
MY_UNKNOWN_IMP2(
MY_UNKNOWN_IMP3(
ICompressCoder,
ICompressSetCoderProperties,
ICompressWriteCoderProperties)
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,

View File

@ -10,8 +10,13 @@
#include "PpmdEncoder.h"
#endif
namespace NCompress {
namespace NPpmd {
REGISTER_CODEC_E(PPMD,
NCompress::NPpmd::CDecoder(),
NCompress::NPpmd::CEncoder(),
CDecoder(),
CEncoder(),
0x30401,
"PPMD")
}}

View File

@ -86,7 +86,8 @@ class CEncoder:
public ICryptoResetInitVector
{
public:
MY_UNKNOWN_IMP3(
MY_UNKNOWN_IMP4(
ICompressFilter,
ICryptoSetPassword,
ICompressWriteCoderProperties,
// ICryptoResetSalt,
@ -104,7 +105,8 @@ class CDecoder:
public ICompressSetDecoderProperties2
{
public:
MY_UNKNOWN_IMP2(
MY_UNKNOWN_IMP3(
ICompressFilter,
ICryptoSetPassword,
ICompressSetDecoderProperties2)
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);

View File

@ -6,7 +6,12 @@
#include "7zAes.h"
namespace NCrypto {
namespace N7z {
REGISTER_FILTER_E(7zAES,
NCrypto::N7z::CDecoder(),
NCrypto::N7z::CEncoder(),
CDecoder(),
CEncoder(),
0x6F10701, "7zAES")
}}

View File

@ -30,7 +30,7 @@ class CAesCbcCoder:
public:
CAesCbcCoder(bool encodeMode, unsigned keySize);
MY_UNKNOWN_IMP2(ICryptoProperties, ICompressSetCoderProperties)
MY_UNKNOWN_IMP3(ICompressFilter, ICryptoProperties, ICompressSetCoderProperties)
INTERFACE_ICompressFilter(;)

View File

@ -6,7 +6,11 @@
#include "MyAes.h"
namespace NCrypto {
REGISTER_FILTER_E(AES256CBC,
NCrypto::CAesCbcDecoder(32),
NCrypto::CAesCbcEncoder(32),
CAesCbcDecoder(32),
CAesCbcEncoder(32),
0x6F00181, "AES256CBC")
}

View File

@ -1053,7 +1053,7 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
unsigned numNonSwitchStrings = nonSwitchStrings.Size();
if (numNonSwitchStrings < kMinNonSwitchWords)
throw CArcCmdLineException("The command must be spcified");
throw CArcCmdLineException("The command must be specified");
if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command))
throw CArcCmdLineException("Unsupported command:", nonSwitchStrings[kCommandIndex]);

View File

@ -43,6 +43,7 @@ STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value)
switch (propID)
{
case kpidName: prop = _subArchiveName; break;
// case kpidSize: prop = _subArchiveSize; break; // we don't use it now
}
else
switch (propID)

View File

@ -1632,6 +1632,36 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
#endif
{
#ifndef _SFX
bool isZip = false;
bool isRar = false;
const wchar_t c = extension[0];
if (c == 'z' || c == 'Z' || c == 'r' || c == 'R')
{
bool isNumber = false;
for (unsigned k = 1;; k++)
{
const wchar_t d = extension[k];
if (d == 0)
break;
if (d < '0' || d > '9')
{
isNumber = false;
break;
}
isNumber = true;
}
if (isNumber)
if (c == 'z' || c == 'Z')
isZip = true;
else
isRar = true;
}
#endif
FOR_VECTOR (i, op.codecs->Formats)
{
const CArcInfoEx &ai = op.codecs->Formats[i];
@ -1647,7 +1677,12 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
isPrearcExt = true;
#endif
if (ai.FindExtension(extension) >= 0)
if (ai.FindExtension(extension) >= 0
#ifndef _SFX
|| isZip && StringsAreEqualNoCase_Ascii(ai.Name, "zip")
|| isRar && StringsAreEqualNoCase_Ascii(ai.Name, "rar")
#endif
)
{
// PrintNumber("orderIndices.Insert", i);
orderIndices.Insert(numFinded++, i);

View File

@ -34,7 +34,7 @@ class CCrcHasher:
public:
CCrcHasher(): _crc(CRC_INIT_VAL) { SetFunctions(0); }
MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
MY_UNKNOWN_IMP2(IHasher, ICompressSetCoderProperties)
INTERFACE_IHasher(;)
STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
};

View File

@ -18,7 +18,7 @@ class CSha256Hasher:
public:
CSha256Hasher() { Sha256_Init(&_sha); }
MY_UNKNOWN_IMP
MY_UNKNOWN_IMP1(IHasher)
INTERFACE_IHasher(;)
};

View File

@ -19,7 +19,7 @@ class CXzCrc64Hasher:
public:
CXzCrc64Hasher(): _crc(CRC64_INIT_VAL) {}
MY_UNKNOWN_IMP
MY_UNKNOWN_IMP1(IHasher)
INTERFACE_IHasher(;)
};

View File

@ -1,6 +1,11 @@
HISTORY of the LZMA SDK
-----------------------
16.00 2016-05-10
-------------------------
- Some bugs were fixed,
15.12 2015-11-19
-------------------------
- The BUG in C version of 7z decoder was fixed:

View File

@ -1,4 +1,4 @@
LZMA SDK 15.14
LZMA SDK 16.00
--------------
LZMA SDK provides the documentation, samples, header files,