diff options
Diffstat (limited to 'Build/source/extra/xz/src/liblzma/lz')
5 files changed, 14 insertions, 9 deletions
diff --git a/Build/source/extra/xz/src/liblzma/lz/lz_decoder.c b/Build/source/extra/xz/src/liblzma/lz/lz_decoder.c index 350b1f89812..2c57355125f 100644 --- a/Build/source/extra/xz/src/liblzma/lz/lz_decoder.c +++ b/Build/source/extra/xz/src/liblzma/lz/lz_decoder.c @@ -81,8 +81,9 @@ decode_buffer(lzma_coder *coder, // It must not decode past the end of the dictionary // buffer, and we don't want it to decode more than is // actually needed to fill the out[] buffer. - coder->dict.limit = coder->dict.pos + MIN(out_size - *out_pos, - coder->dict.size - coder->dict.pos); + coder->dict.limit = coder->dict.pos + + my_min(out_size - *out_pos, + coder->dict.size - coder->dict.pos); // Call the coder->lz.code() to do the actual decoding. const lzma_ret ret = coder->lz.code( @@ -264,7 +265,7 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, && lz_options.preset_dict_size > 0) { // If the preset dictionary is bigger than the actual // dictionary, copy only the tail. - const size_t copy_size = MIN(lz_options.preset_dict_size, + const size_t copy_size = my_min(lz_options.preset_dict_size, lz_options.dict_size); const size_t offset = lz_options.preset_dict_size - copy_size; memcpy(next->coder->dict.buf, lz_options.preset_dict + offset, diff --git a/Build/source/extra/xz/src/liblzma/lz/lz_decoder.h b/Build/source/extra/xz/src/liblzma/lz/lz_decoder.h index bf1609dbedf..7266e803165 100644 --- a/Build/source/extra/xz/src/liblzma/lz/lz_decoder.h +++ b/Build/source/extra/xz/src/liblzma/lz/lz_decoder.h @@ -129,7 +129,7 @@ dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len) { // Don't write past the end of the dictionary. const size_t dict_avail = dict->limit - dict->pos; - uint32_t left = MIN(dict_avail, *len); + uint32_t left = my_min(dict_avail, *len); *len -= left; // Repeat a block of data from the history. Because memcpy() is faster diff --git a/Build/source/extra/xz/src/liblzma/lz/lz_encoder.c b/Build/source/extra/xz/src/liblzma/lz/lz_encoder.c index 757e53749c4..9e980a2c71d 100644 --- a/Build/source/extra/xz/src/liblzma/lz/lz_encoder.c +++ b/Build/source/extra/xz/src/liblzma/lz/lz_encoder.c @@ -341,7 +341,7 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // Deallocate the old hash array if it exists and has different size // than what is needed now. - if (mf->hash != NULL && old_count != new_count) { + if (old_count != new_count) { lzma_free(mf->hash, allocator); mf->hash = NULL; } @@ -423,7 +423,7 @@ lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, && lz_options->preset_dict_size > 0) { // If the preset dictionary is bigger than the actual // dictionary, use only the tail. - mf->write_pos = MIN(lz_options->preset_dict_size, mf->size); + mf->write_pos = my_min(lz_options->preset_dict_size, mf->size); memcpy(mf->buffer, lz_options->preset_dict + lz_options->preset_dict_size - mf->write_pos, mf->write_pos); @@ -444,6 +444,8 @@ lzma_lz_encoder_memusage(const lzma_lz_options *lz_options) lzma_mf mf = { .buffer = NULL, .hash = NULL, + .hash_size_sum = 0, + .sons_count = 0, }; // Setup the size information into mf. @@ -519,6 +521,8 @@ lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, next->coder->mf.buffer = NULL; next->coder->mf.hash = NULL; + next->coder->mf.hash_size_sum = 0; + next->coder->mf.sons_count = 0; next->coder->next = LZMA_NEXT_CODER_INIT; } diff --git a/Build/source/extra/xz/src/liblzma/lz/lz_encoder.h b/Build/source/extra/xz/src/liblzma/lz/lz_encoder.h index f6352a47227..741c4532280 100644 --- a/Build/source/extra/xz/src/liblzma/lz/lz_encoder.h +++ b/Build/source/extra/xz/src/liblzma/lz/lz_encoder.h @@ -281,7 +281,7 @@ mf_read(lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size, size_t *left) { const size_t out_avail = out_size - *out_pos; - const size_t copy_size = MIN(out_avail, *left); + const size_t copy_size = my_min(out_avail, *left); assert(mf->read_ahead == 0); assert(mf->read_pos >= *left); diff --git a/Build/source/extra/xz/src/liblzma/lz/lz_encoder_mf.c b/Build/source/extra/xz/src/liblzma/lz/lz_encoder_mf.c index b31b08578d4..f82a1c1d295 100644 --- a/Build/source/extra/xz/src/liblzma/lz/lz_encoder_mf.c +++ b/Build/source/extra/xz/src/liblzma/lz/lz_encoder_mf.c @@ -481,7 +481,7 @@ bt_find_func( << 1); const uint8_t *const pb = cur - delta; - uint32_t len = MIN(len0, len1); + uint32_t len = my_min(len0, len1); if (pb[len] == cur[len]) { while (++len != len_limit) @@ -546,7 +546,7 @@ bt_skip_func( + (delta > cyclic_pos ? cyclic_size : 0)) << 1); const uint8_t *pb = cur - delta; - uint32_t len = MIN(len0, len1); + uint32_t len = my_min(len0, len1); if (pb[len] == cur[len]) { while (++len != len_limit) |