diff options
Diffstat (limited to 'contrib/xz/src/liblzma/common')
-rw-r--r-- | contrib/xz/src/liblzma/common/block_buffer_encoder.c | 2 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/block_util.c | 6 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/chunk_size.c | 67 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/common.c | 2 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/common.h | 6 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/filter_common.c | 9 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/filter_decoder.c | 16 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/filter_encoder.c | 12 | ||||
-rw-r--r-- | contrib/xz/src/liblzma/common/stream_buffer_encoder.c | 2 |
9 files changed, 6 insertions, 116 deletions
diff --git a/contrib/xz/src/liblzma/common/block_buffer_encoder.c b/contrib/xz/src/liblzma/common/block_buffer_encoder.c index 4d90fee..a8f71c2 100644 --- a/contrib/xz/src/liblzma/common/block_buffer_encoder.c +++ b/contrib/xz/src/liblzma/common/block_buffer_encoder.c @@ -139,7 +139,7 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, // Size of the uncompressed chunk const size_t copy_size - = MIN(in_size - in_pos, LZMA2_CHUNK_MAX); + = my_min(in_size - in_pos, LZMA2_CHUNK_MAX); out[(*out_pos)++] = (copy_size - 1) >> 8; out[(*out_pos)++] = (copy_size - 1) & 0xFF; diff --git a/contrib/xz/src/liblzma/common/block_util.c b/contrib/xz/src/liblzma/common/block_util.c index cb9cde2..62c9345 100644 --- a/contrib/xz/src/liblzma/common/block_util.c +++ b/contrib/xz/src/liblzma/common/block_util.c @@ -15,7 +15,7 @@ extern LZMA_API(lzma_ret) -lzma_block_compressed_size(lzma_block *block, lzma_vli total_size) +lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) { // Validate everything but Uncompressed Size and filters. if (lzma_block_unpadded_size(block) == 0) @@ -25,13 +25,13 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli total_size) + lzma_check_size(block->check); // Validate that Compressed Size will be greater than zero. - if (container_size <= total_size) + if (unpadded_size <= container_size) return LZMA_DATA_ERROR; // Calculate what Compressed Size is supposed to be. // If Compressed Size was present in Block Header, // compare that the new value matches it. - const lzma_vli compressed_size = total_size - container_size; + const lzma_vli compressed_size = unpadded_size - container_size; if (block->compressed_size != LZMA_VLI_UNKNOWN && block->compressed_size != compressed_size) return LZMA_DATA_ERROR; diff --git a/contrib/xz/src/liblzma/common/chunk_size.c b/contrib/xz/src/liblzma/common/chunk_size.c deleted file mode 100644 index 363f07e..0000000 --- a/contrib/xz/src/liblzma/common/chunk_size.c +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file chunk_size.c -/// \brief Finds out the minimal reasonable chunk size for a filter chain -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "common.h" - - -/** - * \brief Finds out the minimal reasonable chunk size for a filter chain - * - * This function helps determining the Uncompressed Sizes of the Blocks when - * doing multi-threaded encoding. - * - * When compressing a large file on a system having multiple CPUs or CPU - * cores, the file can be split into smaller chunks, that are compressed - * independently into separate Blocks in the same .lzma Stream. - * - * \return Minimum reasonable Uncompressed Size of a Block. The - * recommended minimum Uncompressed Size is between this value - * and the value times two. - - Zero if the Uncompressed Sizes of Blocks don't matter - */ -extern LZMA_API(size_t) -lzma_chunk_size(const lzma_options_filter *filters) -{ - while (filters->id != LZMA_VLI_UNKNOWN) { - switch (filters->id) { - // TODO LZMA_FILTER_SPARSE - - case LZMA_FILTER_COPY: - case LZMA_FILTER_SUBBLOCK: - case LZMA_FILTER_X86: - case LZMA_FILTER_POWERPC: - case LZMA_FILTER_IA64: - case LZMA_FILTER_ARM: - case LZMA_FILTER_ARMTHUMB: - case LZMA_FILTER_SPARC: - // These are very fast, thus there is no point in - // splitting the data into smaller blocks. - break; - - case LZMA_FILTER_LZMA1: - // The block sizes of the possible next filters in - // the chain are irrelevant after the LZMA filter. - return ((lzma_options_lzma *)(filters->options)) - ->dictionary_size; - - default: - // Unknown filters - return 0; - } - - ++filters; - } - - // Indicate that splitting would be useless. - return SIZE_MAX; -} diff --git a/contrib/xz/src/liblzma/common/common.c b/contrib/xz/src/liblzma/common/common.c index 2f185e4..07b1d47 100644 --- a/contrib/xz/src/liblzma/common/common.c +++ b/contrib/xz/src/liblzma/common/common.c @@ -76,7 +76,7 @@ lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, { const size_t in_avail = in_size - *in_pos; const size_t out_avail = out_size - *out_pos; - const size_t copy_size = MIN(in_avail, out_avail); + const size_t copy_size = my_min(in_avail, out_avail); memcpy(out + *out_pos, in + *in_pos, copy_size); diff --git a/contrib/xz/src/liblzma/common/common.h b/contrib/xz/src/liblzma/common/common.h index 7b7fbb1..3a85168 100644 --- a/contrib/xz/src/liblzma/common/common.h +++ b/contrib/xz/src/liblzma/common/common.h @@ -60,12 +60,6 @@ #define LZMA_FILTER_RESERVED_START (LZMA_VLI_C(1) << 62) -/// Internal helper filter used by Subblock decoder. It is mapped to an -/// otherwise invalid Filter ID, which is impossible to get from any input -/// file (even if malicious file). -#define LZMA_FILTER_SUBBLOCK_HELPER LZMA_VLI_C(0x7000000000000001) - - /// Supported flags that can be passed to lzma_stream_decoder() /// or lzma_auto_decoder(). #define LZMA_SUPPORTED_FLAGS \ diff --git a/contrib/xz/src/liblzma/common/filter_common.c b/contrib/xz/src/liblzma/common/filter_common.c index 2322d7d..b157c62 100644 --- a/contrib/xz/src/liblzma/common/filter_common.c +++ b/contrib/xz/src/liblzma/common/filter_common.c @@ -52,15 +52,6 @@ static const struct { .changes_size = true, }, #endif -#if defined(HAVE_ENCODER_SUBBLOCK) || defined(HAVE_DECODER_SUBBLOCK) - { - .id = LZMA_FILTER_SUBBLOCK, - .options_size = sizeof(lzma_options_subblock), - .non_last_ok = true, - .last_ok = true, - .changes_size = true, - }, -#endif #ifdef HAVE_DECODER_X86 { .id = LZMA_FILTER_X86, diff --git a/contrib/xz/src/liblzma/common/filter_decoder.c b/contrib/xz/src/liblzma/common/filter_decoder.c index 95f77b7..1ebbe2a 100644 --- a/contrib/xz/src/liblzma/common/filter_decoder.c +++ b/contrib/xz/src/liblzma/common/filter_decoder.c @@ -14,8 +14,6 @@ #include "filter_common.h" #include "lzma_decoder.h" #include "lzma2_decoder.h" -#include "subblock_decoder.h" -#include "subblock_decoder_helper.h" #include "simple_decoder.h" #include "delta_decoder.h" @@ -60,20 +58,6 @@ static const lzma_filter_decoder decoders[] = { .props_decode = &lzma_lzma2_props_decode, }, #endif -#ifdef HAVE_DECODER_SUBBLOCK - { - .id = LZMA_FILTER_SUBBLOCK, - .init = &lzma_subblock_decoder_init, -// .memusage = &lzma_subblock_decoder_memusage, - .props_decode = NULL, - }, - { - .id = LZMA_FILTER_SUBBLOCK_HELPER, - .init = &lzma_subblock_decoder_helper_init, - .memusage = NULL, - .props_decode = NULL, - }, -#endif #ifdef HAVE_DECODER_X86 { .id = LZMA_FILTER_X86, diff --git a/contrib/xz/src/liblzma/common/filter_encoder.c b/contrib/xz/src/liblzma/common/filter_encoder.c index ab3d3af..436d2cc 100644 --- a/contrib/xz/src/liblzma/common/filter_encoder.c +++ b/contrib/xz/src/liblzma/common/filter_encoder.c @@ -14,7 +14,6 @@ #include "filter_common.h" #include "lzma_encoder.h" #include "lzma2_encoder.h" -#include "subblock_encoder.h" #include "simple_encoder.h" #include "delta_encoder.h" @@ -77,17 +76,6 @@ static const lzma_filter_encoder encoders[] = { .props_encode = &lzma_lzma2_props_encode, }, #endif -#ifdef HAVE_ENCODER_SUBBLOCK - { - .id = LZMA_FILTER_SUBBLOCK, - .init = &lzma_subblock_encoder_init, -// .memusage = &lzma_subblock_encoder_memusage, - .chunk_size = NULL, - .props_size_get = NULL, - .props_size_fixed = 0, - .props_encode = NULL, - }, -#endif #ifdef HAVE_ENCODER_X86 { .id = LZMA_FILTER_X86, diff --git a/contrib/xz/src/liblzma/common/stream_buffer_encoder.c b/contrib/xz/src/liblzma/common/stream_buffer_encoder.c index bbafaa6..f727d85 100644 --- a/contrib/xz/src/liblzma/common/stream_buffer_encoder.c +++ b/contrib/xz/src/liblzma/common/stream_buffer_encoder.c @@ -33,7 +33,7 @@ lzma_stream_buffer_bound(size_t uncompressed_size) // Catch the possible integer overflow and also prevent the size of // the Stream exceeding LZMA_VLI_MAX (theoretically possible on // 64-bit systems). - if (MIN(SIZE_MAX, LZMA_VLI_MAX) - block_bound < HEADERS_BOUND) + if (my_min(SIZE_MAX, LZMA_VLI_MAX) - block_bound < HEADERS_BOUND) return 0; return block_bound + HEADERS_BOUND; |