diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-03 10:57:25 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-03 10:57:25 +0000 |
commit | 9c60b290717e3ff1b9a8e09da4abe6f46964aa82 (patch) | |
tree | 4de7eb07ebba8da0f778d6e2ca468d24ae375cf3 | |
parent | 60bce4905cc50e3ec7ea90127823125e0d9acd03 (diff) | |
download | busybox-w32-9c60b290717e3ff1b9a8e09da4abe6f46964aa82.tar.gz busybox-w32-9c60b290717e3ff1b9a8e09da4abe6f46964aa82.tar.bz2 busybox-w32-9c60b290717e3ff1b9a8e09da4abe6f46964aa82.zip |
Use xread_char to save a few bytes, fix indenting of comments
-rw-r--r-- | archival/libunarchive/check_header_gzip.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c index e8bb8d547..d661df7cc 100644 --- a/archival/libunarchive/check_header_gzip.c +++ b/archival/libunarchive/check_header_gzip.c | |||
@@ -17,7 +17,7 @@ extern void check_header_gzip(int src_fd) | |||
17 | 17 | ||
18 | xread_all(src_fd, header.raw, 8); | 18 | xread_all(src_fd, header.raw, 8); |
19 | 19 | ||
20 | /* Check the compression method */ | 20 | /* Check the compression method */ |
21 | if (header.formated.method != 8) { | 21 | if (header.formated.method != 8) { |
22 | error_msg_and_die("Unknown compression method %d", | 22 | error_msg_and_die("Unknown compression method %d", |
23 | header.formated.method); | 23 | header.formated.method); |
@@ -27,41 +27,30 @@ extern void check_header_gzip(int src_fd) | |||
27 | /* bit 2 set: extra field present */ | 27 | /* bit 2 set: extra field present */ |
28 | unsigned char extra_short; | 28 | unsigned char extra_short; |
29 | 29 | ||
30 | extra_short = xread_char(src_fd); | 30 | extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8); |
31 | extra_short += xread_char(src_fd) << 8; | ||
32 | while (extra_short > 0) { | 31 | while (extra_short > 0) { |
33 | /* Ignore extra field */ | 32 | /* Ignore extra field */ |
34 | xread_char(src_fd); | 33 | xread_char(src_fd); |
35 | extra_short--; | 34 | extra_short--; |
36 | } | 35 | } |
37 | } | 36 | } |
38 | 37 | ||
39 | /* Discard original name if any */ | 38 | /* Discard original name if any */ |
40 | if (header.formated.flags & 0x08) { | 39 | if (header.formated.flags & 0x08) { |
41 | /* bit 3 set: original file name present */ | 40 | /* bit 3 set: original file name present */ |
42 | char tmp; | 41 | while(xread_char(src_fd) != 0); |
43 | |||
44 | do { | ||
45 | read(src_fd, &tmp, 1); | ||
46 | } while (tmp != 0); | ||
47 | } | 42 | } |
48 | 43 | ||
49 | /* Discard file comment if any */ | 44 | /* Discard file comment if any */ |
50 | if (header.formated.flags & 0x10) { | 45 | if (header.formated.flags & 0x10) { |
51 | /* bit 4 set: file comment present */ | 46 | /* bit 4 set: file comment present */ |
52 | char tmp; | 47 | while(xread_char(src_fd) != 0); |
53 | |||
54 | do { | ||
55 | read(src_fd, &tmp, 1); | ||
56 | } while (tmp != 0); | ||
57 | } | 48 | } |
58 | 49 | ||
59 | /* Read the header checksum */ | 50 | /* Read the header checksum */ |
60 | if (header.formated.flags & 0x02) { | 51 | if (header.formated.flags & 0x02) { |
61 | char tmp; | 52 | xread_char(src_fd); |
62 | 53 | xread_char(src_fd); | |
63 | read(src_fd, &tmp, 1); | ||
64 | read(src_fd, &tmp, 1); | ||
65 | } | 54 | } |
66 | 55 | ||
67 | return; | 56 | return; |