aboutsummaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
commitc7bda1ce659294d6e22c06e087f6f265983c7578 (patch)
tree4c6d2217f4d8306c59cf1096f8664e1cfd167213 /archival/libunarchive
parent8854004b41065b3d081af7f3df13a100b0c8bfbe (diff)
downloadbusybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.gz
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.bz2
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.zip
Remove trailing whitespace. Update copyright to include 2004.
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/Makefile2
-rw-r--r--archival/libunarchive/Makefile.in6
-rw-r--r--archival/libunarchive/data_extract_all.c4
-rw-r--r--archival/libunarchive/decompress_bunzip2.c2
-rw-r--r--archival/libunarchive/decompress_uncompress.c2
-rw-r--r--archival/libunarchive/decompress_unzip.c32
-rw-r--r--archival/libunarchive/filter_accept_list_reassign.c2
-rw-r--r--archival/libunarchive/get_header_ar.c2
-rw-r--r--archival/libunarchive/get_header_cpio.c6
-rw-r--r--archival/libunarchive/get_header_tar.c4
-rw-r--r--archival/libunarchive/uncompress.c2
-rw-r--r--archival/libunarchive/unzip.c32
12 files changed, 48 insertions, 48 deletions
diff --git a/archival/libunarchive/Makefile b/archival/libunarchive/Makefile
index 272ca2434..9a20ea28b 100644
--- a/archival/libunarchive/Makefile
+++ b/archival/libunarchive/Makefile
@@ -1,6 +1,6 @@
1# Makefile for busybox 1# Makefile for busybox
2# 2#
3# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# This program is free software; you can redistribute it and/or modify 5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in
index 09b0571ed..c0e12a6c8 100644
--- a/archival/libunarchive/Makefile.in
+++ b/archival/libunarchive/Makefile.in
@@ -1,6 +1,6 @@
1# Makefile for busybox 1# Makefile for busybox
2# 2#
3# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# This program is free software; you can redistribute it and/or modify 5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ DPKG_FILES:= \
55 get_header_tar.o \ 55 get_header_tar.o \
56 filter_accept_list_reassign.o 56 filter_accept_list_reassign.o
57 57
58LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o 58LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
59LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o 59LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
60LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o 60LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o
61LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES) 61LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES)
@@ -64,7 +64,7 @@ LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o
64LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o 64LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o
65LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) 65LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
66LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += uncompress.o 66LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += uncompress.o
67LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o 67LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
68LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o 68LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
69LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o 69LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
70LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o 70LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 4cff24339..a9a3a93d8 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -37,7 +37,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
37 char *name = bb_xstrdup(file_header->name); 37 char *name = bb_xstrdup(file_header->name);
38 bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR); 38 bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR);
39 free(name); 39 free(name);
40 } 40 }
41 41
42 /* Check if the file already exists */ 42 /* Check if the file already exists */
43 if (archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) { 43 if (archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) {
@@ -66,7 +66,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
66 } 66 }
67 } 67 }
68 68
69 /* Handle hard links seperately 69 /* Handle hard links seperately
70 * We identified hard links as regular files of size 0 with a symlink */ 70 * We identified hard links as regular files of size 0 with a symlink */
71 if (S_ISREG(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) { 71 if (S_ISREG(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) {
72 /* hard link */ 72 /* hard link */
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c
index 3e6138c95..af165336e 100644
--- a/archival/libunarchive/decompress_bunzip2.c
+++ b/archival/libunarchive/decompress_bunzip2.c
@@ -248,7 +248,7 @@ static int get_next_block(bunzip_data *bd)
248 pp=0; 248 pp=0;
249 for(i=minLen;i<=maxLen;i++) { 249 for(i=minLen;i<=maxLen;i++) {
250 temp[i]=limit[i]=0; 250 temp[i]=limit[i]=0;
251 for(t=0;t<symCount;t++) 251 for(t=0;t<symCount;t++)
252 if(length[t]==i) hufGroup->permute[pp++] = t; 252 if(length[t]==i) hufGroup->permute[pp++] = t;
253 } 253 }
254 /* Count symbols coded for at each bit length */ 254 /* Count symbols coded for at each bit length */
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index 65418a7ca..ddf293fd6 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -3,7 +3,7 @@
3 3
4/* uncompress for busybox -- (c) 2002 Robert Griebl 4/* uncompress for busybox -- (c) 2002 Robert Griebl
5 * 5 *
6 * based on the original compress42.c source 6 * based on the original compress42.c source
7 * (see disclaimer below) 7 * (see disclaimer below)
8 */ 8 */
9 9
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 29929c282..a436db191 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -13,7 +13,7 @@
13 * 13 *
14 * General cleanup to better adhere to the style guide and make use of standard 14 * General cleanup to better adhere to the style guide and make use of standard
15 * busybox functions by Glenn McGrath <bug1@optushome.com.au> 15 * busybox functions by Glenn McGrath <bug1@optushome.com.au>
16 * 16 *
17 * read_gz interface + associated hacking by Laurence Anderson 17 * read_gz interface + associated hacking by Laurence Anderson
18 * 18 *
19 * This program is free software; you can redistribute it and/or modify 19 * This program is free software; you can redistribute it and/or modify
@@ -148,7 +148,7 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
148{ 148{
149 while (*current < required) { 149 while (*current < required) {
150 if (bytebuffer_offset >= bytebuffer_size) { 150 if (bytebuffer_offset >= bytebuffer_size) {
151 /* Leave the first 4 bytes empty so we can always unwind the bitbuffer 151 /* Leave the first 4 bytes empty so we can always unwind the bitbuffer
152 * to the front of the bytebuffer, leave 4 bytes free at end of tail 152 * to the front of the bytebuffer, leave 4 bytes free at end of tail
153 * so we can easily top up buffer in check_trailer_gzip() */ 153 * so we can easily top up buffer in check_trailer_gzip() */
154 bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8); 154 bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
@@ -193,7 +193,7 @@ static void make_gunzip_crc_table(void)
193/* 193/*
194 * Free the malloc'ed tables built by huft_build(), which makes a linked 194 * Free the malloc'ed tables built by huft_build(), which makes a linked
195 * list of the tables it made, with the links in a dummy first entry of 195 * list of the tables it made, with the links in a dummy first entry of
196 * each table. 196 * each table.
197 * t: table to free 197 * t: table to free
198 */ 198 */
199static int huft_free(huft_t * t) 199static int huft_free(huft_t * t)
@@ -435,9 +435,9 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b
435 md = mask_bits[bd]; 435 md = mask_bits[bd];
436 return 0; // Don't actually do anything the first time 436 return 0; // Don't actually do anything the first time
437 } 437 }
438 438
439 if (resumeCopy) goto do_copy; 439 if (resumeCopy) goto do_copy;
440 440
441 while (1) { /* do until end of block */ 441 while (1) { /* do until end of block */
442 b = fill_bitbuffer(b, &k, bl); 442 b = fill_bitbuffer(b, &k, bl);
443 if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) 443 if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
@@ -533,7 +533,7 @@ do_copy: do {
533 /* free the decoding tables, return */ 533 /* free the decoding tables, return */
534 huft_free(tl); 534 huft_free(tl);
535 huft_free(td); 535 huft_free(td);
536 536
537 /* done */ 537 /* done */
538 return 0; 538 return 0;
539} 539}
@@ -548,7 +548,7 @@ static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
548 w = gunzip_outbuf_count; /* initialize gunzip_window position */ 548 w = gunzip_outbuf_count; /* initialize gunzip_window position */
549 return 0; // Don't do anything first time 549 return 0; // Don't do anything first time
550 } 550 }
551 551
552 /* read and output the compressed data */ 552 /* read and output the compressed data */
553 while (n--) { 553 while (n--) {
554 b_stored = fill_bitbuffer(b_stored, &k_stored, 8); 554 b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
@@ -639,7 +639,7 @@ static int inflate_block(int *e)
639 inflate_stored(n, b_stored, k_stored, 1); // Setup inflate_stored 639 inflate_stored(n, b_stored, k_stored, 1); // Setup inflate_stored
640 return -1; 640 return -1;
641 } 641 }
642 case 1: /* Inflate fixed 642 case 1: /* Inflate fixed
643 * decompress an inflated type 1 (fixed Huffman codes) block. We should 643 * decompress an inflated type 1 (fixed Huffman codes) block. We should
644 * either replace this with a custom decoder, or at least precompute the 644 * either replace this with a custom decoder, or at least precompute the
645 * Huffman tables. 645 * Huffman tables.
@@ -682,9 +682,9 @@ static int inflate_block(int *e)
682 682
683 /* decompress until an end-of-block code */ 683 /* decompress until an end-of-block code */
684 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes 684 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
685 685
686 /* huft_free code moved into inflate_codes */ 686 /* huft_free code moved into inflate_codes */
687 687
688 return -2; 688 return -2;
689 } 689 }
690 case 2: /* Inflate dynamic */ 690 case 2: /* Inflate dynamic */
@@ -836,7 +836,7 @@ static int inflate_block(int *e)
836 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes 836 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
837 837
838 /* huft_free code moved into inflate_codes */ 838 /* huft_free code moved into inflate_codes */
839 839
840 return -2; 840 return -2;
841 } 841 }
842 default: 842 default:
@@ -859,12 +859,12 @@ static int inflate_get_next_window(void)
859 static int method = -1; // Method == -1 for stored, -2 for codes 859 static int method = -1; // Method == -1 for stored, -2 for codes
860 static int e = 0; 860 static int e = 0;
861 static int needAnotherBlock = 1; 861 static int needAnotherBlock = 1;
862 862
863 gunzip_outbuf_count = 0; 863 gunzip_outbuf_count = 0;
864 864
865 while(1) { 865 while(1) {
866 int ret; 866 int ret;
867 867
868 if (needAnotherBlock) { 868 if (needAnotherBlock) {
869 if(e) { 869 if(e) {
870 calculate_gunzip_crc(); 870 calculate_gunzip_crc();
@@ -875,7 +875,7 @@ static int inflate_get_next_window(void)
875 method = inflate_block(&e); 875 method = inflate_block(&e);
876 needAnotherBlock = 0; 876 needAnotherBlock = 0;
877 } 877 }
878 878
879 switch (method) { 879 switch (method) {
880 case -1: ret = inflate_stored(0,0,0,0); 880 case -1: ret = inflate_stored(0,0,0,0);
881 break; 881 break;
@@ -920,7 +920,7 @@ extern int inflate_unzip(int in, int out)
920 make_gunzip_crc_table(); 920 make_gunzip_crc_table();
921 921
922 /* Allocate space for buffer */ 922 /* Allocate space for buffer */
923 bytebuffer = xmalloc(bytebuffer_max); 923 bytebuffer = xmalloc(bytebuffer_max);
924 924
925 while(1) { 925 while(1) {
926 int ret = inflate_get_next_window(); 926 int ret = inflate_get_next_window();
@@ -977,6 +977,6 @@ extern int inflate_gunzip(int in, int out)
977 (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { 977 (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
978 bb_error_msg("Incorrect length"); 978 bb_error_msg("Incorrect length");
979 } 979 }
980 980
981 return 0; 981 return 0;
982} 982}
diff --git a/archival/libunarchive/filter_accept_list_reassign.c b/archival/libunarchive/filter_accept_list_reassign.c
index 1e9da0f2b..d0436549b 100644
--- a/archival/libunarchive/filter_accept_list_reassign.c
+++ b/archival/libunarchive/filter_accept_list_reassign.c
@@ -26,7 +26,7 @@
26/* 26/*
27 * Reassign the subarchive metadata parser based on the filename extension 27 * Reassign the subarchive metadata parser based on the filename extension
28 * e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz 28 * e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz
29 * or if its a .tar.bz2 make archive_handle->sub_archive handle that 29 * or if its a .tar.bz2 make archive_handle->sub_archive handle that
30 */ 30 */
31extern char filter_accept_list_reassign(archive_handle_t *archive_handle) 31extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
32{ 32{
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index 25eafe0bd..86e0bc08f 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -113,7 +113,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
113 archive_handle->action_data(archive_handle); 113 archive_handle->action_data(archive_handle);
114 } 114 }
115 } else { 115 } else {
116 data_skip(archive_handle); 116 data_skip(archive_handle);
117 } 117 }
118 118
119 archive_handle->offset += typed->size; 119 archive_handle->offset += typed->size;
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index 25fdc0600..e8a68f1c3 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -36,7 +36,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
36 int namesize; 36 int namesize;
37 char dummy[16]; 37 char dummy[16];
38 int major, minor, nlink, inode; 38 int major, minor, nlink, inode;
39 39
40 if (pending_hardlinks) { /* Deal with any pending hardlinks */ 40 if (pending_hardlinks) { /* Deal with any pending hardlinks */
41 hardlinks_t *tmp; 41 hardlinks_t *tmp;
42 hardlinks_t *oldtmp; 42 hardlinks_t *oldtmp;
@@ -77,7 +77,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
77 { 77 {
78 unsigned long tmpsize; 78 unsigned long tmpsize;
79 sscanf(cpio_header, "%6c%8x%8x%8x%8x%8x%8lx%8lx%16c%8x%8x%8x%8c", 79 sscanf(cpio_header, "%6c%8x%8x%8x%8x%8x%8lx%8lx%16c%8x%8x%8x%8c",
80 dummy, &inode, (unsigned int*)&file_header->mode, 80 dummy, &inode, (unsigned int*)&file_header->mode,
81 (unsigned int*)&file_header->uid, (unsigned int*)&file_header->gid, 81 (unsigned int*)&file_header->uid, (unsigned int*)&file_header->gid,
82 &nlink, &file_header->mtime, &tmpsize, 82 &nlink, &file_header->mtime, &tmpsize,
83 dummy, &major, &minor, &namesize, dummy); 83 dummy, &major, &minor, &namesize, dummy);
@@ -147,7 +147,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
147 archive_handle->action_data(archive_handle); 147 archive_handle->action_data(archive_handle);
148 archive_handle->action_header(archive_handle->file_header); 148 archive_handle->action_header(archive_handle->file_header);
149 } else { 149 } else {
150 data_skip(archive_handle); 150 data_skip(archive_handle);
151 } 151 }
152 152
153 archive_handle->offset += file_header->size; 153 archive_handle->offset += file_header->size;
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index ad580617b..c6ebdae80 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -119,7 +119,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
119 file_header->gid = strtol(tar.formated.gid, NULL, 8); 119 file_header->gid = strtol(tar.formated.gid, NULL, 8);
120 file_header->size = strtol(tar.formated.size, NULL, 8); 120 file_header->size = strtol(tar.formated.size, NULL, 8);
121 file_header->mtime = strtol(tar.formated.mtime, NULL, 8); 121 file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
122 file_header->link_name = (tar.formated.linkname[0] != '\0') ? 122 file_header->link_name = (tar.formated.linkname[0] != '\0') ?
123 bb_xstrdup(tar.formated.linkname) : NULL; 123 bb_xstrdup(tar.formated.linkname) : NULL;
124 file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) + 124 file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
125 strtol(tar.formated.devminor, NULL, 8)); 125 strtol(tar.formated.devminor, NULL, 8));
@@ -205,7 +205,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
205 archive_handle->action_data(archive_handle); 205 archive_handle->action_data(archive_handle);
206 archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name); 206 archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name);
207 } else { 207 } else {
208 data_skip(archive_handle); 208 data_skip(archive_handle);
209 } 209 }
210 archive_handle->offset += file_header->size; 210 archive_handle->offset += file_header->size;
211 211
diff --git a/archival/libunarchive/uncompress.c b/archival/libunarchive/uncompress.c
index 65418a7ca..ddf293fd6 100644
--- a/archival/libunarchive/uncompress.c
+++ b/archival/libunarchive/uncompress.c
@@ -3,7 +3,7 @@
3 3
4/* uncompress for busybox -- (c) 2002 Robert Griebl 4/* uncompress for busybox -- (c) 2002 Robert Griebl
5 * 5 *
6 * based on the original compress42.c source 6 * based on the original compress42.c source
7 * (see disclaimer below) 7 * (see disclaimer below)
8 */ 8 */
9 9
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c
index 29929c282..a436db191 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -13,7 +13,7 @@
13 * 13 *
14 * General cleanup to better adhere to the style guide and make use of standard 14 * General cleanup to better adhere to the style guide and make use of standard
15 * busybox functions by Glenn McGrath <bug1@optushome.com.au> 15 * busybox functions by Glenn McGrath <bug1@optushome.com.au>
16 * 16 *
17 * read_gz interface + associated hacking by Laurence Anderson 17 * read_gz interface + associated hacking by Laurence Anderson
18 * 18 *
19 * This program is free software; you can redistribute it and/or modify 19 * This program is free software; you can redistribute it and/or modify
@@ -148,7 +148,7 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
148{ 148{
149 while (*current < required) { 149 while (*current < required) {
150 if (bytebuffer_offset >= bytebuffer_size) { 150 if (bytebuffer_offset >= bytebuffer_size) {
151 /* Leave the first 4 bytes empty so we can always unwind the bitbuffer 151 /* Leave the first 4 bytes empty so we can always unwind the bitbuffer
152 * to the front of the bytebuffer, leave 4 bytes free at end of tail 152 * to the front of the bytebuffer, leave 4 bytes free at end of tail
153 * so we can easily top up buffer in check_trailer_gzip() */ 153 * so we can easily top up buffer in check_trailer_gzip() */
154 bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8); 154 bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
@@ -193,7 +193,7 @@ static void make_gunzip_crc_table(void)
193/* 193/*
194 * Free the malloc'ed tables built by huft_build(), which makes a linked 194 * Free the malloc'ed tables built by huft_build(), which makes a linked
195 * list of the tables it made, with the links in a dummy first entry of 195 * list of the tables it made, with the links in a dummy first entry of
196 * each table. 196 * each table.
197 * t: table to free 197 * t: table to free
198 */ 198 */
199static int huft_free(huft_t * t) 199static int huft_free(huft_t * t)
@@ -435,9 +435,9 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b
435 md = mask_bits[bd]; 435 md = mask_bits[bd];
436 return 0; // Don't actually do anything the first time 436 return 0; // Don't actually do anything the first time
437 } 437 }
438 438
439 if (resumeCopy) goto do_copy; 439 if (resumeCopy) goto do_copy;
440 440
441 while (1) { /* do until end of block */ 441 while (1) { /* do until end of block */
442 b = fill_bitbuffer(b, &k, bl); 442 b = fill_bitbuffer(b, &k, bl);
443 if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) 443 if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
@@ -533,7 +533,7 @@ do_copy: do {
533 /* free the decoding tables, return */ 533 /* free the decoding tables, return */
534 huft_free(tl); 534 huft_free(tl);
535 huft_free(td); 535 huft_free(td);
536 536
537 /* done */ 537 /* done */
538 return 0; 538 return 0;
539} 539}
@@ -548,7 +548,7 @@ static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
548 w = gunzip_outbuf_count; /* initialize gunzip_window position */ 548 w = gunzip_outbuf_count; /* initialize gunzip_window position */
549 return 0; // Don't do anything first time 549 return 0; // Don't do anything first time
550 } 550 }
551 551
552 /* read and output the compressed data */ 552 /* read and output the compressed data */
553 while (n--) { 553 while (n--) {
554 b_stored = fill_bitbuffer(b_stored, &k_stored, 8); 554 b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
@@ -639,7 +639,7 @@ static int inflate_block(int *e)
639 inflate_stored(n, b_stored, k_stored, 1); // Setup inflate_stored 639 inflate_stored(n, b_stored, k_stored, 1); // Setup inflate_stored
640 return -1; 640 return -1;
641 } 641 }
642 case 1: /* Inflate fixed 642 case 1: /* Inflate fixed
643 * decompress an inflated type 1 (fixed Huffman codes) block. We should 643 * decompress an inflated type 1 (fixed Huffman codes) block. We should
644 * either replace this with a custom decoder, or at least precompute the 644 * either replace this with a custom decoder, or at least precompute the
645 * Huffman tables. 645 * Huffman tables.
@@ -682,9 +682,9 @@ static int inflate_block(int *e)
682 682
683 /* decompress until an end-of-block code */ 683 /* decompress until an end-of-block code */
684 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes 684 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
685 685
686 /* huft_free code moved into inflate_codes */ 686 /* huft_free code moved into inflate_codes */
687 687
688 return -2; 688 return -2;
689 } 689 }
690 case 2: /* Inflate dynamic */ 690 case 2: /* Inflate dynamic */
@@ -836,7 +836,7 @@ static int inflate_block(int *e)
836 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes 836 inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
837 837
838 /* huft_free code moved into inflate_codes */ 838 /* huft_free code moved into inflate_codes */
839 839
840 return -2; 840 return -2;
841 } 841 }
842 default: 842 default:
@@ -859,12 +859,12 @@ static int inflate_get_next_window(void)
859 static int method = -1; // Method == -1 for stored, -2 for codes 859 static int method = -1; // Method == -1 for stored, -2 for codes
860 static int e = 0; 860 static int e = 0;
861 static int needAnotherBlock = 1; 861 static int needAnotherBlock = 1;
862 862
863 gunzip_outbuf_count = 0; 863 gunzip_outbuf_count = 0;
864 864
865 while(1) { 865 while(1) {
866 int ret; 866 int ret;
867 867
868 if (needAnotherBlock) { 868 if (needAnotherBlock) {
869 if(e) { 869 if(e) {
870 calculate_gunzip_crc(); 870 calculate_gunzip_crc();
@@ -875,7 +875,7 @@ static int inflate_get_next_window(void)
875 method = inflate_block(&e); 875 method = inflate_block(&e);
876 needAnotherBlock = 0; 876 needAnotherBlock = 0;
877 } 877 }
878 878
879 switch (method) { 879 switch (method) {
880 case -1: ret = inflate_stored(0,0,0,0); 880 case -1: ret = inflate_stored(0,0,0,0);
881 break; 881 break;
@@ -920,7 +920,7 @@ extern int inflate_unzip(int in, int out)
920 make_gunzip_crc_table(); 920 make_gunzip_crc_table();
921 921
922 /* Allocate space for buffer */ 922 /* Allocate space for buffer */
923 bytebuffer = xmalloc(bytebuffer_max); 923 bytebuffer = xmalloc(bytebuffer_max);
924 924
925 while(1) { 925 while(1) {
926 int ret = inflate_get_next_window(); 926 int ret = inflate_get_next_window();
@@ -977,6 +977,6 @@ extern int inflate_gunzip(int in, int out)
977 (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { 977 (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
978 bb_error_msg("Incorrect length"); 978 bb_error_msg("Incorrect length");
979 } 979 }
980 980
981 return 0; 981 return 0;
982} 982}