mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-14 14:59:52 -04:00
refactor(string_table): don't unnecessarily resize buffer
This commit is contained in:
parent
91d292f464
commit
e42f7dfc46
@ -230,18 +230,18 @@ string_table::pack_generic(std::span<T const> input,
|
||||
: total_input_size - symtab.size());
|
||||
size_t num_compressed = 0;
|
||||
|
||||
do {
|
||||
for (;;) {
|
||||
num_compressed = ::fsst_compress(
|
||||
enc.get(), size, len_vec.data(), ptr_vec.data(), buffer.size(),
|
||||
reinterpret_cast<unsigned char*>(buffer.data()), out_len_vec.data(),
|
||||
out_ptr_vec.data());
|
||||
|
||||
if (num_compressed == size) {
|
||||
if (num_compressed == size || !options.force_pack_data) {
|
||||
break;
|
||||
}
|
||||
|
||||
buffer.resize(2 * buffer.size());
|
||||
} while (options.force_pack_data);
|
||||
}
|
||||
|
||||
pack_data = num_compressed == size;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user