From 2f7c48ef9172ba48fa177600a12ab0d51cb9e566 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 27 Jan 2024 17:06:30 +0100 Subject: Kernel: Fix ABI for MP-CC, rename FilesystemIndexer to IndexableProperty. Public/ZipKit: Add impl for deflate/inflate. Signed-off-by: Amlal El Mahrouss --- Public/SDK/ZipKit/Zip.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'Public/SDK/ZipKit/Zip.cpp') diff --git a/Public/SDK/ZipKit/Zip.cpp b/Public/SDK/ZipKit/Zip.cpp index e6ff73ad..a7b3e0f4 100644 --- a/Public/SDK/ZipKit/Zip.cpp +++ b/Public/SDK/ZipKit/Zip.cpp @@ -45,12 +45,42 @@ namespace ZipKit void* ZipStream::Deflate(const char* name) { + z_stream deflate_stream{ 0 }; - return nullptr; + deflate_stream.zalloc = Z_NULL; + deflate_stream.zfree = Z_NULL; + deflate_stream.opaque = Z_NULL; + + // setup "b" as the input and "c" as the compressed output + deflate_stream.avail_in = (uInt)this->fSharedSz+1; // size of input, string + terminator + deflate_stream.next_in = (Bytef *)this->fSharedData; // input char array + deflate_stream.avail_out = (uInt)this->fSharedSz; // size of output + deflate_stream.next_out = (Bytef *)this->fSharedData; // output char array + + deflateInit(deflate_stream); + deflate(&deflate_stream, Z_NO_FLUSH); + deflateEnd(&deflate_stream); + + return this->fSharedData; } void ZipStream::Inflate(const char* name, void* data) { + z_stream inflate_stream{ 0 }; + + inflate_stream.zalloc = Z_NULL; + inflate_stream.zfree = Z_NULL; + inflate_stream.opaque = Z_NULL; + + // setup "b" as the input and "c" as the compressed output + inflate_stream.avail_in = (uInt)((char*)inflate_stream.next_out - b); // size of input + + inflate_stream.next_in = (Bytef *)this->fSharedData; // input char array + inflate_stream.avail_out = (uInt)this->fSharedSz; // size of output + inflate_stream.next_out = (Bytef *)this->fSharedData; // output char array + inflateInit(inflate_stream); + inflate(&inflate_stream, Z_NO_FLUSH); + inflateEnd(&inflate_stream); } } \ No newline at end of file -- cgit v1.2.3