summaryrefslogtreecommitdiff
path: root/sys/lib/libz/inftrees.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2004-12-03 03:07:10 +0000
committerDamien Miller <djm@cvs.openbsd.org>2004-12-03 03:07:10 +0000
commitdad29962ca3f89344ac972180cab5a6e99472f77 (patch)
tree704705796f710d79b82d233ef44353891300dbaa /sys/lib/libz/inftrees.c
parentd96931260dc21ceb4f8d4e37df6f2bc6a29f98d4 (diff)
zlib-1.21 here too
Diffstat (limited to 'sys/lib/libz/inftrees.c')
-rw-r--r--sys/lib/libz/inftrees.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/lib/libz/inftrees.c b/sys/lib/libz/inftrees.c
index 542f300e1eb..ba3507df1ba 100644
--- a/sys/lib/libz/inftrees.c
+++ b/sys/lib/libz/inftrees.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: inftrees.c,v 1.11 2003/12/16 23:57:48 millert Exp $ */
+/* $OpenBSD: inftrees.c,v 1.12 2004/12/03 03:07:09 djm Exp $ */
/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2003 Mark Adler
+ * Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -10,7 +10,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
- " inflate 1.2.1 Copyright 1995-2003 Mark Adler ";
+ " inflate 1.2.2 Copyright 1995-2004 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
@@ -63,7 +63,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 66};
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 198};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -115,7 +115,15 @@ unsigned short FAR *work;
for (max = MAXBITS; max >= 1; max--)
if (count[max] != 0) break;
if (root > max) root = max;
- if (max == 0) return -1; /* no codes! */
+ if (max == 0) { /* no symbols to code at all */
+ this.op = (unsigned char)64; /* invalid code marker */
+ this.bits = (unsigned char)1;
+ this.val = (unsigned short)0;
+ *(*table)++ = this; /* make a table to force an error */
+ *(*table)++ = this;
+ *bits = 1;
+ return 0; /* no symbols, but wait for decoding to report error */
+ }
for (min = 1; min <= MAXBITS; min++)
if (count[min] != 0) break;
if (root < min) root = min;
@@ -296,7 +304,6 @@ unsigned short FAR *work;
drop = 0;
len = root;
next = *table;
- curr = root;
this.bits = (unsigned char)len;
}