diff options
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r-- | xdelta3/xdelta3.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 2d6f926..319d8c1 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -533,7 +533,7 @@ static int xd3_srcwin_move_point (xd3_stream *stream, | |||
533 | static int xd3_emit_run (xd3_stream *stream, usize_t pos, | 533 | static int xd3_emit_run (xd3_stream *stream, usize_t pos, |
534 | usize_t size, uint8_t *run_c); | 534 | usize_t size, uint8_t *run_c); |
535 | static usize_t xd3_checksum_hash (const xd3_hash_cfg *cfg, | 535 | static usize_t xd3_checksum_hash (const xd3_hash_cfg *cfg, |
536 | const usize_t cksum); | 536 | const usize_t cksum); |
537 | static xoff_t xd3_source_cksum_offset(xd3_stream *stream, usize_t low); | 537 | static xoff_t xd3_source_cksum_offset(xd3_stream *stream, usize_t low); |
538 | static void xd3_scksum_insert (xd3_stream *stream, | 538 | static void xd3_scksum_insert (xd3_stream *stream, |
539 | usize_t inx, | 539 | usize_t inx, |
@@ -999,7 +999,7 @@ static void | |||
999 | xd3_build_code_table (const xd3_code_table_desc *desc, xd3_dinst *tbl) | 999 | xd3_build_code_table (const xd3_code_table_desc *desc, xd3_dinst *tbl) |
1000 | { | 1000 | { |
1001 | usize_t size1, size2, mode; | 1001 | usize_t size1, size2, mode; |
1002 | usize_t cpy_modes = 2 + desc->near_modes + desc->same_modes; | 1002 | usize_t cpy_modes = 2U + desc->near_modes + desc->same_modes; |
1003 | xd3_dinst *d = tbl; | 1003 | xd3_dinst *d = tbl; |
1004 | 1004 | ||
1005 | (d++)->type1 = XD3_RUN; | 1005 | (d++)->type1 = XD3_RUN; |
@@ -1015,7 +1015,8 @@ xd3_build_code_table (const xd3_code_table_desc *desc, xd3_dinst *tbl) | |||
1015 | { | 1015 | { |
1016 | (d++)->type1 = XD3_CPY + mode; | 1016 | (d++)->type1 = XD3_CPY + mode; |
1017 | 1017 | ||
1018 | for (size1 = MIN_MATCH; size1 < MIN_MATCH + desc->cpy_sizes; size1 += 1, d += 1) | 1018 | for (size1 = MIN_MATCH; size1 < MIN_MATCH + desc->cpy_sizes; |
1019 | size1 += 1, d += 1) | ||
1019 | { | 1020 | { |
1020 | d->type1 = XD3_CPY + mode; | 1021 | d->type1 = XD3_CPY + mode; |
1021 | d->size1 = size1; | 1022 | d->size1 = size1; |
@@ -1593,17 +1594,16 @@ xd3_round_blksize (usize_t sz, usize_t blksz) | |||
1593 | #define A32_DO8(buf,i) A32_DO4(buf,i); A32_DO4(buf,i+4); | 1594 | #define A32_DO8(buf,i) A32_DO4(buf,i); A32_DO4(buf,i+4); |
1594 | #define A32_DO16(buf) A32_DO8(buf,0); A32_DO8(buf,8); | 1595 | #define A32_DO16(buf) A32_DO8(buf,0); A32_DO8(buf,8); |
1595 | 1596 | ||
1596 | static unsigned long adler32 (unsigned long adler, const uint8_t *buf, | 1597 | static uint32_t adler32 (uint32_t adler, const uint8_t *buf, size_t len) |
1597 | usize_t len) | ||
1598 | { | 1598 | { |
1599 | unsigned long s1 = adler & 0xffff; | 1599 | uint32_t s1 = adler & 0xffff; |
1600 | unsigned long s2 = (adler >> 16) & 0xffff; | 1600 | uint32_t s2 = (adler >> 16) & 0xffff; |
1601 | int k; | 1601 | int k; |
1602 | 1602 | ||
1603 | while (len > 0) | 1603 | while (len > 0) |
1604 | { | 1604 | { |
1605 | k = (len < A32_NMAX) ? len : A32_NMAX; | 1605 | k = (len < A32_NMAX) ? (int) len : A32_NMAX; |
1606 | len -= k; | 1606 | len -= (size_t) k; |
1607 | 1607 | ||
1608 | while (k >= 16) | 1608 | while (k >= 16) |
1609 | { | 1609 | { |
@@ -2669,7 +2669,7 @@ xd3_set_source (xd3_stream *stream, | |||
2669 | } | 2669 | } |
2670 | 2670 | ||
2671 | src->shiftby = shiftby; | 2671 | src->shiftby = shiftby; |
2672 | src->maskby = (1 << shiftby) - 1; | 2672 | src->maskby = (1U << shiftby) - 1; |
2673 | 2673 | ||
2674 | if (xd3_check_pow2 (src->max_winsize, NULL) != 0) | 2674 | if (xd3_check_pow2 (src->max_winsize, NULL) != 0) |
2675 | { | 2675 | { |
@@ -3697,7 +3697,7 @@ xd3_encode_init (xd3_stream *stream, int full_init) | |||
3697 | if (large_comp) | 3697 | if (large_comp) |
3698 | { | 3698 | { |
3699 | usize_t hash_values = (stream->src->max_winsize / | 3699 | usize_t hash_values = (stream->src->max_winsize / |
3700 | stream->smatcher.large_step); | 3700 | stream->smatcher.large_step); |
3701 | 3701 | ||
3702 | xd3_size_hashtable (stream, | 3702 | xd3_size_hashtable (stream, |
3703 | hash_values, | 3703 | hash_values, |
@@ -4565,7 +4565,8 @@ xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, int n) | |||
4565 | { | 4565 | { |
4566 | int i = 0; | 4566 | int i = 0; |
4567 | #if UNALIGNED_OK | 4567 | #if UNALIGNED_OK |
4568 | int nint = n / sizeof(int); | 4568 | const int isize = sizeof(int); |
4569 | int nint = n / isize; | ||
4569 | 4570 | ||
4570 | if (nint >> 3) | 4571 | if (nint >> 3) |
4571 | { | 4572 | { |
@@ -4584,7 +4585,7 @@ xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, int n) | |||
4584 | s1[i++] == s2[j++] && | 4585 | s1[i++] == s2[j++] && |
4585 | s1[i++] == s2[j++]) { } | 4586 | s1[i++] == s2[j++]) { } |
4586 | 4587 | ||
4587 | i = (i - 1) * sizeof(int); | 4588 | i = (i - 1) * isize; |
4588 | } | 4589 | } |
4589 | #endif | 4590 | #endif |
4590 | 4591 | ||
@@ -5094,9 +5095,9 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point) | |||
5094 | { | 5095 | { |
5095 | xoff_t blkno; | 5096 | xoff_t blkno; |
5096 | xoff_t blkbaseoffset; | 5097 | xoff_t blkbaseoffset; |
5097 | usize_t blkrem; | 5098 | xoff_t blkrem; |
5098 | size_t oldpos; /* Using ssize_t because of a */ | 5099 | ssize_t oldpos; /* Using ssize_t because of a */ |
5099 | size_t blkpos; /* do { blkpos-- } | 5100 | ssize_t blkpos; /* do { blkpos-- } |
5100 | while (blkpos >= oldpos); */ | 5101 | while (blkpos >= oldpos); */ |
5101 | int ret; | 5102 | int ret; |
5102 | xd3_blksize_div (stream->srcwin_cksum_pos, | 5103 | xd3_blksize_div (stream->srcwin_cksum_pos, |
@@ -5126,7 +5127,7 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point) | |||
5126 | 5127 | ||
5127 | blkpos = xd3_bytes_on_srcblk (stream->src, blkno); | 5128 | blkpos = xd3_bytes_on_srcblk (stream->src, blkno); |
5128 | 5129 | ||
5129 | if (blkpos < (size_t) stream->smatcher.large_look) | 5130 | if (blkpos < (ssize_t) stream->smatcher.large_look) |
5130 | { | 5131 | { |
5131 | stream->srcwin_cksum_pos = (blkno + 1) * stream->src->blksize; | 5132 | stream->srcwin_cksum_pos = (blkno + 1) * stream->src->blksize; |
5132 | IF_DEBUG1 (DP(RINT "[srcwin_move_point] continue (end-of-block)\n")); | 5133 | IF_DEBUG1 (DP(RINT "[srcwin_move_point] continue (end-of-block)\n")); |