Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Compress/QuantumDecoder.cpp')
-rwxr-xr-xCPP/7zip/Compress/QuantumDecoder.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/CPP/7zip/Compress/QuantumDecoder.cpp b/CPP/7zip/Compress/QuantumDecoder.cpp
index 501bd0e1..63da32cc 100755
--- a/CPP/7zip/Compress/QuantumDecoder.cpp
+++ b/CPP/7zip/Compress/QuantumDecoder.cpp
@@ -33,14 +33,6 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
{
if (_remainLen == kLenIdNeedInit)
{
- if (!_keepHistory)
- {
- if (!_outWindowStream.Create((UInt32)1 << _numDictBits))
- return E_OUTOFMEMORY;
- Init();
- }
- if (!_rangeDecoder.Create(1 << 20))
- return E_OUTOFMEMORY;
_rangeDecoder.Init();
_remainLen = 0;
}
@@ -169,6 +161,20 @@ STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
return E_FAIL;
_remainLen = kLenIdNeedInit;
_outWindowStream.Init(_keepHistory);
+ if (!_keepHistory)
+ Init();
+ return S_OK;
+}
+
+HRESULT CDecoder::SetParams(int numDictBits)
+{
+ if (numDictBits > 21)
+ return E_INVALIDARG;
+ _numDictBits = numDictBits;
+ if (!_outWindowStream.Create((UInt32)1 << _numDictBits))
+ return E_OUTOFMEMORY;
+ if (!_rangeDecoder.Create(1 << 20))
+ return E_OUTOFMEMORY;
return S_OK;
}