MCPcopy Create free account
hub / github.com/LUX-Core/lux / ProcessPrestreamHeader

Method ProcessPrestreamHeader

src/cryptopp/gzip.cpp:44–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void Gunzip::ProcessPrestreamHeader()
45{
46 m_length = 0;
47 m_crc.Restart();
48
49 byte buf[6];
50 byte b, flags;
51
52 if (m_inQueue.Get(buf, 2)!=2) throw HeaderErr();
53 if (buf[0] != MAGIC1 || buf[1] != MAGIC2) throw HeaderErr();
54 if (!m_inQueue.Skip(1)) throw HeaderErr(); // skip extra flags
55 if (!m_inQueue.Get(flags)) throw HeaderErr();
56 if (flags & (ENCRYPTED | CONTINUED)) throw HeaderErr();
57 if (m_inQueue.Skip(6)!=6) throw HeaderErr(); // Skip file time, extra flags and OS type
58
59 if (flags & EXTRA_FIELDS) // skip extra fields
60 {
61 word16 length;
62 if (m_inQueue.GetWord16(length, LITTLE_ENDIAN_ORDER) != 2) throw HeaderErr();
63 if (m_inQueue.Skip(length)!=length) throw HeaderErr();
64 }
65
66 if (flags & FILENAME) // skip filename
67 do
68 if(!m_inQueue.Get(b)) throw HeaderErr();
69 while (b);
70
71 if (flags & COMMENTS) // skip comments
72 do
73 if(!m_inQueue.Get(b)) throw HeaderErr();
74 while (b);
75}
76
77void Gunzip::ProcessDecompressedData(const byte *inString, size_t length)
78{

Callers

nothing calls this directly

Calls 5

GetWord16Method · 0.80
HeaderErrClass · 0.70
RestartMethod · 0.45
GetMethod · 0.45
SkipMethod · 0.45

Tested by

no test coverage detected