aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-05-24 04:46:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-05-24 04:46:18 +0200
commite98884b9bec7cca415f1813764741bf18b70e8cf (patch)
tree6710cbaff58a24ba8fc2a2e1aacd4f6cea623cbd
parent4e8ff73e20ed15e5552f960358f1e5bb4d25c44b (diff)
downloadbusybox-w32-e98884b9bec7cca415f1813764741bf18b70e8cf.tar.gz
busybox-w32-e98884b9bec7cca415f1813764741bf18b70e8cf.tar.bz2
busybox-w32-e98884b9bec7cca415f1813764741bf18b70e8cf.zip
unzip: tiny code shrink -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/unzip.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 868166bb1..5e8bac356 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -42,7 +42,7 @@ typedef union {
42 uint8_t raw[ZIP_HEADER_LEN]; 42 uint8_t raw[ZIP_HEADER_LEN];
43 struct { 43 struct {
44 uint16_t version; /* 0-1 */ 44 uint16_t version; /* 0-1 */
45 uint16_t flags; /* 2-3 */ 45 uint16_t zip_flags; /* 2-3 */
46 uint16_t method; /* 4-5 */ 46 uint16_t method; /* 4-5 */
47 uint16_t modtime; /* 6-7 */ 47 uint16_t modtime; /* 6-7 */
48 uint16_t moddate; /* 8-9 */ 48 uint16_t moddate; /* 8-9 */
@@ -66,7 +66,6 @@ struct BUG_zip_header_must_be_26_bytes {
66 66
67#define FIX_ENDIANNESS_ZIP(zip_header) do { \ 67#define FIX_ENDIANNESS_ZIP(zip_header) do { \
68 (zip_header).formatted.version = SWAP_LE16((zip_header).formatted.version ); \ 68 (zip_header).formatted.version = SWAP_LE16((zip_header).formatted.version ); \
69 (zip_header).formatted.flags = SWAP_LE16((zip_header).formatted.flags ); \
70 (zip_header).formatted.method = SWAP_LE16((zip_header).formatted.method ); \ 69 (zip_header).formatted.method = SWAP_LE16((zip_header).formatted.method ); \
71 (zip_header).formatted.modtime = SWAP_LE16((zip_header).formatted.modtime ); \ 70 (zip_header).formatted.modtime = SWAP_LE16((zip_header).formatted.modtime ); \
72 (zip_header).formatted.moddate = SWAP_LE16((zip_header).formatted.moddate ); \ 71 (zip_header).formatted.moddate = SWAP_LE16((zip_header).formatted.moddate ); \
@@ -491,11 +490,11 @@ int unzip_main(int argc, char **argv)
491 bb_error_msg_and_die("unsupported method %d", zip_header.formatted.method); 490 bb_error_msg_and_die("unsupported method %d", zip_header.formatted.method);
492 } 491 }
493#if !ENABLE_DESKTOP 492#if !ENABLE_DESKTOP
494 if (zip_header.formatted.flags & 0x0009) { 493 if (zip_header.formatted.zip_flags & SWAP_LE16(0x0009)) {
495 bb_error_msg_and_die("zip flags 1 and 8 are not supported"); 494 bb_error_msg_and_die("zip flags 1 and 8 are not supported");
496 } 495 }
497#else 496#else
498 if (zip_header.formatted.flags & 0x0001) { 497 if (zip_header.formatted.zip_flags & SWAP_LE16(0x0001)) {
499 /* 0x0001 - encrypted */ 498 /* 0x0001 - encrypted */
500 bb_error_msg_and_die("zip flag 1 (encryption) is not supported"); 499 bb_error_msg_and_die("zip flag 1 (encryption) is not supported");
501 } 500 }
@@ -503,7 +502,7 @@ int unzip_main(int argc, char **argv)
503 { 502 {
504 cdf_header_t cdf_header; 503 cdf_header_t cdf_header;
505 cdf_offset = read_next_cdf(cdf_offset, &cdf_header); 504 cdf_offset = read_next_cdf(cdf_offset, &cdf_header);
506 if (zip_header.formatted.flags & 0x0008) { 505 if (zip_header.formatted.zip_flags & SWAP_LE16(0x0008)) {
507 /* 0x0008 - streaming. [u]cmpsize can be reliably gotten 506 /* 0x0008 - streaming. [u]cmpsize can be reliably gotten
508 * only from Central Directory. See unzip_doc.txt */ 507 * only from Central Directory. See unzip_doc.txt */
509 zip_header.formatted.crc32 = cdf_header.formatted.crc32; 508 zip_header.formatted.crc32 = cdf_header.formatted.crc32;