mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
LibCore: Reduce debug spam from successful gzip decoding
This commit is contained in:
parent
39c7d9f061
commit
13c32e0607
1 changed files with 10 additions and 0 deletions
|
@ -54,7 +54,9 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||||
return data[current++];
|
return data[current++];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef DEBUG_GZIP
|
||||||
dbg() << "get_gzip_payload: Skipping over gzip header.";
|
dbg() << "get_gzip_payload: Skipping over gzip header.";
|
||||||
|
#endif
|
||||||
|
|
||||||
// Magic Header
|
// Magic Header
|
||||||
if (read_byte() != 0x1F || read_byte() != 0x8B) {
|
if (read_byte() != 0x1F || read_byte() != 0x8B) {
|
||||||
|
@ -102,7 +104,9 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto new_size = data.size() - current;
|
auto new_size = data.size() - current;
|
||||||
|
#ifdef DEBUG_GZIP
|
||||||
dbg() << "get_gzip_payload: Returning slice from " << current << " with size " << new_size;
|
dbg() << "get_gzip_payload: Returning slice from " << current << " with size " << new_size;
|
||||||
|
#endif
|
||||||
return data.slice(current, new_size);
|
return data.slice(current, new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +114,9 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
|
||||||
{
|
{
|
||||||
ASSERT(is_compressed(data));
|
ASSERT(is_compressed(data));
|
||||||
|
|
||||||
|
#ifdef DEBUG_GZIP
|
||||||
dbg() << "Gzip::decompress: Decompressing gzip compressed data. Size = " << data.size();
|
dbg() << "Gzip::decompress: Decompressing gzip compressed data. Size = " << data.size();
|
||||||
|
#endif
|
||||||
auto optional_payload = get_gzip_payload(data);
|
auto optional_payload = get_gzip_payload(data);
|
||||||
if (!optional_payload.has_value()) {
|
if (!optional_payload.has_value()) {
|
||||||
return Optional<ByteBuffer>();
|
return Optional<ByteBuffer>();
|
||||||
|
@ -135,14 +141,18 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
|
||||||
source.data(), &source_len);
|
source.data(), &source_len);
|
||||||
|
|
||||||
if (puff_ret == 0) {
|
if (puff_ret == 0) {
|
||||||
|
#ifdef DEBUG_GZIP
|
||||||
dbg() << "Gzip::decompress: Decompression success.";
|
dbg() << "Gzip::decompress: Decompression success.";
|
||||||
|
#endif
|
||||||
destination.trim(destination_len);
|
destination.trim(destination_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (puff_ret == 1) {
|
if (puff_ret == 1) {
|
||||||
// FIXME: Find a better way of decompressing without needing to try over and over again.
|
// FIXME: Find a better way of decompressing without needing to try over and over again.
|
||||||
|
#ifdef DEBUG_GZIP
|
||||||
dbg() << "Gzip::decompress: Output buffer exhausted. Growing.";
|
dbg() << "Gzip::decompress: Output buffer exhausted. Growing.";
|
||||||
|
#endif
|
||||||
destination.grow(destination.size() * 2);
|
destination.grow(destination.size() * 2);
|
||||||
} else {
|
} else {
|
||||||
dbg() << "Gzip::decompress: Error. puff() returned: " << puff_ret;
|
dbg() << "Gzip::decompress: Error. puff() returned: " << puff_ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue