mirror of
				https://github.com/facebook/zstd.git
				synced 2025-10-31 00:27:46 +02:00 
			
		
		
		
	Add legacy mode in documentation
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user