diff options
author | Jia Tan <jiat0218@gmail.com> | 2023-05-11 00:09:41 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-07-17 23:34:55 +0800 |
commit | afb2dbec3d857b026486b75e42a4728e12d234cb (patch) | |
tree | 030aa945cb78a8255d02222a80364f24d57540a8 | |
parent | xz: Allows --block-list filters to scale down memory usage. (diff) | |
download | xz-afb2dbec3d857b026486b75e42a4728e12d234cb.tar.xz |
xz: Validate --flush-timeout for all specified filter chains.
Diffstat (limited to '')
-rw-r--r-- | src/xz/coder.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c index a334e1e2..7cb286b2 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -376,15 +376,23 @@ coder_set_compression_settings(void) // from the filter chain. Currently the threaded encoder doesn't // support LZMA_SYNC_FLUSH so single-threaded mode must be used. if (opt_mode == MODE_COMPRESS && opt_flush_timeout != 0) { - for (size_t i = 0; i < filters_count; ++i) { - switch (default_filters[i].id) { - case LZMA_FILTER_LZMA2: - case LZMA_FILTER_DELTA: - break; + for (uint32_t i = 0; i < ARRAY_SIZE(filters); ++i) { + if (!(filters_init_mask & (1 << i))) + continue; - default: - message_fatal(_("The filter chain is " - "incompatible with --flush-timeout")); + const lzma_filter *fc = filters[i]; + for (size_t j = 0; fc[j].id != LZMA_VLI_UNKNOWN; j++) { + switch (fc[j].id) { + case LZMA_FILTER_LZMA2: + case LZMA_FILTER_DELTA: + break; + + default: + message_fatal(_("Filter chain %u is " + "incompatible with " + "--flush-timeout"), + (unsigned)i); + } } } |