LZ4_decompre...afe_continue(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

LZ4_decompress_safe_continue β€” decompress blocks in streaming mode, bestie πŸ’…

Oh and hey, quick vibe check β€” this whole page lives in the Kernel API Manual, so like… kernel girlies, this one's for you 🫢


✨ SYNOPSIS ✨

int LZ4_decompress_safe_continue (LZ4_streamDecode_t *LZ4_streamDecode ,
const char *source , char *dest , int compressedSize , int
maxDecompressedSize );

πŸŽ€ ARGUMENTS πŸŽ€

  • LZ4_streamDecode β€” the LZ4_streamDecode_t structure, that's your little state bestie 🫢
  • source β€” source address of the compressed data, aka where the good stuff lives
  • dest β€” output buffer address of the uncompressed data, and heads up: it must be already allocated (not me forgetting to malloc, never 😭)
  • compressedSize β€” the precise full size of the compressed block, like exactly exactly
  • maxDecompressedSize β€” the size of the dest buffer

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this decoding function lets you decompress multiple blocks in "streaming" mode ✨ And here's the thing β€” previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB). Like, do not move them, do not touch them, they live there now πŸ’€

In the case of ring buffers, the decoding buffer must be either:

  • Exactly same size as the encoding buffer, with the same update rule (block boundaries at same positions). In which case, the decoding & encoding ring buffer can have any size, including very small ones (< 64 KB). Slay, tiny buffers πŸŽ€
  • Larger than the encoding buffer, by a minimum of maxBlockSize more bytes. maxBlockSize is implementation dependent β€” it's the maximum size you intend to compress into a single block. In which case, encoding and decoding buffers do not need to be synchronized, and the encoding ring buffer can have any size, including small ones (< 64 KB) ✨
  • At least 64 KB + 8 bytes + maxBlockSize. In which case, encoding and decoding buffers do not need to be synchronized, and the encoding ring buffer can have any size, including larger than the decoding buffer πŸ‘‘
Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer, and indicate where it is saved using LZ4_setStreamDecode β€” no cap, this is the fallback and it's not optional 🚨

πŸ”₯ RETURN πŸ”₯

Number of bytes decompressed into the destination buffer (necessarily <= maxDecompressedSize) β€” or a negative result in case of error 😭


πŸ’œ SEE ALSO πŸ’œ

Kernel file ./include/linux/lz4.h plus the whole friend group:

LZ4_compressBound(9), LZ4_compress_default(9), LZ4_compress_fast(9), LZ4_compress_destSize(9), LZ4_decompress_fast(9), LZ4_decompress_safe(9), LZ4_decompress_safe_partial(9), LZ4_compress_HC(9), LZ4_resetStreamHC(9), LZ4_loadDictHC(9), LZ4_compress_HC_continue(9), LZ4_saveDictHC(9), LZ4_resetStream(9), LZ4_loadDict(9), LZ4_saveDict(9), LZ4_compress_fast_continue(9), LZ4_setStreamDecode(9), LZ4_decompress_fast_continue(9), LZ4_decompress_safe_usingDict(9), LZ4_decompress_fast_usingDict(9)


Okay that's the whole page, mwah πŸ’‹ This cutie came from ./include/linux, dated October 2026, and it's filed under LZ4_decompre...afe_continue(9) β€” go forth and decompress responsibly, bestie πŸŒˆπŸ’–

πŸ“¦ where this page comes from