diff --git a/examples/dictionary_decompression.c b/examples/dictionary_decompression.c index 39a8189fc..797075dee 100644 --- a/examples/dictionary_decompression.c +++ b/examples/dictionary_decompression.c @@ -85,9 +85,6 @@ static const ZSTD_DDict* createDict(const char* dictFileName) } -/* prototype declared here, as it currently is part of experimental section */ -unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); - static void decompress(const char* fname, const ZSTD_DDict* ddict) { size_t cSize; diff --git a/examples/simple_decompression.c b/examples/simple_decompression.c index da4515027..1b58e552d 100644 --- a/examples/simple_decompression.c +++ b/examples/simple_decompression.c @@ -74,9 +74,6 @@ static void* loadFile_X(const char* fileName, size_t* size) } -/* prototype declared here, as it is currently part of experimental section */ -unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); - static void decompress(const char* fname) { size_t cSize; diff --git a/lib/common/zstd.h b/lib/common/zstd.h index 186628fb8..146219d29 100644 --- a/lib/common/zstd.h +++ b/lib/common/zstd.h @@ -85,9 +85,14 @@ ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel); +/** ZSTD_getDecompressedSize() : +* @return : decompressed size if known, 0 otherwise. + note : to know precise reason why result is `0`, follow up with ZSTD_getFrameParams() */ +unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); + /*! ZSTD_decompress() : - `compressedSize` : is the _exact_ size of the compressed blob, otherwise decompression will fail. - `dstCapacity` must be large enough, equal or larger than originalSize. + `compressedSize` : is the _exact_ size of compressed input, otherwise decompression will fail. + `dstCapacity` must be equal or larger than originalSize. @return : the number of bytes decompressed into `dst` (<= `dstCapacity`), or an errorCode if it fails (which can be tested using ZSTD_isError()) */ ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity, @@ -298,15 +303,6 @@ ZSTDLIB_API size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx, /*--- Advanced Decompression functions ---*/ -/** ZSTD_getDecompressedSize() : -* compatible with legacy mode -* @return : decompressed size if known, 0 otherwise - note : 0 can mean any of the following : - - decompressed size is not provided within frame header - - frame header unknown / not supported - - frame header not completely provided (`srcSize` too small) */ -unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); - /*! ZSTD_createDCtx_advanced() : * Create a ZSTD decompression context using external alloc and free functions */ ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);