diff options
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/xdelta3-blkcache.h | 1 | ||||
-rw-r--r-- | xdelta3/xdelta3-main.h | 6 | ||||
-rw-r--r-- | xdelta3/xdelta3-test.h | 4 | ||||
-rw-r--r-- | xdelta3/xdelta3.c | 21 |
4 files changed, 17 insertions, 15 deletions
diff --git a/xdelta3/xdelta3-blkcache.h b/xdelta3/xdelta3-blkcache.h index f9f3d8a..bc8e27f 100644 --- a/xdelta3/xdelta3-blkcache.h +++ b/xdelta3/xdelta3-blkcache.h | |||
@@ -159,6 +159,7 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd, | |||
159 | source->blksize = option_srcwinsz; | 159 | source->blksize = option_srcwinsz; |
160 | 160 | ||
161 | lru_size = 1; | 161 | lru_size = 1; |
162 | lru[0].blkno = 0; | ||
162 | 163 | ||
163 | if ((ret = main_getblk_func (stream, source, 0)) != 0) | 164 | if ((ret = main_getblk_func (stream, source, 0)) != 0) |
164 | { | 165 | { |
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 3ae24cd..b0bf370 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -2415,7 +2415,7 @@ main_secondary_decompress_check (main_file *file, | |||
2415 | { | 2415 | { |
2416 | int ret; | 2416 | int ret; |
2417 | usize_t i; | 2417 | usize_t i; |
2418 | usize_t try_read = min (input_size, XD3_ALLOCSIZE); | 2418 | size_t try_read = min (input_size, XD3_ALLOCSIZE); |
2419 | size_t check_nread = 0; | 2419 | size_t check_nread = 0; |
2420 | uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */ | 2420 | uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */ |
2421 | const main_extcomp *decompressor = NULL; | 2421 | const main_extcomp *decompressor = NULL; |
@@ -3227,8 +3227,8 @@ main_input (xd3_cmd cmd, | |||
3227 | main_get_appheader (& stream, ifile, ofile, sfile); | 3227 | main_get_appheader (& stream, ifile, ofile, sfile); |
3228 | 3228 | ||
3229 | /* Now open the source file. */ | 3229 | /* Now open the source file. */ |
3230 | if ((sfile->filename != NULL) && | 3230 | if ((sfile->filename != NULL) && |
3231 | (ret = main_set_source (& stream, cmd, sfile, & source))) | 3231 | (ret = main_set_source (& stream, cmd, sfile, & source))) |
3232 | { | 3232 | { |
3233 | return EXIT_FAILURE; | 3233 | return EXIT_FAILURE; |
3234 | } | 3234 | } |
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index fe62a4b..a602a41 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h | |||
@@ -669,13 +669,13 @@ test_forward_match (xd3_stream *stream, int unused) | |||
669 | 669 | ||
670 | for (i = 0; i < 256; i++) | 670 | for (i = 0; i < 256; i++) |
671 | { | 671 | { |
672 | CHECK(xd3_forward_match(buf1, buf2, i) == (int)i); | 672 | CHECK(xd3_forward_match(buf1, buf2, i) == i); |
673 | } | 673 | } |
674 | 674 | ||
675 | for (i = 0; i < 255; i++) | 675 | for (i = 0; i < 255; i++) |
676 | { | 676 | { |
677 | buf2[i] = 1; | 677 | buf2[i] = 1; |
678 | CHECK(xd3_forward_match(buf1, buf2, 256) == (int)i); | 678 | CHECK(xd3_forward_match(buf1, buf2, 256) == i); |
679 | buf2[i] = 0; | 679 | buf2[i] = 0; |
680 | } | 680 | } |
681 | 681 | ||
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 1703f94..f58dc99 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -4561,19 +4561,20 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
4561 | } | 4561 | } |
4562 | 4562 | ||
4563 | static inline xoff_t | 4563 | static inline xoff_t |
4564 | xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, xoff_t n) | 4564 | xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, size_t n) |
4565 | { | 4565 | { |
4566 | int i = 0; | 4566 | size_t i = 0; |
4567 | #if UNALIGNED_OK | 4567 | #if UNALIGNED_OK |
4568 | const int isize = sizeof(int); | 4568 | const size_t ssize = sizeof(size_t); |
4569 | int nint = (int) (n / isize); | 4569 | const size_t nint = n / ssize; |
4570 | 4570 | ||
4571 | /* If there are at least 8 elements */ | ||
4571 | if (nint >> 3) | 4572 | if (nint >> 3) |
4572 | { | 4573 | { |
4573 | int j = 0; | 4574 | usize_t j = 0; |
4574 | const int *s1 = (const int*)s1c; | 4575 | const size_t *s1 = (const size_t*)s1c; |
4575 | const int *s2 = (const int*)s2c; | 4576 | const size_t *s2 = (const size_t*)s2c; |
4576 | int nint_8 = nint - 8; | 4577 | const size_t nint_8 = nint - 8; |
4577 | 4578 | ||
4578 | while (i <= nint_8 && | 4579 | while (i <= nint_8 && |
4579 | s1[i++] == s2[j++] && | 4580 | s1[i++] == s2[j++] && |
@@ -4585,7 +4586,7 @@ xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, xoff_t n) | |||
4585 | s1[i++] == s2[j++] && | 4586 | s1[i++] == s2[j++] && |
4586 | s1[i++] == s2[j++]) { } | 4587 | s1[i++] == s2[j++]) { } |
4587 | 4588 | ||
4588 | i = (i - 1) * isize; | 4589 | i = (i - 1) * ssize; |
4589 | } | 4590 | } |
4590 | #endif | 4591 | #endif |
4591 | 4592 | ||