Add legacy support to decompressBound

This commit is contained in:
shakeelrao
2019-03-15 16:10:37 -07:00
parent f52a7d8faa
commit 60796e76b0
18 changed files with 329 additions and 123 deletions
+3 -13
View File
@@ -433,17 +433,6 @@ static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t he
return 0;
}
/**
* Contains the compressed frame size and an upper-bound for the decompressed frame size.
* Note: before using `compressedSize` you must check for errors using ZSTD_isError().
* similarly, before using `decompressedBound`, you must check for errors using:
* `decompressedBound` != ZSTD_CONTENTSIZE_ERROR
*/
typedef struct {
size_t compressedSize;
unsigned long long decompressedBound;
} ZSTD_frameSizeInfo;
static ZSTD_frameSizeInfo ZSTD_errorFrameSizeInfo(size_t ret)
{
ZSTD_frameSizeInfo frameSizeInfo;
@@ -458,8 +447,9 @@ static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize
memset(&frameSizeInfo, 0, sizeof(ZSTD_frameSizeInfo));
#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
if (ZSTD_isLegacy(src, srcSize))
return ZSTD_errorFrameSizeInfo(ZSTD_findFrameCompressedSizeLegacy(src, srcSize));
if (ZSTD_isLegacy(src, srcSize)) {
return ZSTD_findFrameSizeInfoLegacy(src, srcSize);
}
#endif
if ((srcSize >= ZSTD_SKIPPABLEHEADERSIZE)