diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-12-07 00:42:49 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-12-07 00:42:49 +0100 |
commit | e7800f351ad9eca012fe27a1c9234692a04419e7 (patch) | |
tree | 4b40f6fb63492c8325bb7b58c5812f0258adbb7b | |
parent | 476654cdbeb2923fc5d2485701587b42579e1635 (diff) | |
download | busybox-w32-e7800f351ad9eca012fe27a1c9234692a04419e7.tar.gz busybox-w32-e7800f351ad9eca012fe27a1c9234692a04419e7.tar.bz2 busybox-w32-e7800f351ad9eca012fe27a1c9234692a04419e7.zip |
Rename transformer_aux_data_t -> transformer_state_t
No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/bbunzip.c | 34 | ||||
-rw-r--r-- | archival/bzip2.c | 2 | ||||
-rw-r--r-- | archival/gzip.c | 2 | ||||
-rw-r--r-- | archival/libarchive/decompress_bunzip2.c | 4 | ||||
-rw-r--r-- | archival/libarchive/decompress_gunzip.c | 26 | ||||
-rw-r--r-- | archival/libarchive/decompress_uncompress.c | 4 | ||||
-rw-r--r-- | archival/libarchive/decompress_unlzma.c | 2 | ||||
-rw-r--r-- | archival/libarchive/decompress_unxz.c | 4 | ||||
-rw-r--r-- | archival/libarchive/open_transformer.c | 22 | ||||
-rw-r--r-- | archival/lzop.c | 2 | ||||
-rw-r--r-- | archival/tar.c | 2 | ||||
-rw-r--r-- | archival/unzip.c | 12 | ||||
-rw-r--r-- | include/bb_archive.h | 24 |
13 files changed, 70 insertions, 70 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index fce5ab9e1..84f58f138 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -39,7 +39,7 @@ char* FAST_FUNC append_ext(char *filename, const char *expected_ext) | |||
39 | } | 39 | } |
40 | 40 | ||
41 | int FAST_FUNC bbunpack(char **argv, | 41 | int FAST_FUNC bbunpack(char **argv, |
42 | IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_aux_data_t *aux), | 42 | IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_state_t *xstate), |
43 | char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), | 43 | char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), |
44 | const char *expected_ext | 44 | const char *expected_ext |
45 | ) | 45 | ) |
@@ -48,7 +48,7 @@ int FAST_FUNC bbunpack(char **argv, | |||
48 | IF_DESKTOP(long long) int status = 0; | 48 | IF_DESKTOP(long long) int status = 0; |
49 | char *filename, *new_name; | 49 | char *filename, *new_name; |
50 | smallint exitcode = 0; | 50 | smallint exitcode = 0; |
51 | transformer_aux_data_t aux; | 51 | transformer_state_t xstate; |
52 | 52 | ||
53 | do { | 53 | do { |
54 | /* NB: new_name is *maybe* malloc'ed! */ | 54 | /* NB: new_name is *maybe* malloc'ed! */ |
@@ -120,9 +120,9 @@ int FAST_FUNC bbunpack(char **argv, | |||
120 | } | 120 | } |
121 | 121 | ||
122 | if (!(option_mask32 & SEAMLESS_MAGIC)) { | 122 | if (!(option_mask32 & SEAMLESS_MAGIC)) { |
123 | init_transformer_aux_data(&aux); | 123 | init_transformer_state(&xstate); |
124 | aux.check_signature = 1; | 124 | xstate.check_signature = 1; |
125 | status = unpacker(&aux); | 125 | status = unpacker(&xstate); |
126 | if (status < 0) | 126 | if (status < 0) |
127 | exitcode = 1; | 127 | exitcode = 1; |
128 | } else { | 128 | } else { |
@@ -141,10 +141,10 @@ int FAST_FUNC bbunpack(char **argv, | |||
141 | unsigned new_name_len; | 141 | unsigned new_name_len; |
142 | 142 | ||
143 | /* TODO: restore other things? */ | 143 | /* TODO: restore other things? */ |
144 | if (aux.mtime != 0) { | 144 | if (xstate.mtime != 0) { |
145 | struct timeval times[2]; | 145 | struct timeval times[2]; |
146 | 146 | ||
147 | times[1].tv_sec = times[0].tv_sec = aux.mtime; | 147 | times[1].tv_sec = times[0].tv_sec = xstate.mtime; |
148 | times[1].tv_usec = times[0].tv_usec = 0; | 148 | times[1].tv_usec = times[0].tv_usec = 0; |
149 | /* Note: we closed it first. | 149 | /* Note: we closed it first. |
150 | * On some systems calling utimes | 150 | * On some systems calling utimes |
@@ -227,9 +227,9 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) | |||
227 | //kbuild:lib-$(CONFIG_UNCOMPRESS) += bbunzip.o | 227 | //kbuild:lib-$(CONFIG_UNCOMPRESS) += bbunzip.o |
228 | #if ENABLE_UNCOMPRESS | 228 | #if ENABLE_UNCOMPRESS |
229 | static | 229 | static |
230 | IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(transformer_aux_data_t *aux) | 230 | IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(transformer_state_t *xstate) |
231 | { | 231 | { |
232 | return unpack_Z_stream(aux, STDIN_FILENO, STDOUT_FILENO); | 232 | return unpack_Z_stream(xstate, STDIN_FILENO, STDOUT_FILENO); |
233 | } | 233 | } |
234 | int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 234 | int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
235 | int uncompress_main(int argc UNUSED_PARAM, char **argv) | 235 | int uncompress_main(int argc UNUSED_PARAM, char **argv) |
@@ -325,9 +325,9 @@ char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UN | |||
325 | return filename; | 325 | return filename; |
326 | } | 326 | } |
327 | static | 327 | static |
328 | IF_DESKTOP(long long) int FAST_FUNC unpack_gunzip(transformer_aux_data_t *aux) | 328 | IF_DESKTOP(long long) int FAST_FUNC unpack_gunzip(transformer_state_t *xstate) |
329 | { | 329 | { |
330 | return unpack_gz_stream(aux, STDIN_FILENO, STDOUT_FILENO); | 330 | return unpack_gz_stream(xstate, STDIN_FILENO, STDOUT_FILENO); |
331 | } | 331 | } |
332 | /* | 332 | /* |
333 | * Linux kernel build uses gzip -d -n. We accept and ignore it. | 333 | * Linux kernel build uses gzip -d -n. We accept and ignore it. |
@@ -396,9 +396,9 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) | |||
396 | //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o | 396 | //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o |
397 | #if ENABLE_BUNZIP2 | 397 | #if ENABLE_BUNZIP2 |
398 | static | 398 | static |
399 | IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2(transformer_aux_data_t *aux) | 399 | IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2(transformer_state_t *xstate) |
400 | { | 400 | { |
401 | return unpack_bz2_stream(aux, STDIN_FILENO, STDOUT_FILENO); | 401 | return unpack_bz2_stream(xstate, STDIN_FILENO, STDOUT_FILENO); |
402 | } | 402 | } |
403 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 403 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
404 | int bunzip2_main(int argc UNUSED_PARAM, char **argv) | 404 | int bunzip2_main(int argc UNUSED_PARAM, char **argv) |
@@ -495,9 +495,9 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) | |||
495 | //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o | 495 | //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o |
496 | #if ENABLE_UNLZMA | 496 | #if ENABLE_UNLZMA |
497 | static | 497 | static |
498 | IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma(transformer_aux_data_t *aux) | 498 | IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma(transformer_state_t *xstate) |
499 | { | 499 | { |
500 | return unpack_lzma_stream(aux, STDIN_FILENO, STDOUT_FILENO); | 500 | return unpack_lzma_stream(xstate, STDIN_FILENO, STDOUT_FILENO); |
501 | } | 501 | } |
502 | int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 502 | int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
503 | int unlzma_main(int argc UNUSED_PARAM, char **argv) | 503 | int unlzma_main(int argc UNUSED_PARAM, char **argv) |
@@ -538,9 +538,9 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
538 | //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o | 538 | //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o |
539 | #if ENABLE_UNXZ | 539 | #if ENABLE_UNXZ |
540 | static | 540 | static |
541 | IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(transformer_aux_data_t *aux) | 541 | IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(transformer_state_t *xstate) |
542 | { | 542 | { |
543 | return unpack_xz_stream(aux, STDIN_FILENO, STDOUT_FILENO); | 543 | return unpack_xz_stream(xstate, STDIN_FILENO, STDOUT_FILENO); |
544 | } | 544 | } |
545 | int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 545 | int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
546 | int unxz_main(int argc UNUSED_PARAM, char **argv) | 546 | int unxz_main(int argc UNUSED_PARAM, char **argv) |
diff --git a/archival/bzip2.c b/archival/bzip2.c index f7718b411..47fa29af3 100644 --- a/archival/bzip2.c +++ b/archival/bzip2.c | |||
@@ -127,7 +127,7 @@ IF_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, vo | |||
127 | } | 127 | } |
128 | 128 | ||
129 | static | 129 | static |
130 | IF_DESKTOP(long long) int FAST_FUNC compressStream(transformer_aux_data_t *aux UNUSED_PARAM) | 130 | IF_DESKTOP(long long) int FAST_FUNC compressStream(transformer_state_t *xstate UNUSED_PARAM) |
131 | { | 131 | { |
132 | IF_DESKTOP(long long) int total; | 132 | IF_DESKTOP(long long) int total; |
133 | ssize_t count; | 133 | ssize_t count; |
diff --git a/archival/gzip.c b/archival/gzip.c index 1e779c9c3..a93d2175a 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -2042,7 +2042,7 @@ static void zip(ulg time_stamp) | |||
2042 | 2042 | ||
2043 | /* ======================================================================== */ | 2043 | /* ======================================================================== */ |
2044 | static | 2044 | static |
2045 | IF_DESKTOP(long long) int FAST_FUNC pack_gzip(transformer_aux_data_t *aux UNUSED_PARAM) | 2045 | IF_DESKTOP(long long) int FAST_FUNC pack_gzip(transformer_state_t *xstate UNUSED_PARAM) |
2046 | { | 2046 | { |
2047 | struct stat s; | 2047 | struct stat s; |
2048 | 2048 | ||
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c index 6396fe40d..36237e221 100644 --- a/archival/libarchive/decompress_bunzip2.c +++ b/archival/libarchive/decompress_bunzip2.c | |||
@@ -731,7 +731,7 @@ void FAST_FUNC dealloc_bunzip(bunzip_data *bd) | |||
731 | 731 | ||
732 | /* Decompress src_fd to dst_fd. Stops at end of bzip data, not end of file. */ | 732 | /* Decompress src_fd to dst_fd. Stops at end of bzip data, not end of file. */ |
733 | IF_DESKTOP(long long) int FAST_FUNC | 733 | IF_DESKTOP(long long) int FAST_FUNC |
734 | unpack_bz2_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | 734 | unpack_bz2_stream(transformer_state_t *xstate, int src_fd, int dst_fd) |
735 | { | 735 | { |
736 | IF_DESKTOP(long long total_written = 0;) | 736 | IF_DESKTOP(long long total_written = 0;) |
737 | bunzip_data *bd; | 737 | bunzip_data *bd; |
@@ -739,7 +739,7 @@ unpack_bz2_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | |||
739 | int i; | 739 | int i; |
740 | unsigned len; | 740 | unsigned len; |
741 | 741 | ||
742 | if (check_signature16(aux, src_fd, BZIP2_MAGIC)) | 742 | if (check_signature16(xstate, src_fd, BZIP2_MAGIC)) |
743 | return -1; | 743 | return -1; |
744 | 744 | ||
745 | outbuf = xmalloc(IOBUF_SIZE); | 745 | outbuf = xmalloc(IOBUF_SIZE); |
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c index 7c6f38ec3..62a3d78b6 100644 --- a/archival/libarchive/decompress_gunzip.c +++ b/archival/libarchive/decompress_gunzip.c | |||
@@ -1034,22 +1034,22 @@ inflate_unzip_internal(STATE_PARAM int in, int out) | |||
1034 | /* For unzip */ | 1034 | /* For unzip */ |
1035 | 1035 | ||
1036 | IF_DESKTOP(long long) int FAST_FUNC | 1036 | IF_DESKTOP(long long) int FAST_FUNC |
1037 | inflate_unzip(transformer_aux_data_t *aux, int in, int out) | 1037 | inflate_unzip(transformer_state_t *xstate, int in, int out) |
1038 | { | 1038 | { |
1039 | IF_DESKTOP(long long) int n; | 1039 | IF_DESKTOP(long long) int n; |
1040 | DECLARE_STATE; | 1040 | DECLARE_STATE; |
1041 | 1041 | ||
1042 | ALLOC_STATE; | 1042 | ALLOC_STATE; |
1043 | 1043 | ||
1044 | to_read = aux->bytes_in; | 1044 | to_read = xstate->bytes_in; |
1045 | // bytebuffer_max = 0x8000; | 1045 | // bytebuffer_max = 0x8000; |
1046 | bytebuffer_offset = 4; | 1046 | bytebuffer_offset = 4; |
1047 | bytebuffer = xmalloc(bytebuffer_max); | 1047 | bytebuffer = xmalloc(bytebuffer_max); |
1048 | n = inflate_unzip_internal(PASS_STATE in, out); | 1048 | n = inflate_unzip_internal(PASS_STATE in, out); |
1049 | free(bytebuffer); | 1049 | free(bytebuffer); |
1050 | 1050 | ||
1051 | aux->crc32 = gunzip_crc; | 1051 | xstate->crc32 = gunzip_crc; |
1052 | aux->bytes_out = gunzip_bytes_out; | 1052 | xstate->bytes_out = gunzip_bytes_out; |
1053 | DEALLOC_STATE; | 1053 | DEALLOC_STATE; |
1054 | return n; | 1054 | return n; |
1055 | } | 1055 | } |
@@ -1107,7 +1107,7 @@ static uint32_t buffer_read_le_u32(STATE_PARAM_ONLY) | |||
1107 | return res; | 1107 | return res; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | static int check_header_gzip(STATE_PARAM transformer_aux_data_t *aux) | 1110 | static int check_header_gzip(STATE_PARAM transformer_state_t *xstate) |
1111 | { | 1111 | { |
1112 | union { | 1112 | union { |
1113 | unsigned char raw[8]; | 1113 | unsigned char raw[8]; |
@@ -1169,8 +1169,8 @@ static int check_header_gzip(STATE_PARAM transformer_aux_data_t *aux) | |||
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | if (aux) | 1172 | if (xstate) |
1173 | aux->mtime = SWAP_LE32(header.formatted.mtime); | 1173 | xstate->mtime = SWAP_LE32(header.formatted.mtime); |
1174 | 1174 | ||
1175 | /* Read the header checksum */ | 1175 | /* Read the header checksum */ |
1176 | if (header.formatted.flags & 0x02) { | 1176 | if (header.formatted.flags & 0x02) { |
@@ -1182,17 +1182,17 @@ static int check_header_gzip(STATE_PARAM transformer_aux_data_t *aux) | |||
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | IF_DESKTOP(long long) int FAST_FUNC | 1184 | IF_DESKTOP(long long) int FAST_FUNC |
1185 | unpack_gz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | 1185 | unpack_gz_stream(transformer_state_t *xstate, int src_fd, int dst_fd) |
1186 | { | 1186 | { |
1187 | uint32_t v32; | 1187 | uint32_t v32; |
1188 | IF_DESKTOP(long long) int total, n; | 1188 | IF_DESKTOP(long long) int total, n; |
1189 | DECLARE_STATE; | 1189 | DECLARE_STATE; |
1190 | 1190 | ||
1191 | #if !ENABLE_FEATURE_SEAMLESS_Z | 1191 | #if !ENABLE_FEATURE_SEAMLESS_Z |
1192 | if (check_signature16(aux, src_fd, GZIP_MAGIC)) | 1192 | if (check_signature16(xstate, src_fd, GZIP_MAGIC)) |
1193 | return -1; | 1193 | return -1; |
1194 | #else | 1194 | #else |
1195 | if (aux && aux->check_signature) { | 1195 | if (xstate && xstate->check_signature) { |
1196 | uint16_t magic2; | 1196 | uint16_t magic2; |
1197 | 1197 | ||
1198 | if (full_read(src_fd, &magic2, 2) != 2) { | 1198 | if (full_read(src_fd, &magic2, 2) != 2) { |
@@ -1201,8 +1201,8 @@ unpack_gz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | |||
1201 | return -1; | 1201 | return -1; |
1202 | } | 1202 | } |
1203 | if (magic2 == COMPRESS_MAGIC) { | 1203 | if (magic2 == COMPRESS_MAGIC) { |
1204 | aux->check_signature = 0; | 1204 | xstate->check_signature = 0; |
1205 | return unpack_Z_stream(aux, src_fd, dst_fd); | 1205 | return unpack_Z_stream(xstate, src_fd, dst_fd); |
1206 | } | 1206 | } |
1207 | if (magic2 != GZIP_MAGIC) | 1207 | if (magic2 != GZIP_MAGIC) |
1208 | goto bad_magic; | 1208 | goto bad_magic; |
@@ -1218,7 +1218,7 @@ unpack_gz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | |||
1218 | gunzip_src_fd = src_fd; | 1218 | gunzip_src_fd = src_fd; |
1219 | 1219 | ||
1220 | again: | 1220 | again: |
1221 | if (!check_header_gzip(PASS_STATE aux)) { | 1221 | if (!check_header_gzip(PASS_STATE xstate)) { |
1222 | bb_error_msg("corrupted data"); | 1222 | bb_error_msg("corrupted data"); |
1223 | total = -1; | 1223 | total = -1; |
1224 | goto ret; | 1224 | goto ret; |
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c index 53c27080f..cb3d55a88 100644 --- a/archival/libarchive/decompress_uncompress.c +++ b/archival/libarchive/decompress_uncompress.c | |||
@@ -73,7 +73,7 @@ | |||
73 | */ | 73 | */ |
74 | 74 | ||
75 | IF_DESKTOP(long long) int FAST_FUNC | 75 | IF_DESKTOP(long long) int FAST_FUNC |
76 | unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | 76 | unpack_Z_stream(transformer_state_t *xstate, int src_fd, int dst_fd) |
77 | { | 77 | { |
78 | IF_DESKTOP(long long total_written = 0;) | 78 | IF_DESKTOP(long long total_written = 0;) |
79 | IF_DESKTOP(long long) int retval = -1; | 79 | IF_DESKTOP(long long) int retval = -1; |
@@ -102,7 +102,7 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | |||
102 | /* block compress mode -C compatible with 2.0 */ | 102 | /* block compress mode -C compatible with 2.0 */ |
103 | int block_mode; /* = BLOCK_MODE; */ | 103 | int block_mode; /* = BLOCK_MODE; */ |
104 | 104 | ||
105 | if (check_signature16(aux, src_fd, COMPRESS_MAGIC)) | 105 | if (check_signature16(xstate, src_fd, COMPRESS_MAGIC)) |
106 | return -1; | 106 | return -1; |
107 | 107 | ||
108 | inbuf = xzalloc(IBUFSIZ + 64); | 108 | inbuf = xzalloc(IBUFSIZ + 64); |
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c index 3d99e1388..ccedac49d 100644 --- a/archival/libarchive/decompress_unlzma.c +++ b/archival/libarchive/decompress_unlzma.c | |||
@@ -206,7 +206,7 @@ enum { | |||
206 | 206 | ||
207 | 207 | ||
208 | IF_DESKTOP(long long) int FAST_FUNC | 208 | IF_DESKTOP(long long) int FAST_FUNC |
209 | unpack_lzma_stream(transformer_aux_data_t *aux UNUSED_PARAM, int src_fd, int dst_fd) | 209 | unpack_lzma_stream(transformer_state_t *xstate UNUSED_PARAM, int src_fd, int dst_fd) |
210 | { | 210 | { |
211 | IF_DESKTOP(long long total_written = 0;) | 211 | IF_DESKTOP(long long total_written = 0;) |
212 | lzma_header_t header; | 212 | lzma_header_t header; |
diff --git a/archival/libarchive/decompress_unxz.c b/archival/libarchive/decompress_unxz.c index 986b7b191..6df54e131 100644 --- a/archival/libarchive/decompress_unxz.c +++ b/archival/libarchive/decompress_unxz.c | |||
@@ -38,7 +38,7 @@ static uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc) | |||
38 | #include "unxz/xz_dec_stream.c" | 38 | #include "unxz/xz_dec_stream.c" |
39 | 39 | ||
40 | IF_DESKTOP(long long) int FAST_FUNC | 40 | IF_DESKTOP(long long) int FAST_FUNC |
41 | unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | 41 | unpack_xz_stream(transformer_state_t *xstate, int src_fd, int dst_fd) |
42 | { | 42 | { |
43 | enum xz_ret xz_result; | 43 | enum xz_ret xz_result; |
44 | struct xz_buf iobuf; | 44 | struct xz_buf iobuf; |
@@ -55,7 +55,7 @@ unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) | |||
55 | iobuf.out = membuf + BUFSIZ; | 55 | iobuf.out = membuf + BUFSIZ; |
56 | iobuf.out_size = BUFSIZ; | 56 | iobuf.out_size = BUFSIZ; |
57 | 57 | ||
58 | if (!aux || aux->check_signature == 0) { | 58 | if (!xstate || xstate->check_signature == 0) { |
59 | /* Preload XZ file signature */ | 59 | /* Preload XZ file signature */ |
60 | strcpy((char*)membuf, HEADER_MAGIC); | 60 | strcpy((char*)membuf, HEADER_MAGIC); |
61 | iobuf.in_size = HEADER_MAGIC_SIZE; | 61 | iobuf.in_size = HEADER_MAGIC_SIZE; |
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index 198663041..584b15de4 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c | |||
@@ -6,19 +6,19 @@ | |||
6 | #include "libbb.h" | 6 | #include "libbb.h" |
7 | #include "bb_archive.h" | 7 | #include "bb_archive.h" |
8 | 8 | ||
9 | void FAST_FUNC init_transformer_aux_data(transformer_aux_data_t *aux) | 9 | void FAST_FUNC init_transformer_state(transformer_state_t *xstate) |
10 | { | 10 | { |
11 | memset(aux, 0, sizeof(*aux)); | 11 | memset(xstate, 0, sizeof(*xstate)); |
12 | } | 12 | } |
13 | 13 | ||
14 | int FAST_FUNC check_signature16(transformer_aux_data_t *aux, int src_fd, unsigned magic16) | 14 | int FAST_FUNC check_signature16(transformer_state_t *xstate, int src_fd, unsigned magic16) |
15 | { | 15 | { |
16 | if (aux && aux->check_signature) { | 16 | if (xstate && xstate->check_signature) { |
17 | uint16_t magic2; | 17 | uint16_t magic2; |
18 | if (full_read(src_fd, &magic2, 2) != 2 || magic2 != magic16) { | 18 | if (full_read(src_fd, &magic2, 2) != 2 || magic2 != magic16) { |
19 | bb_error_msg("invalid magic"); | 19 | bb_error_msg("invalid magic"); |
20 | #if 0 /* possible future extension */ | 20 | #if 0 /* possible future extension */ |
21 | if (aux->check_signature > 1) | 21 | if (xstate->check_signature > 1) |
22 | xfunc_die(); | 22 | xfunc_die(); |
23 | #endif | 23 | #endif |
24 | return -1; | 24 | return -1; |
@@ -62,7 +62,7 @@ void check_errors_in_children(int signo) | |||
62 | #if BB_MMU | 62 | #if BB_MMU |
63 | void FAST_FUNC open_transformer(int fd, | 63 | void FAST_FUNC open_transformer(int fd, |
64 | int check_signature, | 64 | int check_signature, |
65 | IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd) | 65 | IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_state_t *xstate, int src_fd, int dst_fd) |
66 | ) | 66 | ) |
67 | #else | 67 | #else |
68 | void FAST_FUNC open_transformer(int fd, const char *transform_prog) | 68 | void FAST_FUNC open_transformer(int fd, const char *transform_prog) |
@@ -80,10 +80,10 @@ void FAST_FUNC open_transformer(int fd, const char *transform_prog) | |||
80 | #if BB_MMU | 80 | #if BB_MMU |
81 | { | 81 | { |
82 | IF_DESKTOP(long long) int r; | 82 | IF_DESKTOP(long long) int r; |
83 | transformer_aux_data_t aux; | 83 | transformer_state_t xstate; |
84 | init_transformer_aux_data(&aux); | 84 | init_transformer_state(&xstate); |
85 | aux.check_signature = check_signature; | 85 | xstate.check_signature = check_signature; |
86 | r = transformer(&aux, fd, fd_pipe.wr); | 86 | r = transformer(&xstate, fd, fd_pipe.wr); |
87 | if (ENABLE_FEATURE_CLEAN_UP) { | 87 | if (ENABLE_FEATURE_CLEAN_UP) { |
88 | close(fd_pipe.wr); /* send EOF */ | 88 | close(fd_pipe.wr); /* send EOF */ |
89 | close(fd); | 89 | close(fd); |
@@ -126,7 +126,7 @@ int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_compressed) | |||
126 | uint32_t b32[1]; | 126 | uint32_t b32[1]; |
127 | } magic; | 127 | } magic; |
128 | int offset = -2; | 128 | int offset = -2; |
129 | USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd);) | 129 | USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate, int src_fd, int dst_fd);) |
130 | USE_FOR_NOMMU(const char *xformer_prog;) | 130 | USE_FOR_NOMMU(const char *xformer_prog;) |
131 | 131 | ||
132 | /* .gz and .bz2 both have 2-byte signature, and their | 132 | /* .gz and .bz2 both have 2-byte signature, and their |
diff --git a/archival/lzop.c b/archival/lzop.c index 5062d9300..73d11a705 100644 --- a/archival/lzop.c +++ b/archival/lzop.c | |||
@@ -1099,7 +1099,7 @@ static char* FAST_FUNC make_new_name_lzop(char *filename, const char *expected_e | |||
1099 | return xasprintf("%s.lzo", filename); | 1099 | return xasprintf("%s.lzo", filename); |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | static IF_DESKTOP(long long) int FAST_FUNC pack_lzop(transformer_aux_data_t *aux UNUSED_PARAM) | 1102 | static IF_DESKTOP(long long) int FAST_FUNC pack_lzop(transformer_state_t *xstate UNUSED_PARAM) |
1103 | { | 1103 | { |
1104 | if (option_mask32 & OPT_DECOMPRESS) | 1104 | if (option_mask32 & OPT_DECOMPRESS) |
1105 | return do_lzo_decompress(); | 1105 | return do_lzo_decompress(); |
diff --git a/archival/tar.c b/archival/tar.c index aa02d3512..7897a4af6 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -1171,7 +1171,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | if (opt & OPT_ANY_COMPRESS) { | 1173 | if (opt & OPT_ANY_COMPRESS) { |
1174 | USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd);) | 1174 | USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate, int src_fd, int dst_fd);) |
1175 | USE_FOR_NOMMU(const char *xformer_prog;) | 1175 | USE_FOR_NOMMU(const char *xformer_prog;) |
1176 | 1176 | ||
1177 | if (opt & OPT_COMPRESS) | 1177 | if (opt & OPT_COMPRESS) |
diff --git a/archival/unzip.c b/archival/unzip.c index fcfc9a448..c622bde57 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -280,17 +280,17 @@ static void unzip_extract(zip_header_t *zip_header, int dst_fd) | |||
280 | bb_copyfd_exact_size(zip_fd, dst_fd, size); | 280 | bb_copyfd_exact_size(zip_fd, dst_fd, size); |
281 | } else { | 281 | } else { |
282 | /* Method 8 - inflate */ | 282 | /* Method 8 - inflate */ |
283 | transformer_aux_data_t aux; | 283 | transformer_state_t xstate; |
284 | init_transformer_aux_data(&aux); | 284 | init_transformer_state(&xstate); |
285 | aux.bytes_in = zip_header->formatted.cmpsize; | 285 | xstate.bytes_in = zip_header->formatted.cmpsize; |
286 | if (inflate_unzip(&aux, zip_fd, dst_fd) < 0) | 286 | if (inflate_unzip(&xstate, zip_fd, dst_fd) < 0) |
287 | bb_error_msg_and_die("inflate error"); | 287 | bb_error_msg_and_die("inflate error"); |
288 | /* Validate decompression - crc */ | 288 | /* Validate decompression - crc */ |
289 | if (zip_header->formatted.crc32 != (aux.crc32 ^ 0xffffffffL)) { | 289 | if (zip_header->formatted.crc32 != (xstate.crc32 ^ 0xffffffffL)) { |
290 | bb_error_msg_and_die("crc error"); | 290 | bb_error_msg_and_die("crc error"); |
291 | } | 291 | } |
292 | /* Validate decompression - size */ | 292 | /* Validate decompression - size */ |
293 | if (zip_header->formatted.ucmpsize != aux.bytes_out) { | 293 | if (zip_header->formatted.ucmpsize != xstate.bytes_out) { |
294 | /* Don't die. Who knows, maybe len calculation | 294 | /* Don't die. Who knows, maybe len calculation |
295 | * was botched somewhere. After all, crc matched! */ | 295 | * was botched somewhere. After all, crc matched! */ |
296 | bb_error_msg("bad length"); | 296 | bb_error_msg("bad length"); |
diff --git a/include/bb_archive.h b/include/bb_archive.h index b82cfd83c..8a2dd2735 100644 --- a/include/bb_archive.h +++ b/include/bb_archive.h | |||
@@ -203,27 +203,27 @@ int read_bunzip(bunzip_data *bd, char *outbuf, int len) FAST_FUNC; | |||
203 | void dealloc_bunzip(bunzip_data *bd) FAST_FUNC; | 203 | void dealloc_bunzip(bunzip_data *bd) FAST_FUNC; |
204 | 204 | ||
205 | /* Meaning and direction (input/output) of the fields are transformer-specific */ | 205 | /* Meaning and direction (input/output) of the fields are transformer-specific */ |
206 | typedef struct transformer_aux_data_t { | 206 | typedef struct transformer_state_t { |
207 | smallint check_signature; /* most often referenced member */ | 207 | smallint check_signature; /* most often referenced member */ |
208 | off_t bytes_out; | 208 | off_t bytes_out; |
209 | off_t bytes_in; /* used in unzip code only: needs to know packed size */ | 209 | off_t bytes_in; /* used in unzip code only: needs to know packed size */ |
210 | uint32_t crc32; | 210 | uint32_t crc32; |
211 | time_t mtime; /* gunzip code may set this on exit */ | 211 | time_t mtime; /* gunzip code may set this on exit */ |
212 | } transformer_aux_data_t; | 212 | } transformer_state_t; |
213 | 213 | ||
214 | void init_transformer_aux_data(transformer_aux_data_t *aux) FAST_FUNC; | 214 | void init_transformer_state(transformer_state_t *xstate) FAST_FUNC; |
215 | int FAST_FUNC check_signature16(transformer_aux_data_t *aux, int src_fd, unsigned magic16) FAST_FUNC; | 215 | int FAST_FUNC check_signature16(transformer_state_t *xstate, int src_fd, unsigned magic16) FAST_FUNC; |
216 | 216 | ||
217 | IF_DESKTOP(long long) int inflate_unzip(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | 217 | IF_DESKTOP(long long) int inflate_unzip(transformer_state_t *xstate, int src_fd, int dst_fd) FAST_FUNC; |
218 | IF_DESKTOP(long long) int unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | 218 | IF_DESKTOP(long long) int unpack_Z_stream(transformer_state_t *xstate, int src_fd, int dst_fd) FAST_FUNC; |
219 | IF_DESKTOP(long long) int unpack_gz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | 219 | IF_DESKTOP(long long) int unpack_gz_stream(transformer_state_t *xstate, int src_fd, int dst_fd) FAST_FUNC; |
220 | IF_DESKTOP(long long) int unpack_bz2_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | 220 | IF_DESKTOP(long long) int unpack_bz2_stream(transformer_state_t *xstate, int src_fd, int dst_fd) FAST_FUNC; |
221 | IF_DESKTOP(long long) int unpack_lzma_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | 221 | IF_DESKTOP(long long) int unpack_lzma_stream(transformer_state_t *xstate, int src_fd, int dst_fd) FAST_FUNC; |
222 | IF_DESKTOP(long long) int unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | 222 | IF_DESKTOP(long long) int unpack_xz_stream(transformer_state_t *xstate, int src_fd, int dst_fd) FAST_FUNC; |
223 | 223 | ||
224 | char* append_ext(char *filename, const char *expected_ext) FAST_FUNC; | 224 | char* append_ext(char *filename, const char *expected_ext) FAST_FUNC; |
225 | int bbunpack(char **argv, | 225 | int bbunpack(char **argv, |
226 | IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_aux_data_t *aux), | 226 | IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_state_t *xstate), |
227 | char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), | 227 | char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), |
228 | const char *expected_ext | 228 | const char *expected_ext |
229 | ) FAST_FUNC; | 229 | ) FAST_FUNC; |
@@ -232,7 +232,7 @@ void check_errors_in_children(int signo); | |||
232 | #if BB_MMU | 232 | #if BB_MMU |
233 | void open_transformer(int fd, | 233 | void open_transformer(int fd, |
234 | int check_signature, | 234 | int check_signature, |
235 | IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd) | 235 | IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_state_t *xstate, int src_fd, int dst_fd) |
236 | ) FAST_FUNC; | 236 | ) FAST_FUNC; |
237 | #define open_transformer_with_sig(fd, transformer, transform_prog) open_transformer((fd), 1, (transformer)) | 237 | #define open_transformer_with_sig(fd, transformer, transform_prog) open_transformer((fd), 1, (transformer)) |
238 | #define open_transformer_with_no_sig(fd, transformer) open_transformer((fd), 0, (transformer)) | 238 | #define open_transformer_with_no_sig(fd, transformer) open_transformer((fd), 0, (transformer)) |