From b1f78f2cddbcf1e137acb13c31b46e06d3012c58 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Sat, 11 Apr 2026 14:07:37 +0200 Subject: Adds heatmaps --- data/compress.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 data/compress.c (limited to 'data/compress.c') diff --git a/data/compress.c b/data/compress.c new file mode 100644 index 0000000..df61123 --- /dev/null +++ b/data/compress.c @@ -0,0 +1,56 @@ +void salis_deflate(z_stream *strm, size_t size, Bytef *in, Bytef *out) { + assert(strm); + assert(size); + assert(in); + assert(out); + + strm->zalloc = NULL; + strm->zfree = NULL; + strm->opaque = NULL; + + deflateInit(strm, Z_DEFAULT_COMPRESSION); + + strm->avail_in = size; + strm->avail_out = size; + strm->next_in = in; + strm->next_out = out; + + deflate(strm, Z_FINISH); +} + +void salis_deflate_end(z_stream *strm) { + assert(strm); + + deflateEnd(strm); +} + +void salis_inflate(z_stream *strm, size_t avail_in, size_t size, Bytef *in, Bytef *out) { + assert(strm); + assert(avail_in); + assert(size); + assert(in); + assert(out); + + strm->next_in = in; + strm->avail_in = avail_in; + strm->zalloc = NULL; + strm->zfree = NULL; + strm->opaque = NULL; + + inflateInit(strm); + + strm->avail_out = size; + strm->next_out = out; + +#if defined(NDEBUG) + inflate(strm, Z_FINISH); +#else + assert(inflate(strm, Z_FINISH)); +#endif +} + +void salis_inflate_end(z_stream *strm) { + assert(strm); + + inflateEnd(strm); +} -- cgit v1.2.1