Update to 7-Zip Version 22.01

See: https://sourceforge.net/p/sevenzip/discussion/45797/thread/c43cbc5f18/
This commit is contained in:
Tino Reichardt
2022-08-07 10:03:34 +02:00
parent 57558682a8
commit f9e0730191
47 changed files with 2485 additions and 812 deletions

View File

@@ -89,11 +89,8 @@ HRESULT CDecoder::DecodeUncompressed(UInt32 unpackSize)
HRESULT CDecoder::DecodeLzvn(UInt32 unpackSize)
HRESULT CDecoder::DecodeLzvn(UInt32 unpackSize, UInt32 packSize)
{
UInt32 packSize;
RINOK(GetUInt32(packSize));
PRF(printf("\nLZVN %7u %7u", unpackSize, packSize));
UInt32 D = 0;
@@ -854,6 +851,16 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStr
UInt64 prevOut = 0;
UInt64 prevIn = 0;
if (LzvnMode)
{
const UInt64 unpackSize = *outSize;
const UInt64 packSize = *inSize;
if (unpackSize > (UInt32)(Int32)-1
|| packSize > (UInt32)(Int32)-1)
return S_FALSE;
RINOK(DecodeLzvn((UInt32)unpackSize, (UInt32)packSize));
}
else
for (;;)
{
const UInt64 pos = m_OutWindowStream.GetProcessedSize();
@@ -889,7 +896,12 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStr
if (v == kSignature_LZFSE_V1 || v == kSignature_LZFSE_V2)
res = DecodeLzfse(cur, (Byte)v);
else if (v == 0x6E) // 'n'
res = DecodeLzvn(cur);
{
UInt32 packSize;
res = GetUInt32(packSize);
if (res == S_OK)
res = DecodeLzvn(cur, packSize);
}
else if (v == 0x2D) // '-'
res = DecodeUncompressed(cur);
else

View File

@@ -41,14 +41,23 @@ class CDecoder:
HRESULT GetUInt32(UInt32 &val);
HRESULT DecodeUncompressed(UInt32 unpackSize);
HRESULT DecodeLzvn(UInt32 unpackSize);
HRESULT DecodeLzvn(UInt32 unpackSize, UInt32 packSize);
HRESULT DecodeLzfse(UInt32 unpackSize, Byte version);
STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
public:
bool LzvnMode;
MY_UNKNOWN_IMP
CDecoder():
LzvnMode(false)
{}
// sizes are checked in Code()
// UInt64 GetInputProcessedSize() const { return m_InStream.GetProcessedSize(); }
// UInt64 GetOutputProcessedSize() const { return m_OutWindowStream.GetProcessedSize(); }
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize,
const UInt64 *outSize, ICompressProgressInfo *progress);
};