summaryrefslogtreecommitdiffstats
path: root/lib/libz/inftrees.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-01-10 09:47:00 +0000
committerpeter <peter@FreeBSD.org>1999-01-10 09:47:00 +0000
commitb66130e248e76492a053cf3cb3fe84f580668361 (patch)
tree3caf4fc6f883e76264c0a8d3c81387ebbb685ebf /lib/libz/inftrees.c
parent9f86c0bf8cf1224d46bbefe1d308f2cc8186a79b (diff)
downloadFreeBSD-src-b66130e248e76492a053cf3cb3fe84f580668361.zip
FreeBSD-src-b66130e248e76492a053cf3cb3fe84f580668361.tar.gz
Import zlib 1.1.3 onto the vendor branch.
Obtained from: ftp.cdrom.com:/pub/infozip/zlib
Diffstat (limited to 'lib/libz/inftrees.c')
-rw-r--r--lib/libz/inftrees.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/libz/inftrees.c b/lib/libz/inftrees.c
index 9f85187..ef1e0b6 100644
--- a/lib/libz/inftrees.c
+++ b/lib/libz/inftrees.c
@@ -6,8 +6,12 @@
#include "zutil.h"
#include "inftrees.h"
+#if !defined(BUILDFIXED) && !defined(STDC)
+# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */
+#endif
+
const char inflate_copyright[] =
- " inflate 1.1.1 Copyright 1995-1998 Mark Adler ";
+ " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -17,8 +21,6 @@ const char inflate_copyright[] =
struct internal_state {int dummy;}; /* for buggy compilers */
/* simplify the use of the inflate_huft type with some defines */
-#define base more.Base
-#define next more.Next
#define exop word.what.Exop
#define bits word.what.Bits
@@ -232,11 +234,6 @@ uIntf *v; /* working area: values in order of bit length */
return Z_MEM_ERROR; /* not enough memory */
u[h] = q = hp + *hn;
*hn += z;
- if (t != Z_NULL) /* first table is returned result */
- {
- *t = q;
- t = Z_NULL;
- }
/* connect to last table, if there is one */
if (h)
@@ -244,10 +241,12 @@ uIntf *v; /* working area: values in order of bit length */
x[h] = i; /* save pattern for backing up */
r.bits = (Byte)l; /* bits to dump before this table */
r.exop = (Byte)j; /* bits in this table */
- r.next = q; /* pointer to this table */
- j = i >> (w - l); /* (get around Turbo C bug) */
+ j = i >> (w - l);
+ r.base = (uInt)(q - u[h-1] - j); /* offset to this table */
u[h-1][j] = r; /* connect to last table */
}
+ else
+ *t = q; /* first table is returned result */
}
/* set up table entry in r */
@@ -384,13 +383,17 @@ z_streamp z; /* for messages */
/* build fixed tables only once--keep them here */
+#ifdef BUILDFIXED
local int fixed_built = 0;
-#define FIXEDH 424 /* number of hufts used by fixed tables */
+#define FIXEDH 544 /* number of hufts used by fixed tables */
local inflate_huft fixed_mem[FIXEDH];
local uInt fixed_bl;
local uInt fixed_bd;
local inflate_huft *fixed_tl;
local inflate_huft *fixed_td;
+#else
+#include "inffixed.h"
+#endif
int inflate_trees_fixed(bl, bd, tl, td, z)
@@ -400,7 +403,8 @@ inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
z_streamp z; /* for memory allocation */
{
- /* build fixed tables if not already (multiple overlapped executions ok) */
+#ifdef BUILDFIXED
+ /* build fixed tables if not already */
if (!fixed_built)
{
int k; /* temporary variable */
@@ -426,7 +430,7 @@ z_streamp z; /* for memory allocation */
c[k] = 7;
for (; k < 288; k++)
c[k] = 8;
- fixed_bl = 7;
+ fixed_bl = 9;
huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
fixed_mem, &f, v);
@@ -442,6 +446,7 @@ z_streamp z; /* for memory allocation */
ZFREE(z, c);
fixed_built = 1;
}
+#endif
*bl = fixed_bl;
*bd = fixed_bd;
*tl = fixed_tl;
OpenPOWER on IntegriCloud