summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authortron <tron@NetBSD.org>1998-11-03 15:49:39 +0000
committertron <tron@NetBSD.org>1998-11-03 15:49:39 +0000
commit873f0be1cdb5d00a64c9be1657408797696d5038 (patch)
tree31d36429a04dff17ef4b4eacf7f74a39d55288e5 /sys/lib
parente091e64548619c23a4342f72f3b087bce62533a6 (diff)
Sync with files in "src/lib/libz".
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libz/infcodes.c34
-rw-r--r--sys/lib/libz/infcodes.h4
-rw-r--r--sys/lib/libz/inffast.h4
3 files changed, 26 insertions, 16 deletions
diff --git a/sys/lib/libz/infcodes.c b/sys/lib/libz/infcodes.c
index 99ef776ef3b..03db1bf495c 100644
--- a/sys/lib/libz/infcodes.c
+++ b/sys/lib/libz/infcodes.c
@@ -1,7 +1,7 @@
-/* $NetBSD: infcodes.c,v 1.2 1997/05/20 14:41:57 gwr Exp $ */
+/* $NetBSD: infcodes.c,v 1.3 1998/11/03 15:49:39 tron Exp $ */
/* infcodes.c -- process literals and length/distance pairs
- * Copyright (C) 1995-1996 Mark Adler
+ * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -13,16 +13,10 @@
#include "inffast.h"
/* 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
-/* inflate codes private state */
-struct inflate_codes_state {
-
- /* mode */
- enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
START, /* x: set up for LEN */
LEN, /* i: get length/literal/eob next */
LENEXT, /* i: getting length extra (have base) */
@@ -33,7 +27,13 @@ struct inflate_codes_state {
WASH, /* o: got eob, possibly still output waiting */
END, /* x: got eob and all data flushed */
BADCODE} /* x: got error */
- mode; /* current inflate_codes mode */
+inflate_codes_mode;
+
+/* inflate codes private state */
+struct inflate_codes_state {
+
+ /* mode */
+ inflate_codes_mode mode; /* current inflate_codes mode */
/* mode dependent information */
uInt len;
@@ -145,7 +145,7 @@ int r;
if ((e & 64) == 0) /* next table */
{
c->sub.code.need = e;
- c->sub.code.tree = t->next;
+ c->sub.code.tree = t + t->base;
break;
}
if (e & 32) /* end of block */
@@ -183,7 +183,7 @@ int r;
if ((e & 64) == 0) /* next table */
{
c->sub.code.need = e;
- c->sub.code.tree = t->next;
+ c->sub.code.tree = t + t->base;
break;
}
c->mode = BADCODE; /* invalid code */
@@ -223,6 +223,13 @@ int r;
c->mode = START;
break;
case WASH: /* o: got eob, possibly more output */
+ if (k > 7) /* return unused byte, if any */
+ {
+ Assert(k < 16, "inflate_codes grabbed too many bytes")
+ k -= 8;
+ n++;
+ p--; /* can always return one */
+ }
FLUSH
if (s->read != s->write)
LEAVE
@@ -237,6 +244,9 @@ int r;
r = Z_STREAM_ERROR;
LEAVE
}
+#ifdef NEED_DUMMY_RETURN
+ return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
+#endif
}
diff --git a/sys/lib/libz/infcodes.h b/sys/lib/libz/infcodes.h
index 36cdcaa6587..8ed1474f13d 100644
--- a/sys/lib/libz/infcodes.h
+++ b/sys/lib/libz/infcodes.h
@@ -1,7 +1,7 @@
-/* $NetBSD: infcodes.h,v 1.2 1997/05/20 14:41:58 gwr Exp $ */
+/* $NetBSD: infcodes.h,v 1.3 1998/11/03 15:49:39 tron Exp $ */
/* infcodes.h -- header to use infcodes.c
- * Copyright (C) 1995-1996 Mark Adler
+ * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
diff --git a/sys/lib/libz/inffast.h b/sys/lib/libz/inffast.h
index 2e044af3f0f..f824f873b9d 100644
--- a/sys/lib/libz/inffast.h
+++ b/sys/lib/libz/inffast.h
@@ -1,7 +1,7 @@
-/* $NetBSD: inffast.h,v 1.2 1997/05/20 14:42:00 gwr Exp $ */
+/* $NetBSD: inffast.h,v 1.3 1998/11/03 15:49:39 tron Exp $ */
/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-1996 Mark Adler
+ * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/