mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
gunzip+LibCompress: Increase buffer sizes used by Deflate and gunzip
Co-authored-by: Andreas Kling <kling@serenityos.org>
This commit is contained in:
parent
62b575ad7c
commit
9f238793e0
Notes:
sideshowbarker
2024-07-17 00:57:24 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/9f238793e0 Pull-request: https://github.com/SerenityOS/serenity/pull/18106
@ -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));
|
||||
|
||||
|
@ -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 };
|
||||
|
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user