diff options
-rw-r--r-- | xdelta3/testing/regtest.cc | 2 | ||||
-rw-r--r-- | xdelta3/xdelta3-decode.h | 4 | ||||
-rw-r--r-- | xdelta3/xdelta3-djw.h | 6 | ||||
-rw-r--r-- | xdelta3/xdelta3-main.h | 16 | ||||
-rw-r--r-- | xdelta3/xdelta3-merge.h | 2 | ||||
-rw-r--r-- | xdelta3/xdelta3-test.h | 12 | ||||
-rw-r--r-- | xdelta3/xdelta3.c | 36 | ||||
-rw-r--r-- | xdelta3/xdelta3.h | 12 |
8 files changed, 41 insertions, 49 deletions
diff --git a/xdelta3/testing/regtest.cc b/xdelta3/testing/regtest.cc index 84ee100..69f8f80 100644 --- a/xdelta3/testing/regtest.cc +++ b/xdelta3/testing/regtest.cc | |||
@@ -1222,7 +1222,7 @@ void UnitTest() { | |||
1222 | // These are Xdelta tests. | 1222 | // These are Xdelta tests. |
1223 | template <class T> | 1223 | template <class T> |
1224 | void MainTest() { | 1224 | void MainTest() { |
1225 | XPR(NT "Blocksize %"Q"u windowsize %"Q"u\n", | 1225 | XPR(NT "Blocksize %"Q"u windowsize %zu\n", |
1226 | T::BLOCK_SIZE, T::WINDOW_SIZE); | 1226 | T::BLOCK_SIZE, T::WINDOW_SIZE); |
1227 | Regtest<T> regtest; | 1227 | Regtest<T> regtest; |
1228 | TEST(TestEmptyInMemory); | 1228 | TEST(TestEmptyInMemory); |
diff --git a/xdelta3/xdelta3-decode.h b/xdelta3/xdelta3-decode.h index b0051aa..008993d 100644 --- a/xdelta3/xdelta3-decode.h +++ b/xdelta3/xdelta3-decode.h | |||
@@ -156,7 +156,7 @@ xd3_decode_section (xd3_stream *stream, | |||
156 | usize_t sect_need = section->size - section->pos; | 156 | usize_t sect_need = section->size - section->pos; |
157 | 157 | ||
158 | /* Allocate and copy */ | 158 | /* Allocate and copy */ |
159 | sect_take = min (sect_need, stream->avail_in); | 159 | sect_take = xd3_min (sect_need, stream->avail_in); |
160 | 160 | ||
161 | if (section->pos == 0) | 161 | if (section->pos == 0) |
162 | { | 162 | { |
@@ -582,7 +582,7 @@ xd3_decode_sections (xd3_stream *stream) | |||
582 | more = (need - stream->dec_winbytes); | 582 | more = (need - stream->dec_winbytes); |
583 | 583 | ||
584 | /* How much to consume. */ | 584 | /* How much to consume. */ |
585 | take = min (more, stream->avail_in); | 585 | take = xd3_min (more, stream->avail_in); |
586 | 586 | ||
587 | /* See if the input is completely available, to avoid copy. */ | 587 | /* See if the input is completely available, to avoid copy. */ |
588 | copy = (take != more); | 588 | copy = (take != more); |
diff --git a/xdelta3/xdelta3-djw.h b/xdelta3/xdelta3-djw.h index 422e06a..080de59 100644 --- a/xdelta3/xdelta3-djw.h +++ b/xdelta3/xdelta3-djw.h | |||
@@ -456,7 +456,7 @@ djw_build_prefix (const djw_weight *freq, uint8_t *clen, usize_t asize, usize_t | |||
456 | djw_heapen *h2 = heap_extract (heap, ents, --heap_last); | 456 | djw_heapen *h2 = heap_extract (heap, ents, --heap_last); |
457 | 457 | ||
458 | ents[ents_size].freq = h1->freq + h2->freq; | 458 | ents[ents_size].freq = h1->freq + h2->freq; |
459 | ents[ents_size].depth = 1 + max (h1->depth, h2->depth); | 459 | ents[ents_size].depth = 1 + xd3_max (h1->depth, h2->depth); |
460 | ents[ents_size].parent = 0; | 460 | ents[ents_size].parent = 0; |
461 | 461 | ||
462 | h1->parent = h2->parent = ents_size; | 462 | h1->parent = h2->parent = ents_size; |
@@ -525,7 +525,7 @@ djw_build_codes (usize_t *codes, const uint8_t *clen, usize_t asize, usize_t abs | |||
525 | min_clen = clen[i]; | 525 | min_clen = clen[i]; |
526 | } | 526 | } |
527 | 527 | ||
528 | max_clen = max (max_clen, (usize_t) clen[i]); | 528 | max_clen = xd3_max (max_clen, (usize_t) clen[i]); |
529 | } | 529 | } |
530 | 530 | ||
531 | XD3_ASSERT (max_clen <= abs_max); | 531 | XD3_ASSERT (max_clen <= abs_max); |
@@ -1799,7 +1799,7 @@ xd3_decode_huff (xd3_stream *stream, | |||
1799 | XD3_ASSERT (output_end - output > 0); | 1799 | XD3_ASSERT (output_end - output > 0); |
1800 | 1800 | ||
1801 | /* Decode next sector. */ | 1801 | /* Decode next sector. */ |
1802 | n = min (sector_size, (usize_t) (output_end - output)); | 1802 | n = xd3_min (sector_size, (usize_t) (output_end - output)); |
1803 | 1803 | ||
1804 | do | 1804 | do |
1805 | { | 1805 | { |
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 018a697..0f51ff8 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -978,7 +978,7 @@ xd3_posix_io (int fd, uint8_t *buf, size_t size, | |||
978 | 978 | ||
979 | while (nproc < size) | 979 | while (nproc < size) |
980 | { | 980 | { |
981 | size_t tryread = min(size - nproc, 1U << 30); | 981 | size_t tryread = xd3_min(size - nproc, 1U << 30); |
982 | ssize_t result = (*func) (fd, buf + nproc, tryread); | 982 | ssize_t result = (*func) (fd, buf + nproc, tryread); |
983 | 983 | ||
984 | if (result < 0) | 984 | if (result < 0) |
@@ -1930,7 +1930,7 @@ main_merge_output (xd3_stream *stream, main_file *ofile) | |||
1930 | inst_pos < stream->whole_target.instlen) | 1930 | inst_pos < stream->whole_target.instlen) |
1931 | { | 1931 | { |
1932 | xd3_winst *inst = &stream->whole_target.inst[inst_pos]; | 1932 | xd3_winst *inst = &stream->whole_target.inst[inst_pos]; |
1933 | usize_t take = min(inst->size, window_size - window_pos); | 1933 | usize_t take = xd3_min(inst->size, window_size - window_pos); |
1934 | xoff_t addr; | 1934 | xoff_t addr; |
1935 | 1935 | ||
1936 | switch (inst->type) | 1936 | switch (inst->type) |
@@ -1953,8 +1953,8 @@ main_merge_output (xd3_stream *stream, main_file *ofile) | |||
1953 | if (inst->mode != 0) | 1953 | if (inst->mode != 0) |
1954 | { | 1954 | { |
1955 | if (window_srcset) { | 1955 | if (window_srcset) { |
1956 | window_srcmin = min(window_srcmin, inst->addr); | 1956 | window_srcmin = xd3_min (window_srcmin, inst->addr); |
1957 | window_srcmax = max(window_srcmax, inst->addr + take); | 1957 | window_srcmax = xd3_max (window_srcmax, inst->addr + take); |
1958 | } else { | 1958 | } else { |
1959 | window_srcset = 1; | 1959 | window_srcset = 1; |
1960 | window_srcmin = inst->addr; | 1960 | window_srcmin = inst->addr; |
@@ -2414,7 +2414,7 @@ main_secondary_decompress_check (main_file *file, | |||
2414 | { | 2414 | { |
2415 | int ret; | 2415 | int ret; |
2416 | usize_t i; | 2416 | usize_t i; |
2417 | usize_t try_read = min (input_size, XD3_ALLOCSIZE); | 2417 | usize_t try_read = xd3_min (input_size, XD3_ALLOCSIZE); |
2418 | size_t check_nread = 0; | 2418 | size_t check_nread = 0; |
2419 | uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */ | 2419 | uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */ |
2420 | const main_extcomp *decompressor = NULL; | 2420 | const main_extcomp *decompressor = NULL; |
@@ -2939,10 +2939,10 @@ main_get_winsize (main_file *ifile) { | |||
2939 | 2939 | ||
2940 | if (main_file_stat (ifile, &file_size) == 0) | 2940 | if (main_file_stat (ifile, &file_size) == 0) |
2941 | { | 2941 | { |
2942 | size = (usize_t) min(file_size, (xoff_t) size); | 2942 | size = (usize_t) xd3_min (file_size, (xoff_t) size); |
2943 | } | 2943 | } |
2944 | 2944 | ||
2945 | size = max(size, XD3_ALLOCSIZE); | 2945 | size = xd3_max (size, XD3_ALLOCSIZE); |
2946 | 2946 | ||
2947 | if (option_verbose > 1) | 2947 | if (option_verbose > 1) |
2948 | { | 2948 | { |
@@ -3173,7 +3173,7 @@ main_input (xd3_cmd cmd, | |||
3173 | 3173 | ||
3174 | input_remain = XOFF_T_MAX - input_offset; | 3174 | input_remain = XOFF_T_MAX - input_offset; |
3175 | 3175 | ||
3176 | try_read = (usize_t) min ((xoff_t) config.winsize, input_remain); | 3176 | try_read = (usize_t) xd3_min ((xoff_t) config.winsize, input_remain); |
3177 | 3177 | ||
3178 | if ((ret = main_read_primary_input (ifile, main_bdata, | 3178 | if ((ret = main_read_primary_input (ifile, main_bdata, |
3179 | try_read, & nread))) | 3179 | try_read, & nread))) |
diff --git a/xdelta3/xdelta3-merge.h b/xdelta3/xdelta3-merge.h index e65978d..72bc892 100644 --- a/xdelta3/xdelta3-merge.h +++ b/xdelta3/xdelta3-merge.h | |||
@@ -446,7 +446,7 @@ xd3_merge_source_copy (xd3_stream *stream, | |||
446 | XD3_ASSERT (sinst->size > sinst_offset); | 446 | XD3_ASSERT (sinst->size > sinst_offset); |
447 | 447 | ||
448 | sinst_left = sinst->size - sinst_offset; | 448 | sinst_left = sinst->size - sinst_offset; |
449 | this_take = min (iinst.size, sinst_left); | 449 | this_take = xd3_min (iinst.size, sinst_left); |
450 | 450 | ||
451 | XD3_ASSERT (this_take > 0); | 451 | XD3_ASSERT (this_take > 0); |
452 | 452 | ||
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index 948a1d6..659bd31 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h | |||
@@ -109,7 +109,7 @@ mt_exp_rand (uint32_t mean, uint32_t max_value) | |||
109 | (double)UINT32_MAX)); | 109 | (double)UINT32_MAX)); |
110 | uint32_t x = (uint32_t) (mean_d * erand + 0.5); | 110 | uint32_t x = (uint32_t) (mean_d * erand + 0.5); |
111 | 111 | ||
112 | return min (x, max_value); | 112 | return xd3_min (x, max_value); |
113 | } | 113 | } |
114 | 114 | ||
115 | #if SHELL_TESTS | 115 | #if SHELL_TESTS |
@@ -300,7 +300,7 @@ test_make_inputs (xd3_stream *stream, xoff_t *ss_out, xoff_t *ts_out) | |||
300 | double add_prob = (left == 0) ? 0 : (add_left / (double) left); | 300 | double add_prob = (left == 0) ? 0 : (add_left / (double) left); |
301 | int do_copy; | 301 | int do_copy; |
302 | 302 | ||
303 | next = min (left, next); | 303 | next = xd3_min (left, next); |
304 | do_copy = (next > add_left || | 304 | do_copy = (next > add_left || |
305 | (mt_random (&static_mtrand) / \ | 305 | (mt_random (&static_mtrand) / \ |
306 | (double)USIZE_T_MAX) >= add_prob); | 306 | (double)USIZE_T_MAX) >= add_prob); |
@@ -735,10 +735,10 @@ test_address_cache (xd3_stream *stream, int unused) | |||
735 | p = (mt_random (&static_mtrand) / (double)USIZE_T_MAX); | 735 | p = (mt_random (&static_mtrand) / (double)USIZE_T_MAX); |
736 | prev_i = mt_random (&static_mtrand) % offset; | 736 | prev_i = mt_random (&static_mtrand) % offset; |
737 | nearby = (mt_random (&static_mtrand) % 256) % offset; | 737 | nearby = (mt_random (&static_mtrand) % 256) % offset; |
738 | nearby = max (1U, nearby); | 738 | nearby = xd3_max (1U, nearby); |
739 | 739 | ||
740 | if (p < 0.1) { addr = addrs[offset-nearby]; } | 740 | if (p < 0.1) { addr = addrs[offset-nearby]; } |
741 | else if (p < 0.4) { addr = min (addrs[prev_i] + nearby, offset-1); } | 741 | else if (p < 0.4) { addr = xd3_min (addrs[prev_i] + nearby, offset-1); } |
742 | else { addr = prev_i; } | 742 | else { addr = prev_i; } |
743 | 743 | ||
744 | if ((ret = xd3_encode_address (stream, addr, offset, & modes[offset]))) { return ret; } | 744 | if ((ret = xd3_encode_address (stream, addr, offset, & modes[offset]))) { return ret; } |
@@ -884,7 +884,7 @@ test_decompress_text (xd3_stream *stream, uint8_t *enc, usize_t enc_size, usize_ | |||
884 | 884 | ||
885 | input: | 885 | input: |
886 | /* Test decoding test_desize input bytes at a time */ | 886 | /* Test decoding test_desize input bytes at a time */ |
887 | take = min (enc_size - pos, test_desize); | 887 | take = xd3_min (enc_size - pos, test_desize); |
888 | CHECK(take > 0); | 888 | CHECK(take > 0); |
889 | 889 | ||
890 | xd3_avail_input (stream, enc + pos, take); | 890 | xd3_avail_input (stream, enc + pos, take); |
@@ -1440,7 +1440,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups) | |||
1440 | * decoding. Really looking for faults here. */ | 1440 | * decoding. Really looking for faults here. */ |
1441 | { | 1441 | { |
1442 | int i; | 1442 | int i; |
1443 | int bytes = min (compress_size, 10U); | 1443 | int bytes = xd3_min (compress_size, 10U); |
1444 | for (i = 0; i < bytes * 8; i += 1) | 1444 | for (i = 0; i < bytes * 8; i += 1) |
1445 | { | 1445 | { |
1446 | dec_input[i/8] ^= 1 << (i%8); | 1446 | dec_input[i/8] ^= 1 << (i%8); |
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 8513aac..3dcf80c 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -1265,7 +1265,7 @@ xd3_decode_bytes (xd3_stream *stream, uint8_t *buf, usize_t *pos, usize_t size) | |||
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | want = size - *pos; | 1267 | want = size - *pos; |
1268 | take = min (want, stream->avail_in); | 1268 | take = xd3_min (want, stream->avail_in); |
1269 | 1269 | ||
1270 | memcpy (buf + *pos, stream->next_in, (size_t) take); | 1270 | memcpy (buf + *pos, stream->next_in, (size_t) take); |
1271 | 1271 | ||
@@ -1325,7 +1325,7 @@ xd3_emit_bytes (xd3_stream *stream, | |||
1325 | output = (*outputp) = aoutput; | 1325 | output = (*outputp) = aoutput; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | take = min (output->avail - output->next, size); | 1328 | take = xd3_min (output->avail - output->next, size); |
1329 | 1329 | ||
1330 | memcpy (output->base + output->next, base, (size_t) take); | 1330 | memcpy (output->base + output->next, base, (size_t) take); |
1331 | 1331 | ||
@@ -2237,7 +2237,7 @@ xd3_set_source (xd3_stream *stream, | |||
2237 | src->max_winsize = xd3_xoff_roundup(src->max_winsize); | 2237 | src->max_winsize = xd3_xoff_roundup(src->max_winsize); |
2238 | IF_DEBUG1 (DP(RINT "raising src_maxsize to %u\n", src->blksize)); | 2238 | IF_DEBUG1 (DP(RINT "raising src_maxsize to %u\n", src->blksize)); |
2239 | } | 2239 | } |
2240 | src->max_winsize = max(src->max_winsize, XD3_ALLOCSIZE); | 2240 | src->max_winsize = xd3_max (src->max_winsize, XD3_ALLOCSIZE); |
2241 | 2241 | ||
2242 | return 0; | 2242 | return 0; |
2243 | } | 2243 | } |
@@ -2683,7 +2683,7 @@ xd3_iopt_flush_instructions (xd3_stream *stream, int force) | |||
2683 | /* Try to balance the length of both instructions, but avoid | 2683 | /* Try to balance the length of both instructions, but avoid |
2684 | * making both longer than MAX_MATCH_SPLIT . */ | 2684 | * making both longer than MAX_MATCH_SPLIT . */ |
2685 | average = gap / 2; | 2685 | average = gap / 2; |
2686 | newsize = min (MAX_MATCH_SPLIT, gap - average); | 2686 | newsize = xd3_min (MAX_MATCH_SPLIT, gap - average); |
2687 | 2687 | ||
2688 | /* Should be possible to simplify this code. */ | 2688 | /* Should be possible to simplify this code. */ |
2689 | if (newsize > r1->size) | 2689 | if (newsize > r1->size) |
@@ -3160,7 +3160,7 @@ xd3_encode_buffer_leftover (xd3_stream *stream) | |||
3160 | 3160 | ||
3161 | /* Copy into the buffer. */ | 3161 | /* Copy into the buffer. */ |
3162 | room = stream->winsize - stream->buf_avail; | 3162 | room = stream->winsize - stream->buf_avail; |
3163 | take = min (room, stream->avail_in); | 3163 | take = xd3_min (room, stream->avail_in); |
3164 | 3164 | ||
3165 | memcpy (stream->buf_in + stream->buf_avail, stream->next_in, take); | 3165 | memcpy (stream->buf_in + stream->buf_avail, stream->next_in, take); |
3166 | 3166 | ||
@@ -3239,7 +3239,7 @@ xd3_encode_init (xd3_stream *stream, int full_init) | |||
3239 | 3239 | ||
3240 | if (small_comp) | 3240 | if (small_comp) |
3241 | { | 3241 | { |
3242 | /* TODO: This is under devel: used to have min(sprevsz) here, which sort | 3242 | /* TODO: This is under devel: used to have min (sprevsz) here, which sort |
3243 | * of makes sense, but observed fast performance w/ larger tables, which | 3243 | * of makes sense, but observed fast performance w/ larger tables, which |
3244 | * also sort of makes sense. @@@ */ | 3244 | * also sort of makes sense. @@@ */ |
3245 | usize_t hash_values = stream->winsize; | 3245 | usize_t hash_values = stream->winsize; |
@@ -3580,7 +3580,7 @@ xd3_process_stream (int is_encode, | |||
3580 | usize_t output_size_max) | 3580 | usize_t output_size_max) |
3581 | { | 3581 | { |
3582 | usize_t ipos = 0; | 3582 | usize_t ipos = 0; |
3583 | usize_t n = min(stream->winsize, input_size); | 3583 | usize_t n = xd3_min (stream->winsize, input_size); |
3584 | 3584 | ||
3585 | (*output_size) = 0; | 3585 | (*output_size) = 0; |
3586 | 3586 | ||
@@ -3596,7 +3596,7 @@ xd3_process_stream (int is_encode, | |||
3596 | { | 3596 | { |
3597 | case XD3_OUTPUT: { /* memcpy below */ break; } | 3597 | case XD3_OUTPUT: { /* memcpy below */ break; } |
3598 | case XD3_INPUT: { | 3598 | case XD3_INPUT: { |
3599 | n = min(stream->winsize, input_size - ipos); | 3599 | n = xd3_min(stream->winsize, input_size - ipos); |
3600 | if (n == 0) | 3600 | if (n == 0) |
3601 | { | 3601 | { |
3602 | goto done; | 3602 | goto done; |
@@ -3672,7 +3672,7 @@ xd3_process_memory (int is_encode, | |||
3672 | 3672 | ||
3673 | if (is_encode) | 3673 | if (is_encode) |
3674 | { | 3674 | { |
3675 | config.winsize = min(input_size, (usize_t) XD3_DEFAULT_WINSIZE); | 3675 | config.winsize = xd3_min(input_size, (usize_t) XD3_DEFAULT_WINSIZE); |
3676 | config.sprevsz = xd3_pow2_roundup (config.winsize); | 3676 | config.sprevsz = xd3_pow2_roundup (config.winsize); |
3677 | } | 3677 | } |
3678 | 3678 | ||
@@ -3927,8 +3927,8 @@ xd3_srcwin_setup (xd3_stream *stream) | |||
3927 | * issued, but we have to decide the source window base and length | 3927 | * issued, but we have to decide the source window base and length |
3928 | * now. */ | 3928 | * now. */ |
3929 | src->srcbase = stream->match_minaddr; | 3929 | src->srcbase = stream->match_minaddr; |
3930 | src->srclen = max ((usize_t) length, | 3930 | src->srclen = xd3_max ((usize_t) length, |
3931 | stream->avail_in + (stream->avail_in >> 2)); | 3931 | stream->avail_in + (stream->avail_in >> 2)); |
3932 | 3932 | ||
3933 | if (src->eof_known) | 3933 | if (src->eof_known) |
3934 | { | 3934 | { |
@@ -3936,7 +3936,7 @@ xd3_srcwin_setup (xd3_stream *stream) | |||
3936 | * code that expects to pass a single block w/ getblk == NULL | 3936 | * code that expects to pass a single block w/ getblk == NULL |
3937 | * will not function, as the code will return GETSRCBLK asking | 3937 | * will not function, as the code will return GETSRCBLK asking |
3938 | * for the second block. */ | 3938 | * for the second block. */ |
3939 | src->srclen = min (src->srclen, xd3_source_eof(src) - src->srcbase); | 3939 | src->srclen = xd3_min (src->srclen, xd3_source_eof(src) - src->srcbase); |
3940 | } | 3940 | } |
3941 | 3941 | ||
3942 | IF_DEBUG1 (DP(RINT "[srcwin_setup_constrained] base %llu len %llu\n", | 3942 | IF_DEBUG1 (DP(RINT "[srcwin_setup_constrained] base %llu len %llu\n", |
@@ -4200,7 +4200,7 @@ xd3_source_extend_match (xd3_stream *stream) | |||
4200 | return ret; | 4200 | return ret; |
4201 | } | 4201 | } |
4202 | 4202 | ||
4203 | tryrem = min (tryoff, stream->match_maxback - stream->match_back); | 4203 | tryrem = xd3_min (tryoff, stream->match_maxback - stream->match_back); |
4204 | 4204 | ||
4205 | IF_DEBUG2(DP(RINT "[maxback] maxback %u trysrc %"Q"u/%u tgt %u tryrem %u\n", | 4205 | IF_DEBUG2(DP(RINT "[maxback] maxback %u trysrc %"Q"u/%u tgt %u tryrem %u\n", |
4206 | stream->match_maxback, tryblk, tryoff, streamoff, tryrem)); | 4206 | stream->match_maxback, tryblk, tryoff, streamoff, tryrem)); |
@@ -4245,7 +4245,7 @@ xd3_source_extend_match (xd3_stream *stream) | |||
4245 | return ret; | 4245 | return ret; |
4246 | } | 4246 | } |
4247 | 4247 | ||
4248 | tryrem = min(stream->match_maxfwd - stream->match_fwd, | 4248 | tryrem = xd3_min(stream->match_maxfwd - stream->match_fwd, |
4249 | src->onblk - tryoff); | 4249 | src->onblk - tryoff); |
4250 | 4250 | ||
4251 | if (tryrem == 0) | 4251 | if (tryrem == 0) |
@@ -4587,7 +4587,7 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point) | |||
4587 | 4587 | ||
4588 | /* Begin by advancing at twice the input rate, up to half the | 4588 | /* Begin by advancing at twice the input rate, up to half the |
4589 | * maximum window size. */ | 4589 | * maximum window size. */ |
4590 | logical_input_cksum_pos = min((stream->total_in + stream->input_position) * 2, | 4590 | logical_input_cksum_pos = xd3_min((stream->total_in + stream->input_position) * 2, |
4591 | (stream->total_in + stream->input_position) + | 4591 | (stream->total_in + stream->input_position) + |
4592 | (stream->src->max_winsize / 2)); | 4592 | (stream->src->max_winsize / 2)); |
4593 | 4593 | ||
@@ -4812,9 +4812,9 @@ XD3_TEMPLATE(xd3_string_match_) (xd3_stream *stream) | |||
4812 | * of length 8 at the next position. */ | 4812 | * of length 8 at the next position. */ |
4813 | if (xd3_iopt_last_matched (stream) > stream->input_position) | 4813 | if (xd3_iopt_last_matched (stream) > stream->input_position) |
4814 | { | 4814 | { |
4815 | stream->min_match = max(MIN_MATCH, | 4815 | stream->min_match = xd3_max (MIN_MATCH, |
4816 | 1 + xd3_iopt_last_matched(stream) - | 4816 | 1 + xd3_iopt_last_matched(stream) - |
4817 | stream->input_position); | 4817 | stream->input_position); |
4818 | } | 4818 | } |
4819 | else | 4819 | else |
4820 | { | 4820 | { |
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h index 69204c5..f72cdc9 100644 --- a/xdelta3/xdelta3.h +++ b/xdelta3/xdelta3.h | |||
@@ -157,11 +157,7 @@ typedef uint64_t xoff_t; | |||
157 | #define SIZEOF_XOFF_T 8 | 157 | #define SIZEOF_XOFF_T 8 |
158 | #define SIZEOF_USIZE_T 4 | 158 | #define SIZEOF_USIZE_T 4 |
159 | #ifndef WIN32 | 159 | #ifndef WIN32 |
160 | #if SIZEOF_SIZE_T == 8 | ||
161 | #define Q "z" | ||
162 | #else | ||
163 | #define Q "ll" | 160 | #define Q "ll" |
164 | #endif | ||
165 | #else | 161 | #else |
166 | #define Q "I64" | 162 | #define Q "I64" |
167 | #endif | 163 | #endif |
@@ -309,12 +305,8 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream, | |||
309 | #define XD3_ASSERT(x) (void)0 | 305 | #define XD3_ASSERT(x) (void)0 |
310 | #endif /* XD3_DEBUG */ | 306 | #endif /* XD3_DEBUG */ |
311 | 307 | ||
312 | #ifndef max | 308 | #define xd3_max(x,y) ((x) < (y) ? (y) : (x)) |
313 | #define max(x,y) ((x) < (y) ? (y) : (x)) | 309 | #define xd3_min(x,y) ((x) < (y) ? (x) : (y)) |
314 | #endif | ||
315 | #ifndef min | ||
316 | #define min(x,y) ((x) < (y) ? (x) : (y)) | ||
317 | #endif | ||
318 | 310 | ||
319 | /**************************************************************** | 311 | /**************************************************************** |
320 | PUBLIC ENUMS | 312 | PUBLIC ENUMS |