LZ4_decompre...ast_continue(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

LZ4_decompress_fast_continue β€” decompress blocks in streaming mode, bestie πŸ’«

Ok so real talk, this is the kernel API manual (section 9, yes that one) and this little function is basically the group-chat admin for streaming decompression. Let's get into it 🫢


✨ SYNOPSIS ✨

int LZ4_decompress_fast_continue (LZ4_streamDecode_t *LZ4_streamDecode ,
const char *source , char *dest , int originalSize );

πŸ’– ARGUMENTS πŸ’–

  • LZ4_streamDecode β€” the 'LZ4_streamDecode_t' structure. yeah. that one. your stream-decode state bestie 🧚
  • source β€” source address of the compressed data πŸ“₯
  • dest β€” output buffer address of the uncompressed data, which must already be allocated with 'originalSize' bytes. no, it will not grow itself for you πŸ’€
  • originalSize β€” the original and therefore uncompressed size 🌸

πŸ¦‹ DESCRIPTION πŸ¦‹

This decoding function lets you decompress multiple blocks in "streaming" mode. Iconic. But here's the rule you literally cannot skip: previously decoded blocks *must* stay available at the memory position where they were decoded (up to 64 KB). Not "should". Must. Non-negotiable πŸ’…

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

  • Exactly the same size as the encoding buffer, with the same update rule (block boundaries at the same positions). In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB). slay ✨
  • 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 64 KB of decoded data into a safe buffer, and indicate where it is saved using LZ4_setStreamDecode 🫢
lowkey important: those three options are the only options. vibe check your buffer sizes before you ship, ngl πŸ™ˆ

πŸ”₯ RETURN πŸ”₯

Number of bytes decompressed into the destination buffer (necessarily <= maxDecompressedSize), or a negative result in case of error. So if it comes back negative, that's not a slay, that's a cry for help 😭


🌈 SEE ALSO 🌈

Kernel file ./include/linux/lz4.h


k bye bestie, go decompress responsibly πŸ’œ this one came straight out of ./include/linux in the October 2026 edition of the Kernel API Manual β€” catch you in LZ4_decompre...ast_continue(9) again soon πŸŽ€βœ¨

πŸ“¦ where this page comes from