aa: 85.1% -- replaced with aa.gz
*/
-#include "busybox.h"
+#include "libbb.h"
/* ===========================================================================
//#define DEBUG 1
/* Diagnostic functions */
#ifdef DEBUG
-# define Assert(cond,msg) {if(!(cond)) bb_error_msg(msg);}
+# define Assert(cond,msg) { if (!(cond)) bb_error_msg(msg); }
# define Trace(x) fprintf x
-# define Tracev(x) {if (verbose) fprintf x ;}
-# define Tracevv(x) {if (verbose > 1) fprintf x ;}
-# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-# define Tracecv(c,x) {if (verbose > 1 && (c)) fprintf x ;}
+# define Tracev(x) {if (verbose) fprintf x; }
+# define Tracevv(x) {if (verbose > 1) fprintf x; }
+# define Tracec(c,x) {if (verbose && (c)) fprintf x; }
+# define Tracecv(c,x) {if (verbose > 1 && (c)) fprintf x; }
#else
# define Assert(cond,msg)
# define Trace(x)
if (verbose > 1) {
bb_error_msg("\\[%d,%d]", start - match, length);
do {
- putc(G1.window[start++], stderr);
+ fputc(G1.window[start++], stderr);
} while (--length != 0);
}
}
#define BL_CODES 19
/* number of codes used to transfer the bit lengths */
-typedef uch extra_bits_t;
-
/* extra bits for each length code */
-static const extra_bits_t extra_lbits[LENGTH_CODES]= {
+static const uint8_t extra_lbits[LENGTH_CODES] ALIGN1 = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
4, 4, 5, 5, 5, 5, 0
};
/* extra bits for each distance code */
-static const extra_bits_t extra_dbits[D_CODES] = {
+static const uint8_t extra_dbits[D_CODES] ALIGN1 = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 13, 13
};
/* extra bits for each bit length code */
-static const extra_bits_t extra_blbits[BL_CODES] = {
+static const uint8_t extra_blbits[BL_CODES] ALIGN1 = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 };
/* number of codes at each bit length for an optimal tree */
-static const uch bl_order[BL_CODES] = {
+static const uint8_t bl_order[BL_CODES] ALIGN1 = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
#define STORED_BLOCK 0
typedef struct tree_desc {
ct_data *dyn_tree; /* the dynamic tree */
ct_data *static_tree; /* corresponding static tree or NULL */
- const extra_bits_t *extra_bits; /* extra bits for each code or NULL */
+ const uint8_t *extra_bits; /* extra bits for each code or NULL */
int extra_base; /* base index for extra_bits */
int elems; /* max number of elements in the tree */
int max_length; /* max bit length for the codes */
static void gen_bitlen(tree_desc * desc)
{
ct_data *tree = desc->dyn_tree;
- const extra_bits_t *extra = desc->extra_bits;
+ const uint8_t *extra = desc->extra_bits;
int base = desc->extra_base;
int max_code = desc->max_code;
int max_length = desc->max_length;
USE_DESKTOP(long long) int pack_gzip(void)
{
struct stat s;
-
+
clear_bufs();
s.st_ctime = 0;
fstat(STDIN_FILENO, &s);
unsigned opt;
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
- opt = getopt32(argc, argv, "cfv" USE_GUNZIP("d") "q123456789" );
- argv += optind;
+ opt = getopt32(argv, "cfv" USE_GUNZIP("d") "q123456789" );
option_mask32 &= 0x7; /* Clear -d, ignore -q, -0..9 */
//if (opt & 0x1) // -c
//if (opt & 0x2) // -f
return gunzip_main(argc, argv);
}
#endif
+ argv += optind;
PTR_TO_GLOBALS = xzalloc(sizeof(struct globals) + sizeof(struct globals2))
+ sizeof(struct globals);
ALLOC(ush, G1.prev, 1L << BITS);
/* Initialise the CRC32 table */
- G1.crc_32_tab = crc32_filltable(0);
+ G1.crc_32_tab = crc32_filltable(NULL, 0);
return bbunpack(argv, make_new_name_gzip, pack_gzip);
}