diff options
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 16 | ||||
-rw-r--r-- | archival/libunarchive/unzip.c | 16 | ||||
-rw-r--r-- | libbb/unzip.c | 16 |
3 files changed, 15 insertions, 33 deletions
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 69cc8198b..c28ca836c 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -123,22 +123,16 @@ static void abort_gzip(void) | |||
123 | 123 | ||
124 | static void make_crc_table(void) | 124 | static void make_crc_table(void) |
125 | { | 125 | { |
126 | unsigned long table_entry; /* crc shift register */ | 126 | const unsigned long poly = 0xedb88320; /* polynomial exclusive-or pattern */ |
127 | unsigned long poly = 0; /* polynomial exclusive-or pattern */ | 127 | unsigned short i; /* counter for all possible eight bit values */ |
128 | int i; /* counter for all possible eight bit values */ | ||
129 | int k; /* byte being shifted into crc apparatus */ | ||
130 | |||
131 | /* terms of polynomial defining this crc (except x^32): */ | ||
132 | static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; | ||
133 | 128 | ||
134 | crc_table = (unsigned long *) malloc(256 * sizeof(unsigned long)); | 129 | crc_table = (unsigned long *) malloc(256 * sizeof(unsigned long)); |
135 | 130 | ||
136 | /* Make exclusive-or pattern from polynomial (0xedb88320) */ | ||
137 | for (i = 0; i < sizeof(p)/sizeof(int); i++) | ||
138 | poly |= 1L << (31 - p[i]); | ||
139 | |||
140 | /* Compute and print table of CRC's, five per line */ | 131 | /* Compute and print table of CRC's, five per line */ |
141 | for (i = 0; i < 256; i++) { | 132 | for (i = 0; i < 256; i++) { |
133 | unsigned long table_entry; /* crc shift register */ | ||
134 | char k; /* byte being shifted into crc apparatus */ | ||
135 | |||
142 | table_entry = i; | 136 | table_entry = i; |
143 | /* The idea to initialize the register with the byte instead of | 137 | /* The idea to initialize the register with the byte instead of |
144 | * zero was stolen from Haruhiko Okumura's ar002 | 138 | * zero was stolen from Haruhiko Okumura's ar002 |
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c index 69cc8198b..c28ca836c 100644 --- a/archival/libunarchive/unzip.c +++ b/archival/libunarchive/unzip.c | |||
@@ -123,22 +123,16 @@ static void abort_gzip(void) | |||
123 | 123 | ||
124 | static void make_crc_table(void) | 124 | static void make_crc_table(void) |
125 | { | 125 | { |
126 | unsigned long table_entry; /* crc shift register */ | 126 | const unsigned long poly = 0xedb88320; /* polynomial exclusive-or pattern */ |
127 | unsigned long poly = 0; /* polynomial exclusive-or pattern */ | 127 | unsigned short i; /* counter for all possible eight bit values */ |
128 | int i; /* counter for all possible eight bit values */ | ||
129 | int k; /* byte being shifted into crc apparatus */ | ||
130 | |||
131 | /* terms of polynomial defining this crc (except x^32): */ | ||
132 | static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; | ||
133 | 128 | ||
134 | crc_table = (unsigned long *) malloc(256 * sizeof(unsigned long)); | 129 | crc_table = (unsigned long *) malloc(256 * sizeof(unsigned long)); |
135 | 130 | ||
136 | /* Make exclusive-or pattern from polynomial (0xedb88320) */ | ||
137 | for (i = 0; i < sizeof(p)/sizeof(int); i++) | ||
138 | poly |= 1L << (31 - p[i]); | ||
139 | |||
140 | /* Compute and print table of CRC's, five per line */ | 131 | /* Compute and print table of CRC's, five per line */ |
141 | for (i = 0; i < 256; i++) { | 132 | for (i = 0; i < 256; i++) { |
133 | unsigned long table_entry; /* crc shift register */ | ||
134 | char k; /* byte being shifted into crc apparatus */ | ||
135 | |||
142 | table_entry = i; | 136 | table_entry = i; |
143 | /* The idea to initialize the register with the byte instead of | 137 | /* The idea to initialize the register with the byte instead of |
144 | * zero was stolen from Haruhiko Okumura's ar002 | 138 | * zero was stolen from Haruhiko Okumura's ar002 |
diff --git a/libbb/unzip.c b/libbb/unzip.c index 69cc8198b..c28ca836c 100644 --- a/libbb/unzip.c +++ b/libbb/unzip.c | |||
@@ -123,22 +123,16 @@ static void abort_gzip(void) | |||
123 | 123 | ||
124 | static void make_crc_table(void) | 124 | static void make_crc_table(void) |
125 | { | 125 | { |
126 | unsigned long table_entry; /* crc shift register */ | 126 | const unsigned long poly = 0xedb88320; /* polynomial exclusive-or pattern */ |
127 | unsigned long poly = 0; /* polynomial exclusive-or pattern */ | 127 | unsigned short i; /* counter for all possible eight bit values */ |
128 | int i; /* counter for all possible eight bit values */ | ||
129 | int k; /* byte being shifted into crc apparatus */ | ||
130 | |||
131 | /* terms of polynomial defining this crc (except x^32): */ | ||
132 | static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; | ||
133 | 128 | ||
134 | crc_table = (unsigned long *) malloc(256 * sizeof(unsigned long)); | 129 | crc_table = (unsigned long *) malloc(256 * sizeof(unsigned long)); |
135 | 130 | ||
136 | /* Make exclusive-or pattern from polynomial (0xedb88320) */ | ||
137 | for (i = 0; i < sizeof(p)/sizeof(int); i++) | ||
138 | poly |= 1L << (31 - p[i]); | ||
139 | |||
140 | /* Compute and print table of CRC's, five per line */ | 131 | /* Compute and print table of CRC's, five per line */ |
141 | for (i = 0; i < 256; i++) { | 132 | for (i = 0; i < 256; i++) { |
133 | unsigned long table_entry; /* crc shift register */ | ||
134 | char k; /* byte being shifted into crc apparatus */ | ||
135 | |||
142 | table_entry = i; | 136 | table_entry = i; |
143 | /* The idea to initialize the register with the byte instead of | 137 | /* The idea to initialize the register with the byte instead of |
144 | * zero was stolen from Haruhiko Okumura's ar002 | 138 | * zero was stolen from Haruhiko Okumura's ar002 |