7static constexpr uint8_t ASCII_FLAG = 0x01;
8static constexpr uint8_t HEAD_CRC = 0x02;
9static constexpr uint8_t EXTRA_FIELD = 0x04;
10static constexpr uint8_t ORIG_NAME = 0x08;
11static constexpr uint8_t COMMENT = 0x10;
12static constexpr uint8_t RESERVED = 0xE0;
20[[nodiscard]]
static bool skipHeader(
ZlibInflate& zlib, std::string& originalName)
27 uint8_t method = zlib.
getByte();
29 if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
36 if ((flags & EXTRA_FIELD) != 0) {
40 if ((flags & ORIG_NAME) != 0) {
44 if ((flags & COMMENT) != 0) {
48 if ((flags & HEAD_CRC) != 0) {
55void GZFileAdapter::decompress(FileBase& f, Decompressed& d)
57 ZlibInflate zlib(f.mmap());
58 if (!skipHeader(zlib, d.originalName)) {
59 throw FileException(
"Not a gzip header");
GZFileAdapter(std::unique_ptr< FileBase > file)
MemBuffer< uint8_t > inflate(size_t sizeHint=65536)
This file implemented 3 utility functions: