aboutsummaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorrpjday <rpjday@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-07-20 19:02:24 +0000
committerrpjday <rpjday@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-07-20 19:02:24 +0000
commit07fc52ad31af17f1a303683950ca783b243fb1bd (patch)
tree7c45d6a5741adb652c047366dddf3a2e8ce62929 /archival/unzip.c
parentad4e1be1af5782b8bb05461788848fa2c4c7d2ca (diff)
downloadbusybox-w32-07fc52ad31af17f1a303683950ca783b243fb1bd.tar.gz
busybox-w32-07fc52ad31af17f1a303683950ca783b243fb1bd.tar.bz2
busybox-w32-07fc52ad31af17f1a303683950ca783b243fb1bd.zip
"formated" -> "formatted" throughout the code base.
git-svn-id: svn://busybox.net/trunk/busybox@15735 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 632cc8551..012f355e2 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -53,7 +53,7 @@ typedef union {
53 unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */ 53 unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */
54 unsigned short filename_len; /* 22-23 */ 54 unsigned short filename_len; /* 22-23 */
55 unsigned short extra_len; /* 24-25 */ 55 unsigned short extra_len; /* 24-25 */
56 } formated ATTRIBUTE_PACKED; 56 } formatted ATTRIBUTE_PACKED;
57} zip_header_t; 57} zip_header_t;
58 58
59static void unzip_skip(int fd, off_t skip) 59static void unzip_skip(int fd, off_t skip)
@@ -77,25 +77,25 @@ static void unzip_create_leading_dirs(char *fn)
77 77
78static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd) 78static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
79{ 79{
80 if (zip_header->formated.method == 0) { 80 if (zip_header->formatted.method == 0) {
81 /* Method 0 - stored (not compressed) */ 81 /* Method 0 - stored (not compressed) */
82 int size = zip_header->formated.ucmpsize; 82 int size = zip_header->formatted.ucmpsize;
83 if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) { 83 if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) {
84 bb_error_msg_and_die("Cannot complete extraction"); 84 bb_error_msg_and_die("Cannot complete extraction");
85 } 85 }
86 86
87 } else { 87 } else {
88 /* Method 8 - inflate */ 88 /* Method 8 - inflate */
89 inflate_init(zip_header->formated.cmpsize); 89 inflate_init(zip_header->formatted.cmpsize);
90 inflate_unzip(src_fd, dst_fd); 90 inflate_unzip(src_fd, dst_fd);
91 inflate_cleanup(); 91 inflate_cleanup();
92 /* Validate decompression - crc */ 92 /* Validate decompression - crc */
93 if (zip_header->formated.crc32 != (gunzip_crc ^ 0xffffffffL)) { 93 if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) {
94 bb_error_msg("Invalid compressed data--crc error"); 94 bb_error_msg("Invalid compressed data--crc error");
95 return 1; 95 return 1;
96 } 96 }
97 /* Validate decompression - size */ 97 /* Validate decompression - size */
98 if (zip_header->formated.ucmpsize != gunzip_bytes_out) { 98 if (zip_header->formatted.ucmpsize != gunzip_bytes_out) {
99 bb_error_msg("Invalid compressed data--length error"); 99 bb_error_msg("Invalid compressed data--length error");
100 return 1; 100 return 1;
101 } 101 }
@@ -232,27 +232,27 @@ int unzip_main(int argc, char **argv)
232 232
233 /* Read the file header */ 233 /* Read the file header */
234 xread(src_fd, zip_header.raw, 26); 234 xread(src_fd, zip_header.raw, 26);
235 zip_header.formated.version = SWAP_LE32(zip_header.formated.version); 235 zip_header.formatted.version = SWAP_LE32(zip_header.formatted.version);
236 zip_header.formated.flags = SWAP_LE32(zip_header.formated.flags); 236 zip_header.formatted.flags = SWAP_LE32(zip_header.formatted.flags);
237 zip_header.formated.method = SWAP_LE32(zip_header.formated.method); 237 zip_header.formatted.method = SWAP_LE32(zip_header.formatted.method);
238 zip_header.formated.modtime = SWAP_LE32(zip_header.formated.modtime); 238 zip_header.formatted.modtime = SWAP_LE32(zip_header.formatted.modtime);
239 zip_header.formated.moddate = SWAP_LE32(zip_header.formated.moddate); 239 zip_header.formatted.moddate = SWAP_LE32(zip_header.formatted.moddate);
240 zip_header.formated.crc32 = SWAP_LE32(zip_header.formated.crc32); 240 zip_header.formatted.crc32 = SWAP_LE32(zip_header.formatted.crc32);
241 zip_header.formated.cmpsize = SWAP_LE32(zip_header.formated.cmpsize); 241 zip_header.formatted.cmpsize = SWAP_LE32(zip_header.formatted.cmpsize);
242 zip_header.formated.ucmpsize = SWAP_LE32(zip_header.formated.ucmpsize); 242 zip_header.formatted.ucmpsize = SWAP_LE32(zip_header.formatted.ucmpsize);
243 zip_header.formated.filename_len = SWAP_LE32(zip_header.formated.filename_len); 243 zip_header.formatted.filename_len = SWAP_LE32(zip_header.formatted.filename_len);
244 zip_header.formated.extra_len = SWAP_LE32(zip_header.formated.extra_len); 244 zip_header.formatted.extra_len = SWAP_LE32(zip_header.formatted.extra_len);
245 if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) { 245 if ((zip_header.formatted.method != 0) && (zip_header.formatted.method != 8)) {
246 bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method); 246 bb_error_msg_and_die("Unsupported compression method %d", zip_header.formatted.method);
247 } 247 }
248 248
249 /* Read filename */ 249 /* Read filename */
250 free(dst_fn); 250 free(dst_fn);
251 dst_fn = xzalloc(zip_header.formated.filename_len + 1); 251 dst_fn = xzalloc(zip_header.formatted.filename_len + 1);
252 xread(src_fd, dst_fn, zip_header.formated.filename_len); 252 xread(src_fd, dst_fn, zip_header.formatted.filename_len);
253 253
254 /* Skip extra header bytes */ 254 /* Skip extra header bytes */
255 unzip_skip(src_fd, zip_header.formated.extra_len); 255 unzip_skip(src_fd, zip_header.formatted.extra_len);
256 256
257 if ((verbosity == v_list) && !list_header_done){ 257 if ((verbosity == v_list) && !list_header_done){
258 printf(" Length Date Time Name\n" 258 printf(" Length Date Time Name\n"
@@ -266,12 +266,12 @@ int unzip_main(int argc, char **argv)
266 i = 'n'; 266 i = 'n';
267 267
268 } else { /* Extract entry */ 268 } else { /* Extract entry */
269 total_size += zip_header.formated.ucmpsize; 269 total_size += zip_header.formatted.ucmpsize;
270 270
271 if (verbosity == v_list) { /* List entry */ 271 if (verbosity == v_list) { /* List entry */
272 unsigned int dostime = zip_header.formated.modtime | (zip_header.formated.moddate << 16); 272 unsigned int dostime = zip_header.formatted.modtime | (zip_header.formatted.moddate << 16);
273 printf("%9u %02u-%02u-%02u %02u:%02u %s\n", 273 printf("%9u %02u-%02u-%02u %02u:%02u %s\n",
274 zip_header.formated.ucmpsize, 274 zip_header.formatted.ucmpsize,
275 (dostime & 0x01e00000) >> 21, 275 (dostime & 0x01e00000) >> 21,
276 (dostime & 0x001f0000) >> 16, 276 (dostime & 0x001f0000) >> 16,
277 (((dostime & 0xfe000000) >> 25) + 1980) % 100, 277 (((dostime & 0xfe000000) >> 25) + 1980) % 100,
@@ -356,7 +356,7 @@ int unzip_main(int argc, char **argv)
356 overwrite = o_never; 356 overwrite = o_never;
357 case 'n': 357 case 'n':
358 /* Skip entry data */ 358 /* Skip entry data */
359 unzip_skip(src_fd, zip_header.formated.cmpsize); 359 unzip_skip(src_fd, zip_header.formatted.cmpsize);
360 break; 360 break;
361 361
362 case 'r': 362 case 'r':
@@ -376,7 +376,7 @@ int unzip_main(int argc, char **argv)
376 } 376 }
377 377
378 /* Data descriptor section */ 378 /* Data descriptor section */
379 if (zip_header.formated.flags & 4) { 379 if (zip_header.formatted.flags & 4) {
380 /* skip over duplicate crc, compressed size and uncompressed size */ 380 /* skip over duplicate crc, compressed size and uncompressed size */
381 unzip_skip(src_fd, 12); 381 unzip_skip(src_fd, 12);
382 } 382 }