Fixing mixed declaration compiler complaint

dev
bimbashrestha 2019-08-26 15:00:50 -07:00
parent ce264ce53b
commit 991cbc9024
1 changed files with 6 additions and 7 deletions

View File

@ -2284,6 +2284,12 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
needs further investigation. needs further investigation.
*/ */
const U32 rleMaxLength = 25; const U32 rleMaxLength = 25;
/*
We don't want to emit our first block as a RLE even if it qualifies because
doing so will cause the decoder to throw a "should consume all input error."
https://github.com/facebook/zstd/blob/dev/programs/fileio.c#L1723
*/
U32 isFirstBlock = zc->inBuffPos == srcSize;
size_t cSize; size_t cSize;
const BYTE* ip = (const BYTE*)src; const BYTE* ip = (const BYTE*)src;
BYTE* op = (BYTE*)dst; BYTE* op = (BYTE*)dst;
@ -2305,13 +2311,6 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
zc->entropyWorkspace, HUF_WORKSPACE_SIZE /* statically allocated in resetCCtx */, zc->entropyWorkspace, HUF_WORKSPACE_SIZE /* statically allocated in resetCCtx */,
zc->bmi2); zc->bmi2);
/*
We don't want to emit our first block as a RLE even if it qualifies because
doing so will cause the decoder to throw a "should consume all input error."
https://github.com/facebook/zstd/blob/dev/programs/fileio.c#L1723
*/
U32 isFirstBlock = zc->inBuffPos == srcSize;
if (frame && if (frame &&
!isFirstBlock && !isFirstBlock &&
cSize < rleMaxLength && cSize < rleMaxLength &&