pub fn decompress_hlzc_in_place(buf: &mut [u8], loaded: usize) -> Option<usize>Expand description
Undo the HLZC compression frame in place.
On entry buf[..loaded] holds a chunk payload as read from disc. A chunk
without the frame (mkisopsx keeps raw bytes when compression does not
shrink them) is returned untouched as Some(loaded). A framed chunk is
staged at the buffer tail and LZ4-decoded back to the head; buf only
needs to be large enough for the RAW payload plus the standard in-place
margin (the cooked-side buffer sizing already guarantees this; a too-small
buffer fails cleanly rather than corrupting).
None means a corrupt stream, a truncated buffer, or a decode that did
not produce exactly raw_len bytes. Callers should treat it as a failed
load, not a partial one.
Caveat inherited from the format: a RAW chunk whose first four bytes
happen to be HLZC would be misread as compressed. Cooked chunk types
all start with their own magics (HLMA, PSXT, …), which is what
makes the sniff safe in practice.