mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibCompress: Remove special casing for looping DEFLATE seekbacks
The `copy_from_seekback` method already handles this exactly as DEFLATE expects, but it is slightly more optimized.
This commit is contained in:
parent
00ac73be57
commit
dffef6bb71
1 changed files with 3 additions and 11 deletions
|
@ -211,18 +211,10 @@ ErrorOr<bool> DeflateDecompressor::CompressedBlock::try_read_more()
|
|||
|
||||
auto const distance = TRY(m_decompressor.decode_distance(distance_symbol));
|
||||
|
||||
if (distance < length) {
|
||||
for (size_t idx = 0; idx < length; ++idx) {
|
||||
u8 byte = 0;
|
||||
TRY(m_decompressor.m_output_buffer.read_with_seekback({ &byte, sizeof(byte) }, distance));
|
||||
m_decompressor.m_output_buffer.write({ &byte, sizeof(byte) });
|
||||
}
|
||||
} else {
|
||||
auto copied_length = TRY(m_decompressor.m_output_buffer.copy_from_seekback(distance, length));
|
||||
auto copied_length = TRY(m_decompressor.m_output_buffer.copy_from_seekback(distance, length));
|
||||
|
||||
// TODO: What should we do if the output buffer is full?
|
||||
VERIFY(copied_length == length);
|
||||
}
|
||||
// TODO: What should we do if the output buffer is full?
|
||||
VERIFY(copied_length == length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue