xz: Validate --flush-timeout for all specified filter chains.

This commit is contained in:
Jia Tan 2023-05-11 00:09:41 +08:00
parent 5f0c5a0438
commit afb2dbec3d
1 changed files with 16 additions and 8 deletions

View File

@ -376,15 +376,23 @@ coder_set_compression_settings(void)
// from the filter chain. Currently the threaded encoder doesn't // from the filter chain. Currently the threaded encoder doesn't
// support LZMA_SYNC_FLUSH so single-threaded mode must be used. // support LZMA_SYNC_FLUSH so single-threaded mode must be used.
if (opt_mode == MODE_COMPRESS && opt_flush_timeout != 0) { if (opt_mode == MODE_COMPRESS && opt_flush_timeout != 0) {
for (size_t i = 0; i < filters_count; ++i) { for (uint32_t i = 0; i < ARRAY_SIZE(filters); ++i) {
switch (default_filters[i].id) { if (!(filters_init_mask & (1 << i)))
case LZMA_FILTER_LZMA2: continue;
case LZMA_FILTER_DELTA:
break;
default: const lzma_filter *fc = filters[i];
message_fatal(_("The filter chain is " for (size_t j = 0; fc[j].id != LZMA_VLI_UNKNOWN; j++) {
"incompatible with --flush-timeout")); 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);
}
} }
} }