aboutsummaryrefslogtreecommitdiff
path: root/data/compress.c
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-04-11 14:07:37 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-04-14 23:05:25 +0200
commitb1f78f2cddbcf1e137acb13c31b46e06d3012c58 (patch)
treef16ff77de4ddbb06aac2a8497ba2448d3846def9 /data/compress.c
parent0eadabbd642de773ce3187310eb4a52fd5dcd455 (diff)
Adds heatmaps
Diffstat (limited to 'data/compress.c')
-rw-r--r--data/compress.c56
1 files changed, 56 insertions, 0 deletions
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);
+}