diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-05-31 19:32:06 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-05-31 19:42:52 +0300 |
commit | 0d2f4a9edd041501cbbd09a76ade7a4b977e86af (patch) | |
tree | bfb9bf4e74848360f403ccd2d4f28431e020c1a9 /contrib/libs/lzma/liblzma/common/stream_encoder_mt.c | |
parent | 01178e24a1066fe3335a0b1442d1017ca82f1a0c (diff) | |
download | ydb-0d2f4a9edd041501cbbd09a76ade7a4b977e86af.tar.gz |
Update contrib/libs/lzma to 5.6.2
Keep "Update contrib/libs/lzma to 5.6.1" as an independent commit.
0cb9e331dfdcd6329e9a8211b4b89e280df9aa03
Diffstat (limited to 'contrib/libs/lzma/liblzma/common/stream_encoder_mt.c')
-rw-r--r-- | contrib/libs/lzma/liblzma/common/stream_encoder_mt.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/contrib/libs/lzma/liblzma/common/stream_encoder_mt.c b/contrib/libs/lzma/liblzma/common/stream_encoder_mt.c index f64de9bdbc..f0fef15233 100644 --- a/contrib/libs/lzma/liblzma/common/stream_encoder_mt.c +++ b/contrib/libs/lzma/liblzma/common/stream_encoder_mt.c @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: 0BSD + /////////////////////////////////////////////////////////////////////////////// // /// \file stream_encoder_mt.c @@ -5,9 +7,6 @@ // // Author: Lasse Collin // -// This file has been put into the public domain. -// You can do whatever you want with this file. -// /////////////////////////////////////////////////////////////////////////////// #include "filter_encoder.h" @@ -979,20 +978,18 @@ get_options(const lzma_mt *options, lzma_options_easy *opt_easy, *filters = opt_easy->filters; } - // Block size - if (options->block_size > 0) { - if (options->block_size > BLOCK_SIZE_MAX) - return LZMA_OPTIONS_ERROR; - + // If the Block size is not set, determine it from the filter chain. + if (options->block_size > 0) *block_size = options->block_size; - } else { - // Determine the Block size from the filter chain. + else *block_size = lzma_mt_block_size(*filters); - if (*block_size == 0) - return LZMA_OPTIONS_ERROR; - assert(*block_size <= BLOCK_SIZE_MAX); - } + // UINT64_MAX > BLOCK_SIZE_MAX, so the second condition + // should be optimized out by any reasonable compiler. + // The second condition should be there in the unlikely event that + // the macros change and UINT64_MAX < BLOCK_SIZE_MAX. + if (*block_size > BLOCK_SIZE_MAX || *block_size == UINT64_MAX) + return LZMA_OPTIONS_ERROR; // Calculate the maximum amount output that a single output buffer // may need to hold. This is the same as the maximum total size of |