aboutsummaryrefslogtreecommitdiffstats
path: root/src/cnki_zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cnki_zlib.c')
-rw-r--r--src/cnki_zlib.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/cnki_zlib.c b/src/cnki_zlib.c
index 4355433..fd4cedf 100644
--- a/src/cnki_zlib.c
+++ b/src/cnki_zlib.c
@@ -4,4 +4,22 @@
* SPDX-License-Identifier: Apache-2.0
*/
-#include <zlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "zlib.h"
+
+int
+cnki_zlib(char **dst, int *dst_size,
+ const char * restrict src, int src_size)
+{
+ int32_t size;
+ memcpy(&size, src + 20, 4);
+
+ *dst_size = size;
+
+ if (strinflate(dst, size, src + 24, size - 24) != 0)
+ return 1;
+
+ return 0;
+}