LZ4_decompress_safe_partial

[LZ4_decompress_safe_partial()](API\Runtime\Core\Compression\LZ4_decompress_safe_partial) : Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', into destination buffer 'dst' of size 'dstCapacity'.

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Compression/lz4.h

Include

#include "Compression/lz4.h"

Syntax

LZ4int LZ4_decompress_safe_partial
(
    const char * src,
    char * dst,
    int srcSize,
    int targetOutputSize,
    int dstCapacity
)

Remarks

LZ4_decompress_safe_partial() : Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', into destination buffer 'dst' of size 'dstCapacity'. Up to 'targetOutputSize' bytes will be decoded. The function stops decoding on reaching this objective, which can boost performance when only the beginning of a block is required.

2 : this function features 2 parameters, targetOutputSize and dstCapacity, and expects targetOutputSize <= dstCapacity. It effectively stops decoding on reaching targetOutputSize, so dstCapacity is kind of redundant. This is because in a previous version of this function, decoding operation would not "break" a sequence in the middle. As a consequence, there was no guarantee that decoding would stop at exactly targetOutputSize, it could write more bytes, though only up to dstCapacity. Some "margin" used to be required for this operation to work properly. This is no longer necessary. The function nonetheless keeps its signature, in an effort to not break API.

Returns

can be < targetOutputSize, if compressed block contains less data.