aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-02-09 04:49:17 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-02-09 04:49:17 +0000
commit1d21fb3c231a2be404f4571952e7def86d2576b3 (patch)
tree102e493da02976472b03095361b139bea020d394
parentcc616928d5e719c2f0ab301132f2651cc4f4419c (diff)
downloadbusybox-w32-1d21fb3c231a2be404f4571952e7def86d2576b3.tar.gz
busybox-w32-1d21fb3c231a2be404f4571952e7def86d2576b3.tar.bz2
busybox-w32-1d21fb3c231a2be404f4571952e7def86d2576b3.zip
Moved to libunarchive/unzip.c
-rw-r--r--archival/libunarchive/check_trailer_gzip.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/archival/libunarchive/check_trailer_gzip.c b/archival/libunarchive/check_trailer_gzip.c
deleted file mode 100644
index b30db71ae..000000000
--- a/archival/libunarchive/check_trailer_gzip.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * busybox gunzip trailing header handler
4 * Copyright Glenn McGrath 2002
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21
22#include <sys/types.h>
23#include <sys/wait.h>
24#include <signal.h>
25#include <stdlib.h>
26#include <string.h>
27#include <unistd.h>
28#include <fcntl.h>
29#include "config.h"
30#include "busybox.h"
31#include "unarchive.h"
32
33extern unsigned int gunzip_crc;
34extern unsigned int gunzip_bytes_out;
35extern unsigned char *bytebuffer;
36extern unsigned short bytebuffer_offset;
37extern unsigned short bytebuffer_size;
38//extern unsigned char *gunzip_in_buffer;
39//extern unsigned char gunzip_in_buffer_count;
40
41extern void check_trailer_gzip(int src_fd)
42{
43 unsigned int stored_crc = 0;
44 unsigned char count;
45
46 /* top up the input buffer with the rest of the trailer */
47 count = bytebuffer_size - bytebuffer_offset;
48 if (count < 8) {
49 xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
50 bytebuffer_size += 8 - count;
51 }
52 for (count = 0; count != 4; count++) {
53 stored_crc |= (bytebuffer[bytebuffer_offset] << (count * 8));
54 bytebuffer_offset++;
55 }
56
57 /* Validate decompression - crc */
58 if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
59 error_msg_and_die("crc error");
60 }
61
62 /* Validate decompression - size */
63 if (gunzip_bytes_out !=
64 (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
65 (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
66 error_msg_and_die("Incorrect length, but crc is correct");
67 }
68
69}