From 920a69a8d8e4203c5edddd829d932130eac188ea Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 26 May 2010 10:36:46 +0300 Subject: Rename MIN() and MAX() to my_min() and my_max(). This should avoid some minor portability issues. --- src/liblzma/lz/lz_decoder.c | 7 ++++--- src/liblzma/lz/lz_decoder.h | 2 +- src/liblzma/lz/lz_encoder.c | 2 +- src/liblzma/lz/lz_encoder.h | 2 +- src/liblzma/lz/lz_encoder_mf.c | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/liblzma/lz') diff --git a/src/liblzma/lz/lz_decoder.c b/src/liblzma/lz/lz_decoder.c index 350b1f89..2c573551 100644 --- a/src/liblzma/lz/lz_decoder.c +++ b/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/src/liblzma/lz/lz_decoder.h b/src/liblzma/lz/lz_decoder.h index bf1609db..7266e803 100644 --- a/src/liblzma/lz/lz_decoder.h +++ b/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/src/liblzma/lz/lz_encoder.c b/src/liblzma/lz/lz_encoder.c index 757e5374..691fe72d 100644 --- a/src/liblzma/lz/lz_encoder.c +++ b/src/liblzma/lz/lz_encoder.c @@ -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); diff --git a/src/liblzma/lz/lz_encoder.h b/src/liblzma/lz/lz_encoder.h index f6352a47..741c4532 100644 --- a/src/liblzma/lz/lz_encoder.h +++ b/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/src/liblzma/lz/lz_encoder_mf.c b/src/liblzma/lz/lz_encoder_mf.c index b31b0857..f82a1c1d 100644 --- a/src/liblzma/lz/lz_encoder_mf.c +++ b/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) -- cgit v1.2.3