vserver 1.9.3
[linux-2.6.git] / lib / zlib_inflate / inftrees.c
index b0b58b6..874950e 100644 (file)
@@ -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;
 }