From: shakeelrao Date: Tue, 19 Mar 2019 03:33:15 +0000 (-0700) Subject: Add legacy mode in documentation X-Git-Tag: v1.4.0^2~26^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a3fa6f9095299488c1ebf39b081d1cae67b56eb;p=thirdparty%2Fzstd.git Add legacy mode in documentation --- diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 7870bae50..142923fe4 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -518,7 +518,7 @@ size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize) /** ZSTD_decompressBound() : - * currently incompatible with legacy mode + * compatible with legacy mode * `src` must point to the start of a ZSTD frame or a skippeable frame * `srcSize` must be at least as large as the frame contained * @return : the maximum decompressed size of the compressed source diff --git a/lib/legacy/zstd_v01.c b/lib/legacy/zstd_v01.c index 0f77533fc..bb0f4b593 100644 --- a/lib/legacy/zstd_v01.c +++ b/lib/legacy/zstd_v01.c @@ -2001,6 +2001,8 @@ size_t ZSTDv01_decompress(void* dst, size_t maxDstSize, const void* src, size_t return ZSTDv01_decompressDCtx(&ctx, dst, maxDstSize, src, srcSize); } +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; diff --git a/lib/legacy/zstd_v01.h b/lib/legacy/zstd_v01.h index bcc3545fd..8329429a3 100644 --- a/lib/legacy/zstd_v01.h +++ b/lib/legacy/zstd_v01.h @@ -42,6 +42,8 @@ size_t ZSTDv01_decompress( void* dst, size_t maxOriginalSize, or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. */ void ZSTDv01_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/legacy/zstd_v02.c b/lib/legacy/zstd_v02.c index 1d7c20649..594835943 100644 --- a/lib/legacy/zstd_v02.c +++ b/lib/legacy/zstd_v02.c @@ -3314,7 +3314,9 @@ static size_t ZSTD_decompress(void* dst, size_t maxDstSize, const void* src, siz return ZSTD_decompressDCtx(&ctx, dst, maxDstSize, src, srcSize); } -MEM_STATIC void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ +static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; *dBound = ZSTD_CONTENTSIZE_ERROR; diff --git a/lib/legacy/zstd_v02.h b/lib/legacy/zstd_v02.h index 5e6911f8a..556d509e3 100644 --- a/lib/legacy/zstd_v02.h +++ b/lib/legacy/zstd_v02.h @@ -42,6 +42,8 @@ size_t ZSTDv02_decompress( void* dst, size_t maxOriginalSize, or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. */ void ZSTDv02_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/legacy/zstd_v03.c b/lib/legacy/zstd_v03.c index 2aac45d18..b6c60d296 100644 --- a/lib/legacy/zstd_v03.c +++ b/lib/legacy/zstd_v03.c @@ -2955,6 +2955,8 @@ static size_t ZSTD_decompress(void* dst, size_t maxDstSize, const void* src, siz return ZSTD_decompressDCtx(&ctx, dst, maxDstSize, src, srcSize); } +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ MEM_STATIC void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; diff --git a/lib/legacy/zstd_v03.h b/lib/legacy/zstd_v03.h index 6bde907f0..c2d9f191f 100644 --- a/lib/legacy/zstd_v03.h +++ b/lib/legacy/zstd_v03.h @@ -42,6 +42,9 @@ size_t ZSTDv03_decompress( void* dst, size_t maxOriginalSize, or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. + */ void ZSTDv03_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/legacy/zstd_v04.c b/lib/legacy/zstd_v04.c index 22de6b94d..65dc64dbb 100644 --- a/lib/legacy/zstd_v04.c +++ b/lib/legacy/zstd_v04.c @@ -3121,7 +3121,9 @@ static size_t ZSTD_decompress_usingDict(ZSTD_DCtx* ctx, return op-ostart; } -MEM_STATIC void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ +static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; *dBound = ZSTD_CONTENTSIZE_ERROR; diff --git a/lib/legacy/zstd_v04.h b/lib/legacy/zstd_v04.h index 11b3c00b3..84a3e7d70 100644 --- a/lib/legacy/zstd_v04.h +++ b/lib/legacy/zstd_v04.h @@ -42,6 +42,8 @@ size_t ZSTDv04_decompress( void* dst, size_t maxOriginalSize, or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. */ void ZSTDv04_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/legacy/zstd_v05.c b/lib/legacy/zstd_v05.c index 469466b14..1c39f2f26 100644 --- a/lib/legacy/zstd_v05.c +++ b/lib/legacy/zstd_v05.c @@ -3510,7 +3510,9 @@ size_t ZSTDv05_decompress(void* dst, size_t maxDstSize, const void* src, size_t #endif } -MEM_STATIC void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ +static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; *dBound = ZSTD_CONTENTSIZE_ERROR; diff --git a/lib/legacy/zstd_v05.h b/lib/legacy/zstd_v05.h index 2d95084b6..3b866083a 100644 --- a/lib/legacy/zstd_v05.h +++ b/lib/legacy/zstd_v05.h @@ -40,6 +40,9 @@ size_t ZSTDv05_decompress( void* dst, size_t dstCapacity, or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. + */ void ZSTDv05_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/legacy/zstd_v06.c b/lib/legacy/zstd_v06.c index 2daea0e91..65975ac29 100644 --- a/lib/legacy/zstd_v06.c +++ b/lib/legacy/zstd_v06.c @@ -3656,7 +3656,9 @@ size_t ZSTDv06_decompress(void* dst, size_t dstCapacity, const void* src, size_t #endif } -MEM_STATIC void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ +static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; *dBound = ZSTD_CONTENTSIZE_ERROR; diff --git a/lib/legacy/zstd_v06.h b/lib/legacy/zstd_v06.h index 71d3b6af1..971429c9b 100644 --- a/lib/legacy/zstd_v06.h +++ b/lib/legacy/zstd_v06.h @@ -49,6 +49,9 @@ ZSTDv06_findFrameSizeInfoLegacy() : get the source length and decompressed bound or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. + */ void ZSTDv06_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/legacy/zstd_v07.c b/lib/legacy/zstd_v07.c index 89fe7d5aa..443524b3a 100644 --- a/lib/legacy/zstd_v07.c +++ b/lib/legacy/zstd_v07.c @@ -3897,7 +3897,9 @@ size_t ZSTDv07_decompress(void* dst, size_t dstCapacity, const void* src, size_t #endif } -MEM_STATIC void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) +/* ZSTD_errorFrameSizeInfoLegacy() : + assumes `cSize` and `dBound` are _not_ NULL */ +static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) { *cSize = ret; *dBound = ZSTD_CONTENTSIZE_ERROR; diff --git a/lib/legacy/zstd_v07.h b/lib/legacy/zstd_v07.h index 912ff7c5e..c8144bd61 100644 --- a/lib/legacy/zstd_v07.h +++ b/lib/legacy/zstd_v07.h @@ -56,6 +56,9 @@ ZSTDv07_findFrameSizeInfoLegacy() : get the source length and decompressed bound or an errorCode if it fails (which can be tested using ZSTDv01_isError()) dBound (output paramter) : an upper-bound for the decompressed size of the data in the frame or ZSTD_CONTENTSIZE_ERROR if an error occurs + + note : assumes `cSize` and `dBound` are _not_ NULL. + */ void ZSTDv07_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound); diff --git a/lib/zstd.h b/lib/zstd.h index 4373d6dfd..f6332589d 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -1115,7 +1115,7 @@ ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t * @return : - upper-bound for the decompressed size of all data in all successive frames * - if an error occured: ZSTD_CONTENTSIZE_ERROR * - * note 1 : an error can occur if `src` contains a legacy frame or an invalid/incorrectly formatted frame. + * note 1 : an error can occur if `src` contains an invalid or incorrectly formatted frame. * note 2 : the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of `src`. * in this case, `ZSTD_findDecompressedSize` and `ZSTD_decompressBound` return the same value. * note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by: