Skip to main content

ZSTD_CONTENTSIZE_UNKNOWN

Constant ZSTD_CONTENTSIZE_UNKNOWN 

Source
pub const ZSTD_CONTENTSIZE_UNKNOWN: i32 = -1;
Expand description

@brief Returns the decompressed content size stored in a ZSTD frame header.

@since v1.3.0

@param src Pointer to the beginning of a ZSTD encoded frame. @param srcSize Size of the buffer pointed to by @p src. It must be at least as large as the frame header. Any value greater than or equal to ZSTD_frameHeaderSize_max is sufficient. @return The decompressed size in bytes when the value is available in the frame header. @retval ZSTD_CONTENTSIZE_UNKNOWN The frame does not encode a decompressed size (typical for streaming). @retval ZSTD_CONTENTSIZE_ERROR An error occurred (e.g. invalid magic number, @p srcSize too small).

@note The return value is not compatible with ZSTD_isError(). @note A return value of 0 denotes a valid but empty frame. Skippable frames also report 0. @note The decompressed size field is optional. When it is absent (the function returns @c ZSTD_CONTENTSIZE_UNKNOWN), the caller must rely on streaming decompression or an application-specific upper bound. ZSTD_decompress() only requires an upper bound, so applications may enforce their own block limits (for example 16 KB). @note The decompressed size is guaranteed to be present when compression was performed with single-pass APIs such as ZSTD_compress(), ZSTD_compressCCtx(), ZSTD_compress_usingDict(), or ZSTD_compress_usingCDict(). @note The decompressed size is a 64-bit value and may exceed the addressable space of the system. Use streaming decompression when the value is too large to materialize in contiguous memory. @warning When processing untrusted input, validate the returned size against the application’s limits; attackers may forge an arbitrarily large value. @note This function replaces ZSTD_getDecompressedSize().