Function zstd_sys::ZSTD_findDecompressedSize
[−]
[src]
pub unsafe extern "C" fn ZSTD_findDecompressedSize(
src: *const c_void,
srcSize: usize
) -> c_ulonglong
ZSTD_findDecompressedSize() :
* src
should point the start of a series of ZSTD encoded and/or skippable frames
* srcSize
must be the exact size of this series
* (i.e. there should be a frame boundary exactly srcSize
bytes after src
)
* @return : the decompressed size of all data in the contained frames, as a 64-bit value if known
* - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN
* - if an error occurred: ZSTD_CONTENTSIZE_ERROR
*
* note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode.
* When return==ZSTD_CONTENTSIZE_UNKNOWN
, data to decompress could be any size.
* In which case, it's necessary to use streaming mode to decompress data.
* Optionally, application can still use ZSTD_decompress() while relying on implied limits.
* (For example, data may be necessarily cut into blocks <= 16 KB).
* note 2 : decompressed size is always present when compression is done with ZSTD_compress()
* note 3 : decompressed size can be very large (64-bits value),
* potentially larger than what local system can handle as a single memory segment.
* In which case, it's necessary to use streaming mode to decompress data.
* note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified.
* Always ensure result fits within application's authorized limits.
* Each application can set its own limits.
* note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to
* read each contained frame header. This is efficient as most of the data is skipped,
* however it does mean that all frame data must be present and valid.