Decompresses the contents of a source buffer into a destination buffer.
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Compression
Declaration
func compression_decode_buffer(_ dst_buffer: Unsafe Mutable Pointer<UInt8>, _ dst_size: Int, _ src_buffer: Unsafe Pointer<UInt8>, _ src_size: Int, _ scratch_buffer: Unsafe Mutable Raw Pointer?, _ algorithm: compression _algorithm) -> Int
Parameters
dst_buffer
Pointer to the buffer that receives the decompressed data.
dst_size
Size of the destination buffer in bytes.
src_buffer
Pointer to a buffer containing all of the compressed source data.
src_size
Size of the data in the source buffer in bytes.
scratch_buffer
If
scratch
is not_buffer nil
, this parameter is a pointer to a buffer that the function uses for scratch purposes. The size of this buffer must be at least the size returned by a previous call tocompression
._decode _scratch _buffer _size(_:) If
scratch
is_buffer nil
, the function creates and manages its own scratch space, but with a possible performance hit.algorithm
Set to the desired algorithm:
COMPRESSION
,_LZ4 COMPRESSION
,_ZLIB COMPRESSION
, or_LZMA COMPRESSION
._LZFSE
Return Value
The number of bytes written to the destination buffer after decompressing the input. If there is not enough space in the destination buffer to hold the entire decompressed output, the function writes the first dst
bytes to the buffer and returns dst
. Note that this behavior differs from that of compression
.
Discussion
The function writes the decompressed data to dst
.