@@ -178,6 +178,7 @@ ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity,
178
178
* - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
179
179
* - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small)
180
180
* note 1 : a 0 return value means the frame is valid but "empty".
181
+ * When invoking this method on a skippable frame, it will return 0.
181
182
* note 2 : decompressed size is an optional field, it may not be present (typically in streaming mode).
182
183
* When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size.
183
184
* In which case, it's necessary to use streaming mode to decompress data.
@@ -197,22 +198,26 @@ ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity,
197
198
#define ZSTD_CONTENTSIZE_ERROR (0ULL - 2 )
198
199
ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize (const void *src, size_t srcSize);
199
200
200
- /* ! ZSTD_getDecompressedSize() :
201
- * NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize().
201
+ /* ! ZSTD_getDecompressedSize() (obsolete) :
202
+ * This function is now obsolete, in favor of ZSTD_getFrameContentSize().
202
203
* Both functions work the same way, but ZSTD_getDecompressedSize() blends
203
204
* "empty", "unknown" and "error" results to the same return value (0),
204
205
* while ZSTD_getFrameContentSize() gives them separate return values.
205
206
* @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise. */
206
207
ZSTD_DEPRECATED (" Replaced by ZSTD_getFrameContentSize" )
207
- ZSTDLIB_API
208
- unsigned long long ZSTD_getDecompressedSize(const void * src, size_t srcSize);
208
+ ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void * src, size_t srcSize);
209
209
210
210
/* ! ZSTD_findFrameCompressedSize() : Requires v1.4.0+
211
211
* `src` should point to the start of a ZSTD frame or skippable frame.
212
212
* `srcSize` must be >= first frame size
213
213
* @return : the compressed size of the first frame starting at `src`,
214
214
* suitable to pass as `srcSize` to `ZSTD_decompress` or similar,
215
- * or an error code if input is invalid */
215
+ * or an error code if input is invalid
216
+ * Note 1: this method is called _find*() because it's not enough to read the header,
217
+ * it may have to scan through the frame's content, to reach its end.
218
+ * Note 2: this method also works with Skippable Frames. In which case,
219
+ * it returns the size of the complete skippable frame,
220
+ * which is always equal to its content size + 8 bytes for headers. */
216
221
ZSTDLIB_API size_t ZSTD_findFrameCompressedSize (const void * src, size_t srcSize);
217
222
218
223
@@ -1507,7 +1512,7 @@ typedef struct {
1507
1512
/* ! ZSTD_getFrameHeader() :
1508
1513
* decode Frame Header, or requires larger `srcSize`.
1509
1514
* @return : 0, `zfhPtr` is correctly filled,
1510
- * >0, `srcSize` is too small, value is wanted `srcSize` amount,
1515
+ * >0, `srcSize` is too small, @return value is the wanted `srcSize` amount,
1511
1516
* or an error code, which can be tested using ZSTD_isError() */
1512
1517
ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader (ZSTD_frameHeader* zfhPtr, const void * src, size_t srcSize); /* *< doesn't consume input */
1513
1518
/* ! ZSTD_getFrameHeader_advanced() :
@@ -1695,35 +1700,37 @@ ZSTD_compressSequencesAndLiterals(ZSTD_CCtx* cctx,
1695
1700
*
1696
1701
* Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number,
1697
1702
* ranging from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15.
1698
- * As such, the parameter magicVariant controls the exact skippable frame magic number variant used, so
1699
- * the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant.
1703
+ * As such, the parameter magicVariant controls the exact skippable frame magic number variant used,
1704
+ * so the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant.
1700
1705
*
1701
1706
* Returns an error if destination buffer is not large enough, if the source size is not representable
1702
1707
* with a 4-byte unsigned int, or if the parameter magicVariant is greater than 15 (and therefore invalid).
1703
1708
*
1704
1709
* @return : number of bytes written or a ZSTD error.
1705
1710
*/
1706
1711
ZSTDLIB_STATIC_API size_t ZSTD_writeSkippableFrame (void * dst, size_t dstCapacity,
1707
- const void * src, size_t srcSize, unsigned magicVariant);
1712
+ const void * src, size_t srcSize,
1713
+ unsigned magicVariant);
1708
1714
1709
1715
/* ! ZSTD_readSkippableFrame() :
1710
- * Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer.
1716
+ * Retrieves the content of a zstd skippable frame starting at @ src, and writes it to @ dst buffer.
1711
1717
*
1712
- * The parameter magicVariant will receive the magicVariant that was supplied when the frame was written,
1713
- * i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested
1714
- * in the magicVariant.
1718
+ * The parameter @ magicVariant will receive the magicVariant that was supplied when the frame was written,
1719
+ * i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START.
1720
+ * This can be NULL if the caller is not interested in the magicVariant.
1715
1721
*
1716
1722
* Returns an error if destination buffer is not large enough, or if the frame is not skippable.
1717
1723
*
1718
1724
* @return : number of bytes written or a ZSTD error.
1719
1725
*/
1720
- ZSTDLIB_API size_t ZSTD_readSkippableFrame (void * dst, size_t dstCapacity, unsigned * magicVariant,
1721
- const void * src, size_t srcSize);
1726
+ ZSTDLIB_STATIC_API size_t ZSTD_readSkippableFrame (void * dst, size_t dstCapacity,
1727
+ unsigned * magicVariant,
1728
+ const void * src, size_t srcSize);
1722
1729
1723
1730
/* ! ZSTD_isSkippableFrame() :
1724
1731
* Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame.
1725
1732
*/
1726
- ZSTDLIB_API unsigned ZSTD_isSkippableFrame (const void * buffer, size_t size);
1733
+ ZSTDLIB_STATIC_API unsigned ZSTD_isSkippableFrame (const void * buffer, size_t size);
1727
1734
1728
1735
1729
1736
0 commit comments