]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
promote ZSTD_getDecompressedSize() to stable API
authorYann Collet <yann.collet.73@gmail.com>
Sat, 9 Jul 2016 23:45:34 +0000 (01:45 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Sat, 9 Jul 2016 23:46:18 +0000 (01:46 +0200)
examples/dictionary_decompression.c
examples/simple_decompression.c
lib/common/zstd.h

index 39a8189fc528b14922e8f439f717768ee936585e..797075dee87b868224805e3c19f4028081c3dedd 100644 (file)
@@ -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;
index da45150279c69fa2ae99536a2fca39db96c906fe..1b58e552de33210e69bcaf7e2e240b0e668295af 100644 (file)
@@ -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;
index 186628fb8ee02e9b641165aad30b0bb9700ef759..146219d295b0fbd1a224e8e91a083a70c6501080 100644 (file)
@@ -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);