gunzip+LibCompress: Increase buffer sizes used by Deflate and gunzip

Co-authored-by: Andreas Kling <kling@serenityos.org>
This commit is contained in:
Timothy Flynn 2023-03-30 14:01:07 -04:00 committed by Andreas Kling
parent 62b575ad7c
commit 9f238793e0
Notes: sideshowbarker 2024-07-17 00:57:24 +09:00
3 changed files with 5 additions and 5 deletions

View File

@ -436,7 +436,7 @@ ErrorOr<void> DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Opt
// Next we extract the code lengths of the code that was used to encode the block.
Vector<u8> code_lengths;
Vector<u8, 286> code_lengths;
while (code_lengths.size() < literal_code_count + distance_code_count) {
auto symbol = TRY(code_length_code.read_symbol(*m_input_stream));

View File

@ -38,8 +38,8 @@ private:
};
// Decompression - indexed by code
Vector<u16> m_symbol_codes;
Vector<u16> m_symbol_values;
Vector<u16, 286> m_symbol_codes;
Vector<u16, 286> m_symbol_values;
Array<PrefixTableEntry, 1 << max_allowed_prefixed_code_length> m_prefix_table {};
size_t m_max_prefixed_code_length { 0 };

View File

@ -15,7 +15,7 @@ static ErrorOr<void> decompress_file(NonnullOwnPtr<Stream> input_stream, Stream&
{
auto gzip_stream = Compress::GzipDecompressor { move(input_stream) };
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
auto buffer = TRY(ByteBuffer::create_uninitialized(256 * KiB));
while (!gzip_stream.is_eof()) {
auto span = TRY(gzip_stream.read_some(buffer));
TRY(output_stream.write_until_depleted(span));
@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
}
auto input_file = TRY(Core::File::open(input_filename, Core::File::OpenMode::Read));
auto buffered_input_file = TRY(Core::BufferedFile::create(move(input_file)));
auto buffered_input_file = TRY(Core::BufferedFile::create(move(input_file), 256 * KiB));
auto output_stream = write_to_stdout ? TRY(Core::File::standard_output()) : TRY(Core::File::open(output_filename, Core::File::OpenMode::Write));