From: Yann Collet Date: Wed, 14 Mar 2018 23:11:25 +0000 (-0700) Subject: Merge branch 'dev' into hufCompress X-Git-Tag: v1.3.4~1^2~27^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1047%2Fhead;p=thirdparty%2Fzstd.git Merge branch 'dev' into hufCompress --- a909c293c635526c5ee7a0da5b75a30a7858cd00 diff --cc lib/compress/zstd_compress.c index b7f4f7811,c461fa443..1431de238 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@@ -1393,10 -1407,14 +1407,13 @@@ static size_t ZSTD_compressLiterals (ZS memcpy(nextEntropy->hufCTable, prevEntropy->hufCTable, sizeof(prevEntropy->hufCTable)); + if (disableLiteralCompression) + return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); + /* small ? don't even attempt compression (speed opt) */ -# define LITERAL_NOENTROPY 63 - { size_t const minLitSize = (prevEntropy->hufCTable_repeatMode == HUF_repeat_valid) ? 6 : LITERAL_NOENTROPY; - if (srcSize <= minLitSize) - return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); +# define COMPRESS_LITERALS_SIZE_MIN 63 + { size_t const minLitSize = (prevEntropy->hufCTable_repeatMode == HUF_repeat_valid) ? 6 : COMPRESS_LITERALS_SIZE_MIN; + if (srcSize <= minLitSize) return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); } if (dstCapacity < lhSize+1) return ERROR(dstSize_tooSmall); /* not enough space for compression */