Fix zstd decompression

- todo: make zstd ldm compression optional
This commit is contained in:
Tino Reichardt
2018-11-03 10:03:54 +01:00
parent 36a17a5184
commit 1a09f6fc0d
2 changed files with 6 additions and 6 deletions

View File

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

View File

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