summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCompress
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-06-17 09:24:28 +0200
committerLinus Groh <mail@linusgroh.de>2022-06-30 12:26:49 +0100
commit20575ea1f389909926a49478439ad68eb772a011 (patch)
tree177c3563f1a35a87b82fb616416f8f7538cab65f /Userland/Libraries/LibCompress
parentf33979a7535cfa62469fd56857ad13d76fe825bc (diff)
downloadserenity-20575ea1f389909926a49478439ad68eb772a011.zip
LibCompress: Add Zlib header structure
Diffstat (limited to 'Userland/Libraries/LibCompress')
-rw-r--r--Userland/Libraries/LibCompress/Zlib.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCompress/Zlib.h b/Userland/Libraries/LibCompress/Zlib.h
index f65457a640..195f962a7d 100644
--- a/Userland/Libraries/LibCompress/Zlib.h
+++ b/Userland/Libraries/LibCompress/Zlib.h
@@ -13,6 +13,32 @@
namespace Compress {
+enum class ZlibCompressionMethod : u8 {
+ Deflate = 8,
+};
+
+enum class ZlibCompressionLevel : u8 {
+ Fastest,
+ Fast,
+ Default,
+ Best,
+};
+
+struct ZlibHeader {
+ union {
+ struct {
+ ZlibCompressionMethod compression_method : 4;
+ u8 compression_info : 4;
+
+ u8 check_bits : 5;
+ bool present_dictionary : 1;
+ ZlibCompressionLevel compression_level : 2;
+ };
+ NetworkOrdered<u16> as_u16;
+ };
+};
+static_assert(sizeof(ZlibHeader) == sizeof(u16));
+
class Zlib {
public:
Optional<ByteBuffer> decompress();