From: Yann Collet Date: Thu, 21 Jul 2016 13:42:23 +0000 (-0700) Subject: changed filed order X-Git-Tag: v0.8.0^2~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5288ac0cb756b3a29e6f2673fb4a66668a4d3504;p=thirdparty%2Fzstd.git changed filed order --- diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 4fbd1092f..16c85cf32 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -472,32 +472,29 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, if (srcSize < 5) return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for lhSize, + cSize (+nbSeq) */ switch(lhlCode) { - case 1: - singleStream = 1; - /* fall through */ - case 0: default: /* note : default is impossible, since lhlCode into [0..3] */ + case 0: case 1: default: /* note : default is impossible, since lhlCode into [0..3] */ /* 2 - 2 - 10 - 10 */ - { U32 const lhc = MEM_readLE24(istart) >> 4; + { U32 const lhc = MEM_readLE32(istart); + singleStream = lhlCode; lhSize = 3; - litSize = lhc & 0x3FF; - litCSize = lhc >> 10; + litSize = (lhc >> 4) & 0x3FF; + litCSize = (lhc >> 14) & 0x3FF; break; } - case 2: /* 2 - 2 - 14 - 14 */ - { U32 const lhc = MEM_readLE32(istart) >> 4; + { U32 const lhc = MEM_readLE32(istart); lhSize = 4; - litSize = lhc & 0x3FFF; - litCSize = lhc >> 14; + litSize = (lhc >> 4) & 0x3FFF; + litCSize = lhc >> 18; break; } case 3: /* 2 - 2 - 18 - 18 */ - { U64 const lhc = (MEM_readLE32(istart) + (((U64)istart[4]) << 32)) >> 4; + { U32 const lhc = MEM_readLE32(istart); lhSize = 5; - litSize = lhc & 0x3FFFF; - litCSize = lhc >> 18; + litSize = (lhc >> 4) & 0x3FFFF; + litCSize = (lhc >> 22) + (istart[4] << 10); break; } } diff --git a/programs/Makefile b/programs/Makefile index 796742693..75d3154dd 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -46,7 +46,7 @@ FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS) ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c ZSTDCOMP_FILES := $(ZSTDDIR)/compress/zstd_compress.c $(ZSTDDIR)/compress/fse_compress.c $(ZSTDDIR)/compress/huf_compress.c -ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/huf_decompress.c $(ZSTDDIR)/decompress/zstd_decompress.c +ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/zstd_decompress.c $(ZSTDDIR)/decompress/huf_decompress.c ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) ZBUFF_FILES := $(ZSTDDIR)/compress/zbuff_compress.c $(ZSTDDIR)/decompress/zbuff_decompress.c ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c