diff options
Diffstat (limited to 'archival/libunarchive/decompress_unzip.c')
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 3a7334ce9..2401cf831 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -150,7 +150,7 @@ static void fill_bytebuffer(void) | |||
150 | /* Leave the first 4 bytes empty so we can always unwind the bitbuffer | 150 | /* Leave the first 4 bytes empty so we can always unwind the bitbuffer |
151 | * to the front of the bytebuffer, leave 4 bytes free at end of tail | 151 | * to the front of the bytebuffer, leave 4 bytes free at end of tail |
152 | * so we can easily top up buffer in check_trailer_gzip() */ | 152 | * so we can easily top up buffer in check_trailer_gzip() */ |
153 | bytebuffer_size = 4 + xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8); | 153 | bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8); |
154 | bytebuffer_offset = 4; | 154 | bytebuffer_offset = 4; |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -448,7 +448,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b | |||
448 | if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) | 448 | if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) |
449 | do { | 449 | do { |
450 | if (e == 99) { | 450 | if (e == 99) { |
451 | error_msg_and_die("inflate_codes error 1");; | 451 | bb_error_msg_and_die("inflate_codes error 1");; |
452 | } | 452 | } |
453 | b >>= t->b; | 453 | b >>= t->b; |
454 | k -= t->b; | 454 | k -= t->b; |
@@ -484,7 +484,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b | |||
484 | if ((e = (t = td + ((unsigned) b & md))->e) > 16) | 484 | if ((e = (t = td + ((unsigned) b & md))->e) > 16) |
485 | do { | 485 | do { |
486 | if (e == 99) | 486 | if (e == 99) |
487 | error_msg_and_die("inflate_codes error 2");; | 487 | bb_error_msg_and_die("inflate_codes error 2");; |
488 | b >>= t->b; | 488 | b >>= t->b; |
489 | k -= t->b; | 489 | k -= t->b; |
490 | e -= 16; | 490 | e -= 16; |
@@ -821,7 +821,7 @@ static int inflate_block(int *e) | |||
821 | 821 | ||
822 | if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) { | 822 | if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) { |
823 | if (i == 1) { | 823 | if (i == 1) { |
824 | error_msg_and_die("Incomplete literal tree"); | 824 | bb_error_msg_and_die("Incomplete literal tree"); |
825 | huft_free(tl); | 825 | huft_free(tl); |
826 | } | 826 | } |
827 | return i; /* incomplete code set */ | 827 | return i; /* incomplete code set */ |
@@ -830,7 +830,7 @@ static int inflate_block(int *e) | |||
830 | bd = dbits; | 830 | bd = dbits; |
831 | if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) { | 831 | if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) { |
832 | if (i == 1) { | 832 | if (i == 1) { |
833 | error_msg_and_die("incomplete distance tree"); | 833 | bb_error_msg_and_die("incomplete distance tree"); |
834 | huft_free(td); | 834 | huft_free(td); |
835 | } | 835 | } |
836 | huft_free(tl); | 836 | huft_free(tl); |
@@ -846,7 +846,7 @@ static int inflate_block(int *e) | |||
846 | } | 846 | } |
847 | default: | 847 | default: |
848 | /* bad block type */ | 848 | /* bad block type */ |
849 | error_msg_and_die("bad block type %d\n", t); | 849 | bb_error_msg_and_die("bad block type %d\n", t); |
850 | } | 850 | } |
851 | } | 851 | } |
852 | 852 | ||
@@ -884,7 +884,7 @@ static int inflate_get_next_window(void) | |||
884 | break; | 884 | break; |
885 | case -2: ret = inflate_codes(0,0,0,0,0); | 885 | case -2: ret = inflate_codes(0,0,0,0,0); |
886 | break; | 886 | break; |
887 | default: error_msg_and_die("inflate error %d", method); | 887 | default: bb_error_msg_and_die("inflate error %d", method); |
888 | } | 888 | } |
889 | 889 | ||
890 | if (ret == 1) { | 890 | if (ret == 1) { |
@@ -975,16 +975,16 @@ extern void GZ_gzReadClose(void) | |||
975 | ssize_t nread, nwrote; | 975 | ssize_t nread, nwrote; |
976 | 976 | ||
977 | GZ_gzReadOpen(in, 0, 0); | 977 | GZ_gzReadOpen(in, 0, 0); |
978 | while(1) { // Robbed from copyfd.c | 978 | while(1) { // Robbed from bb_copyfd.c |
979 | nread = read_gz(in, buf, sizeof(buf)); | 979 | nread = read_gz(in, buf, sizeof(buf)); |
980 | if (nread == 0) break; // no data to write | 980 | if (nread == 0) break; // no data to write |
981 | else if (nread == -1) { | 981 | else if (nread == -1) { |
982 | perror_msg("read"); | 982 | bb_perror_msg("read"); |
983 | return -1; | 983 | return -1; |
984 | } | 984 | } |
985 | nwrote = full_write(out, buf, nread); | 985 | nwrote = bb_full_write(out, buf, nread); |
986 | if (nwrote == -1) { | 986 | if (nwrote == -1) { |
987 | perror_msg("write"); | 987 | bb_perror_msg("write"); |
988 | return -1; | 988 | return -1; |
989 | } | 989 | } |
990 | } | 990 | } |
@@ -998,9 +998,9 @@ extern int inflate(int in, int out) | |||
998 | GZ_gzReadOpen(in, 0, 0); | 998 | GZ_gzReadOpen(in, 0, 0); |
999 | while(1) { | 999 | while(1) { |
1000 | int ret = inflate_get_next_window(); | 1000 | int ret = inflate_get_next_window(); |
1001 | nwrote = full_write(out, gunzip_window, gunzip_outbuf_count); | 1001 | nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count); |
1002 | if (nwrote == -1) { | 1002 | if (nwrote == -1) { |
1003 | perror_msg("write"); | 1003 | bb_perror_msg("write"); |
1004 | return -1; | 1004 | return -1; |
1005 | } | 1005 | } |
1006 | if (ret == 0) break; | 1006 | if (ret == 0) break; |
@@ -1017,7 +1017,7 @@ extern void check_trailer_gzip(int src_fd) | |||
1017 | /* top up the input buffer with the rest of the trailer */ | 1017 | /* top up the input buffer with the rest of the trailer */ |
1018 | count = bytebuffer_size - bytebuffer_offset; | 1018 | count = bytebuffer_size - bytebuffer_offset; |
1019 | if (count < 8) { | 1019 | if (count < 8) { |
1020 | xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count); | 1020 | bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count); |
1021 | bytebuffer_size += 8 - count; | 1021 | bytebuffer_size += 8 - count; |
1022 | } | 1022 | } |
1023 | for (count = 0; count != 4; count++) { | 1023 | for (count = 0; count != 4; count++) { |
@@ -1027,14 +1027,14 @@ extern void check_trailer_gzip(int src_fd) | |||
1027 | 1027 | ||
1028 | /* Validate decompression - crc */ | 1028 | /* Validate decompression - crc */ |
1029 | if (stored_crc != (gunzip_crc ^ 0xffffffffL)) { | 1029 | if (stored_crc != (gunzip_crc ^ 0xffffffffL)) { |
1030 | error_msg_and_die("crc error"); | 1030 | bb_error_msg_and_die("crc error"); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | /* Validate decompression - size */ | 1033 | /* Validate decompression - size */ |
1034 | if (gunzip_bytes_out != | 1034 | if (gunzip_bytes_out != |
1035 | (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) | | 1035 | (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) | |
1036 | (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { | 1036 | (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { |
1037 | error_msg_and_die("Incorrect length, but crc is correct"); | 1037 | bb_error_msg_and_die("Incorrect length, but crc is correct"); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | } | 1040 | } |