diff options
author | Yann Collet <cyan@fb.com> | 2019-04-10 01:10:02 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2019-04-10 01:10:58 (GMT) |
commit | 9e501702bd1137b4049d06edc60ec366ec725d34 (patch) | |
tree | df9545f8e53875a7d9fc71e8a39d4f2fd4962f40 /tests/frametest.c | |
parent | 9fdc1a01184b5a6f676aba224c7cb4eac5a1e6c4 (diff) | |
download | lz4-9e501702bd1137b4049d06edc60ec366ec725d34.zip lz4-9e501702bd1137b4049d06edc60ec366ec725d34.tar.gz lz4-9e501702bd1137b4049d06edc60ec366ec725d34.tar.bz2 |
made LZ4F_getHeaderSize() public
Diffstat (limited to 'tests/frametest.c')
-rw-r--r-- | tests/frametest.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/frametest.c b/tests/frametest.c index fa005db..59e866c 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -211,9 +211,13 @@ int basicTests(U32 seed, double compressibility) CHECK ( LZ4F_createDecompressionContext(&dCtx, LZ4F_VERSION) ); DISPLAYLEVEL(3, "LZ4F_getFrameInfo on null-content frame (#157) \n"); - { size_t avail_in = cSize; - LZ4F_frameInfo_t frame_info; + assert(cSize >= LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH); + { LZ4F_frameInfo_t frame_info; + size_t const fhs = LZ4F_headerSize(compressedBuffer, LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH); + size_t avail_in = fhs; + CHECK( fhs ); CHECK( LZ4F_getFrameInfo(dCtx, &frame_info, compressedBuffer, &avail_in) ); + if (avail_in != fhs) goto _output_error; /* must consume all, since header size is supposed to be exact */ } DISPLAYLEVEL(3, "LZ4F_freeDecompressionContext \n"); @@ -306,7 +310,8 @@ int basicTests(U32 seed, double compressibility) } DISPLAYLEVEL(3, "LZ4F_getFrameInfo on enough input : "); - iSize = 15 - iSize; + iSize = LZ4F_headerSize(ip, LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH); + CHECK( iSize ); CHECK( LZ4F_getFrameInfo(dCtx, &fi, ip, &iSize) ); DISPLAYLEVEL(3, " correctly decoded \n"); } |