-#define DEBG(x)
-#define DEBG1(x)
+#define DEBG(x)
+#define DEBG1(x)
/* Taken from /usr/src/linux/lib/inflate.c [unmodified]
Used for start32, 1/11/2000
James Hendricks, Dale Webster */
/* inflate.c -- Not copyrighted 1992 by Mark Adler
version c10p1, 10 January 1993 */
-/*
+/*
* Adapted for booting Linux by Hannu Savolainen 1993
- * based on gzip-1.0.3
+ * based on gzip-1.0.3
*
* Nicolas Pitre <nico@cam.org>, 1999/04/14 :
* Little mods for all variable to reside either into rodata or bss segments
chunks), otherwise the dynamic method is used. In the latter case, the
codes are customized to the probabilities in the current block, and so
can code it much better than the pre-determined fixed codes.
-
+
The Huffman codes themselves are decoded using a multi-level table
lookup, in order to maximize the speed of decoding plus the speed of
building the decoding tables. See the comments below that precede the
#include "gzip.h"
#define STATIC
#endif /* !STATIC */
-
+
#define slide window
/* Huffman code lookup table entry--this entry is four bytes for machines
/* Function prototypes */
-STATIC int huft_build OF((unsigned *, unsigned, unsigned,
+STATIC int huft_build OF((unsigned *, unsigned, unsigned,
const ush *, const ush *, struct huft **, int *));
STATIC int huft_free OF((struct huft *));
STATIC int inflate_codes OF((struct huft *, struct huft *, int, int));
/* Macros for inflate() bit peeking and grabbing.
The usage is:
-
+
NEEDBITS(j)
x = b & mask_bits[j];
DUMPBITS(j)
memzero(c, sizeof(c));
p = b; i = n;
do {
- Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
+ Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
n-i, *p));
c[*p]++; /* assume all entries <= BMAX */
p++; /* Can't combine with above line (Solaris bug) */
q = (--p)->v.t;
free((char*)p);
p = q;
- }
+ }
return 0;
}
hufts = 0;
malloc_mark(&mark);
if ((r = inflate_block(&e)) != 0) {
- malloc_release(&mark);
+ malloc_release(&mark);
return r;
}
malloc_release(&mark);
#define CRC_VALUE (crc ^ 0xffffffffL)
/*
- * Code to compute the CRC-32 table. Borrowed from
+ * Code to compute the CRC-32 table. Borrowed from
* gzip-1.0.3/makecrc.c.
*/
if ((flags & ORIG_NAME) != 0) {
/* Discard the old name */
while (get_byte() != 0) /* null */ ;
- }
+ }
/* Discard file comment if any */
if ((flags & COMMENT) != 0) {
}
return -1;
}
-
+
/* Get the crc and original length */
/* crc32 (see algorithm.doc)
* uncompressed input size modulo 2^32
orig_crc |= (ulg) get_byte() << 8;
orig_crc |= (ulg) get_byte() << 16;
orig_crc |= (ulg) get_byte() << 24;
-
+
orig_len = (ulg) get_byte();
orig_len |= (ulg) get_byte() << 8;
orig_len |= (ulg) get_byte() << 16;
orig_len |= (ulg) get_byte() << 24;
-
+
/* Validate decompression */
if (orig_crc != CRC_VALUE) {
error("crc error");