mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 07:14:56 -06:00
Fix zstd decompression
- todo: make zstd ldm compression optional
This commit is contained in:
@@ -84,11 +84,6 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
|
||||
ZSTD_resetDStream(_ctx);
|
||||
}
|
||||
|
||||
// _processedOut += zOut.pos;
|
||||
// RINOK(ReadStream(inStream, _srcBuf, &size));
|
||||
// RINOK(WriteStream(outStream, _dstBuf, zOut.pos));
|
||||
// RINOK(progress->SetRatioInfo(&_processedIn, &_processedOut));
|
||||
|
||||
zIn.src = _srcBuf;
|
||||
zIn.size = _srcBufSize;
|
||||
zIn.pos = 0;
|
||||
@@ -141,10 +136,11 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
|
||||
result = ZSTD_resetDStream(_ctx);
|
||||
if (ZSTD_isError(result))
|
||||
return E_FAIL;
|
||||
/* read next input, or eof */
|
||||
break;
|
||||
}
|
||||
} /* for() decompress */
|
||||
|
||||
|
||||
/* read next input */
|
||||
srcBufLen = _srcBufSize;
|
||||
RINOK(ReadStream(inStream, _srcBuf, &srcBufLen));
|
||||
|
||||
@@ -104,15 +104,19 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
|
||||
if (!_dstBuf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
/* setup level */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_compressionLevel, _props._level);
|
||||
if (ZSTD_isError(err)) return E_FAIL;
|
||||
|
||||
/* setup thread count */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_nbWorkers, _numThreads);
|
||||
if (ZSTD_isError(err)) return E_FAIL;
|
||||
|
||||
/* set the content size flag */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_contentSizeFlag, 1);
|
||||
if (ZSTD_isError(err)) return E_FAIL;
|
||||
|
||||
/* todo: make this optional */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_enableLongDistanceMatching, 1);
|
||||
if (ZSTD_isError(err)) return E_FAIL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user