diff options
author | asynts <asynts@gmail.com> | 2020-08-31 11:31:52 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-31 23:04:55 +0200 |
commit | ef7bec6a3bac300daf5e3a75910277ae520e3a7a (patch) | |
tree | ada0863640651a0f07e8ea803d4a206c76e8b973 /Libraries/LibCompress | |
parent | 8a2fd0e43629acd652c8da2c979688ed60080ba5 (diff) | |
download | serenity-ef7bec6a3bac300daf5e3a75910277ae520e3a7a.zip |
LibCompress: CanonicalCode: Don't leave unused code uninitialized.
Diffstat (limited to 'Libraries/LibCompress')
-rw-r--r-- | Libraries/LibCompress/Deflate.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Libraries/LibCompress/Deflate.cpp b/Libraries/LibCompress/Deflate.cpp index 962aa5e5a5..6a464f5758 100644 --- a/Libraries/LibCompress/Deflate.cpp +++ b/Libraries/LibCompress/Deflate.cpp @@ -40,10 +40,6 @@ DeflateDecompressor::CanonicalCode::CanonicalCode(ReadonlyBytes codes) { // FIXME: I can't quite follow the algorithm here, but it seems to work. - m_symbol_codes.resize(codes.size()); - m_symbol_values.resize(codes.size()); - - auto allocated_symbols_count = 0; auto next_code = 0; for (size_t code_length = 1; code_length <= 15; ++code_length) { @@ -59,10 +55,9 @@ DeflateDecompressor::CanonicalCode::CanonicalCode(ReadonlyBytes codes) ASSERT_NOT_REACHED(); } - m_symbol_codes[allocated_symbols_count] = start_bit | next_code; - m_symbol_values[allocated_symbols_count] = symbol; + m_symbol_codes.append(start_bit | next_code); + m_symbol_values.append(symbol); - allocated_symbols_count++; next_code++; } } |