|
|
|
@ -92,21 +92,22 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */ |
|
|
|
|
/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ |
|
|
|
|
#define BMAX 15 /* maximum bit length of any code */ |
|
|
|
|
|
|
|
|
|
local int huft_build(b, n, s, d, e, t, m, hp, hn, v) |
|
|
|
|
uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ |
|
|
|
|
uInt n; /* number of codes (assumed <= 288) */ |
|
|
|
|
uInt s; /* number of simple-valued codes (0..s-1) */ |
|
|
|
|
const uIntf *d; /* list of base values for non-simple codes */ |
|
|
|
|
const uIntf *e; /* list of extra bits for non-simple codes */ |
|
|
|
|
inflate_huft * FAR *t; /* result: starting table */ |
|
|
|
|
uIntf *m; /* maximum lookup bits, returns actual */ |
|
|
|
|
inflate_huft *hp; /* space for trees */ |
|
|
|
|
uInt *hn; /* hufts used in space */ |
|
|
|
|
uIntf *v; /* working area: values in order of bit length */ |
|
|
|
|
local int huft_build( /* b, n, s, d, e, t, m, hp, hn, v) */ |
|
|
|
|
uIntf *b, /* code lengths in bits (all assumed <= BMAX) */ |
|
|
|
|
uInt n, /* number of codes (assumed <= 288) */ |
|
|
|
|
uInt s, /* number of simple-valued codes (0..s-1) */ |
|
|
|
|
const uIntf *d, /* list of base values for non-simple codes */ |
|
|
|
|
const uIntf *e, /* list of extra bits for non-simple codes */ |
|
|
|
|
inflate_huft * FAR *t, /* result: starting table */ |
|
|
|
|
uIntf *m, /* maximum lookup bits, returns actual */ |
|
|
|
|
inflate_huft *hp, /* space for trees */ |
|
|
|
|
uInt *hn, /* hufts used in space */ |
|
|
|
|
uIntf *v /* working area: values in order of bit length */ |
|
|
|
|
/* Given a list of code lengths and a maximum table size, make a set of
|
|
|
|
|
tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR |
|
|
|
|
if the given code set is incomplete (the tables are still built in this |
|
|
|
|
case), or Z_DATA_ERROR if the input is invalid. */ |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
uInt a; /* counter for codes of length k */ |
|
|
|
@ -292,12 +293,13 @@ uIntf *v; /* working area: values in order of bit length */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local int inflate_trees_bits(c, bb, tb, hp, z) |
|
|
|
|
uIntf *c; /* 19 code lengths */ |
|
|
|
|
uIntf *bb; /* bits tree desired/actual depth */ |
|
|
|
|
inflate_huft * FAR *tb; /* bits tree result */ |
|
|
|
|
inflate_huft *hp; /* space for trees */ |
|
|
|
|
z_streamp z; /* for messages */ |
|
|
|
|
local int inflate_trees_bits( /* c, bb, tb, hp, z) */ |
|
|
|
|
uIntf *c, /* 19 code lengths */ |
|
|
|
|
uIntf *bb, /* bits tree desired/actual depth */ |
|
|
|
|
inflate_huft * FAR *tb, /* bits tree result */ |
|
|
|
|
inflate_huft *hp, /* space for trees */ |
|
|
|
|
z_streamp z /* for messages */ |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
int r; |
|
|
|
|
uInt hn = 0; /* hufts used in space */ |
|
|
|
@ -319,16 +321,17 @@ z_streamp z; /* for messages */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) |
|
|
|
|
uInt nl; /* number of literal/length codes */ |
|
|
|
|
uInt nd; /* number of distance codes */ |
|
|
|
|
uIntf *c; /* that many (total) code lengths */ |
|
|
|
|
uIntf *bl; /* literal desired/actual bit depth */ |
|
|
|
|
uIntf *bd; /* distance desired/actual bit depth */ |
|
|
|
|
inflate_huft * FAR *tl; /* literal/length tree result */ |
|
|
|
|
inflate_huft * FAR *td; /* distance tree result */ |
|
|
|
|
inflate_huft *hp; /* space for trees */ |
|
|
|
|
z_streamp z; /* for messages */ |
|
|
|
|
local int inflate_trees_dynamic( /* nl, nd, c, bl, bd, tl, td, hp, z) */ |
|
|
|
|
uInt nl, /* number of literal/length codes */ |
|
|
|
|
uInt nd, /* number of distance codes */ |
|
|
|
|
uIntf *c, /* that many (total) code lengths */ |
|
|
|
|
uIntf *bl, /* literal desired/actual bit depth */ |
|
|
|
|
uIntf *bd, /* distance desired/actual bit depth */ |
|
|
|
|
inflate_huft * FAR *tl, /* literal/length tree result */ |
|
|
|
|
inflate_huft * FAR *td, /* distance tree result */ |
|
|
|
|
inflate_huft *hp, /* space for trees */ |
|
|
|
|
z_streamp z /* for messages */ |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
int r; |
|
|
|
|
uInt hn = 0; /* hufts used in space */ |
|
|
|
@ -397,12 +400,13 @@ local inflate_huft *fixed_td; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local int inflate_trees_fixed(bl, bd, tl, td, z) |
|
|
|
|
uIntf *bl; /* literal desired/actual bit depth */ |
|
|
|
|
uIntf *bd; /* distance desired/actual bit depth */ |
|
|
|
|
inflate_huft * FAR *tl; /* literal/length tree result */ |
|
|
|
|
inflate_huft * FAR *td; /* distance tree result */ |
|
|
|
|
z_streamp z; /* for memory allocation */ |
|
|
|
|
local int inflate_trees_fixed( /* bl, bd, tl, td, z) */ |
|
|
|
|
uIntf *bl, /* literal desired/actual bit depth */ |
|
|
|
|
uIntf *bd, /* distance desired/actual bit depth */ |
|
|
|
|
inflate_huft * FAR *tl, /* literal/length tree result */ |
|
|
|
|
inflate_huft * FAR *td, /* distance tree result */ |
|
|
|
|
z_streamp z /* for memory allocation */ |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
#ifdef BUILDFIXED |
|
|
|
|
/* build fixed tables if not already */ |
|
|
|
|