lz4frame.h (1021B)
1 #ifndef KIT_DIST_LZ4FRAME_H 2 #define KIT_DIST_LZ4FRAME_H 3 4 #include <kit/core.h> 5 #include <stddef.h> 6 #include <stdint.h> 7 8 #include "dist.h" 9 10 /* Standard LZ4 frame format: the interoperable `.lz4` container (magic 11 * 0x184D2204 + frame header + blocks + optional XXH32 checksums), as opposed to 12 * the raw block codec in lz4.h used inside `.kpkg`. Output is a real `.lz4` 13 * frame that the stock `lz4` CLI reads. The frame layer's context/workspace 14 * allocations are routed through `heap`, so libkit makes no hidden libc heap 15 * calls (mirroring how lz4.c pins the block allocator). */ 16 17 /* Compress `data` into an LZ4 frame, streaming the result to `out`. */ 18 int dist_lz4f_compress(KitHeap* heap, KitWriter* out, const uint8_t* data, 19 size_t len); 20 21 /* Decompress an LZ4 frame from `data` into `out`. Returns DIST_ERR on a 22 * malformed/truncated frame or a checksum mismatch. */ 23 int dist_lz4f_decompress(KitHeap* heap, KitWriter* out, const uint8_t* data, 24 size_t len); 25 26 #endif