X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fzlib_inflate%2Finftrees.c;h=874950ec48582e4b85c48ba6f1be7cb1f04cc659;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=b0b58b67eebc5b923005213d4d620a57963ddbb9;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/lib/zlib_inflate/inftrees.c b/lib/zlib_inflate/inftrees.c index b0b58b67e..874950ec4 100644 --- a/lib/zlib_inflate/inftrees.c +++ b/lib/zlib_inflate/inftrees.c @@ -374,21 +374,39 @@ int zlib_inflate_trees_dynamic( } -/* build fixed tables only once--keep them here */ -#include "inffixed.h" - - int zlib_inflate_trees_fixed( uInt *bl, /* literal desired/actual bit depth */ uInt *bd, /* distance desired/actual bit depth */ inflate_huft **tl, /* literal/length tree result */ inflate_huft **td, /* distance tree result */ + inflate_huft *hp, /* space for trees */ z_streamp z /* for memory allocation */ ) { - *bl = fixed_bl; - *bd = fixed_bd; - *tl = fixed_tl; - *td = fixed_td; + int i; /* temporary variable */ + unsigned l[288]; /* length list for huft_build */ + uInt *v; /* work area for huft_build */ + + /* set up literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + *bl = 9; + v = WS(z)->tree_work_area_1; + if ((i = huft_build(l, 288, 257, cplens, cplext, tl, bl, hp, &i, v)) != 0) + return i; + + /* set up distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code set */ + l[i] = 5; + *bd = 5; + if ((i = huft_build(l, 30, 0, cpdist, cpdext, td, bd, hp, &i, v)) > 1) + return i; + return Z_OK; }