summaryrefslogtreecommitdiffhomepage
path: root/Public/SDK/ZipKit/Zip.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-27 17:06:30 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-27 17:06:30 +0100
commit2f7c48ef9172ba48fa177600a12ab0d51cb9e566 (patch)
tree96841cb24ca8756b1bc30ea50f9664245a3479fb /Public/SDK/ZipKit/Zip.cpp
parentb340547eb2d6db9eddd8bdbf0e473f9fe993bec4 (diff)
Kernel: Fix ABI for MP-CC, rename FilesystemIndexer to
IndexableProperty. Public/ZipKit: Add impl for deflate/inflate. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Public/SDK/ZipKit/Zip.cpp')
-rw-r--r--Public/SDK/ZipKit/Zip.cpp32
1 files changed, 31 insertions, 1 deletions
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