mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibGfx/JPEG: Ensure capacity of vector instead of blindly appending
This commit is contained in:
parent
f4014f898d
commit
011fe0d9ba
Notes:
sideshowbarker
2024-07-17 11:34:34 +09:00
Author: https://github.com/LucasChollet
Commit: 011fe0d9ba
Pull-request: https://github.com/SerenityOS/serenity/pull/18583
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/gmta
1 changed files with 1 additions and 0 deletions
|
@ -892,6 +892,7 @@ static ErrorOr<void> read_huffman_table(Stream& stream, JPEGLoadingContext& cont
|
|||
}
|
||||
|
||||
table.codes.ensure_capacity(total_codes);
|
||||
table.symbols.ensure_capacity(total_codes);
|
||||
|
||||
// Read symbols. Read X bytes, where X is the sum of the counts of codes read in the previous step.
|
||||
for (u32 i = 0; i < total_codes; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue