From 73773c6b6a6f4dc96641d1951f3879bae1f7d553 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 27 Sep 2018 18:15:14 -0700 Subject: [PATCH] fixed legacy compilation tests for some reason, these tests started failing recently on CircleCI --- lib/legacy/zstd_v01.c | 6 ++++++ lib/legacy/zstd_v02.c | 6 ++++++ lib/legacy/zstd_v03.c | 6 ++++++ tests/legacy.c | 5 +++-- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/legacy/zstd_v01.c b/lib/legacy/zstd_v01.c index 6303e1cfc..c007e7ceb 100644 --- a/lib/legacy/zstd_v01.c +++ b/lib/legacy/zstd_v01.c @@ -668,11 +668,17 @@ static size_t FSE_initDStream(FSE_DStream_t* bitD, const void* srcBuffer, size_t switch(srcSize) { case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16); + /* fallthrough */ case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24); + /* fallthrough */ case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32); + /* fallthrough */ case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; + /* fallthrough */ case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; + /* fallthrough */ case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) << 8; + /* fallthrough */ default:; } contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; diff --git a/lib/legacy/zstd_v02.c b/lib/legacy/zstd_v02.c index 8bc0eceed..c09ef8cff 100644 --- a/lib/legacy/zstd_v02.c +++ b/lib/legacy/zstd_v02.c @@ -399,11 +399,17 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si switch(srcSize) { case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16); + /* fallthrough */ case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24); + /* fallthrough */ case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32); + /* fallthrough */ case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; + /* fallthrough */ case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; + /* fallthrough */ case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) << 8; + /* fallthrough */ default:; } contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; diff --git a/lib/legacy/zstd_v03.c b/lib/legacy/zstd_v03.c index 54445af57..0c4cdf688 100644 --- a/lib/legacy/zstd_v03.c +++ b/lib/legacy/zstd_v03.c @@ -402,11 +402,17 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si switch(srcSize) { case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16); + /* fallthrough */ case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24); + /* fallthrough */ case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32); + /* fallthrough */ case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; + /* fallthrough */ case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; + /* fallthrough */ case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) << 8; + /* fallthrough */ default:; } contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; diff --git a/tests/legacy.c b/tests/legacy.c index 847e1d25e..e1cf82f2f 100644 --- a/tests/legacy.c +++ b/tests/legacy.c @@ -36,7 +36,7 @@ size_t const COMPRESSED_SIZE = 917; const char* const EXPECTED; /* content is at end of file */ -int testSimpleAPI(void) +static int testSimpleAPI(void) { size_t const size = strlen(EXPECTED); char* const output = malloc(size); @@ -71,7 +71,8 @@ int testSimpleAPI(void) return 0; } -int testStreamingAPI(void) + +static int testStreamingAPI(void) { size_t const outBuffSize = ZSTD_DStreamOutSize(); char* const outBuff = malloc(outBuffSize);