mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
LibCore+LibHTTP+LibGfx: Switch to LibCompress
This commit removes the only 3rd party library (and its usages) in serenity: puff, which is used for deflate decompression. and replaces it with the existing original serenity implementation in LibCompress. :^)
This commit is contained in:
parent
373a595c56
commit
c12781a6a2
16 changed files with 31 additions and 1121 deletions
|
@ -31,9 +31,14 @@
|
|||
|
||||
namespace Compress {
|
||||
|
||||
bool GzipDecompressor::is_likely_compressed(ReadonlyBytes bytes)
|
||||
{
|
||||
return bytes.size() >= 2 && bytes[0] == gzip_magic_1 && bytes[1] == gzip_magic_2;
|
||||
}
|
||||
|
||||
bool GzipDecompressor::BlockHeader::valid_magic_number() const
|
||||
{
|
||||
return identification_1 == 0x1f && identification_2 == 0x8b;
|
||||
return identification_1 == gzip_magic_1 && identification_2 == gzip_magic_2;
|
||||
}
|
||||
|
||||
bool GzipDecompressor::BlockHeader::supported_by_implementation() const
|
||||
|
@ -48,10 +53,6 @@ bool GzipDecompressor::BlockHeader::supported_by_implementation() const
|
|||
return false;
|
||||
}
|
||||
|
||||
if (flags & Flags::FHCRC) {
|
||||
TODO();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -128,6 +129,12 @@ size_t GzipDecompressor::read(Bytes bytes)
|
|||
m_input_stream >> comment;
|
||||
}
|
||||
|
||||
if (header.flags & Flags::FHCRC) {
|
||||
LittleEndian<u16> crc16;
|
||||
m_input_stream >> crc16;
|
||||
// FIXME: we should probably verify this instead of just assuming it matches
|
||||
}
|
||||
|
||||
m_current_member.emplace(header, m_input_stream);
|
||||
return read(bytes);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue