summaryrefslogtreecommitdiff
path: root/sys/net/bsd-comp.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-03 21:07:23 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-03 21:07:23 +0000
commit4f317e580dfce2348ec5cfc05dfde20ed8440910 (patch)
treeeb3b13b1292e732a4b08fa5272c6479c351c7f42 /sys/net/bsd-comp.c
parenta3761d430c4e4adef30c75ff09632e3f410acd58 (diff)
From NetBSD: 960217 merge
Diffstat (limited to 'sys/net/bsd-comp.c')
-rw-r--r--sys/net/bsd-comp.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/net/bsd-comp.c b/sys/net/bsd-comp.c
index efe0f02df17..74b90ce1416 100644
--- a/sys/net/bsd-comp.c
+++ b/sys/net/bsd-comp.c
@@ -1,4 +1,5 @@
-/* $NetBSD: bsd-comp.c,v 1.1 1995/07/04 06:28:17 paulus Exp $ */
+/* $OpenBSD: bsd-comp.c,v 1.2 1996/03/03 21:07:03 niklas Exp $ */
+/* $NetBSD: bsd-comp.c,v 1.2 1996/02/13 22:00:03 christos Exp $ */
/* Because this code is derived from the 4.3BSD compress source:
*
@@ -42,11 +43,12 @@
/*
* This version is for use with mbufs on BSD-derived systems.
*
- * $Id: bsd-comp.c,v 1.1 1995/10/18 08:53:05 deraadt Exp $
+ * $Id: bsd-comp.c,v 1.2 1996/03/03 21:07:03 niklas Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -188,6 +190,12 @@ struct compressor ppp_bsd_compress = {
#define RATIO_SCALE (1<<RATIO_SCALE_LOG)
#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG)
+static void bsd_clear __P((struct bsd_db *));
+static int bsd_check __P((struct bsd_db *));
+static void *bsd_alloc __P((u_char *, int, int));
+static int bsd_init __P((struct bsd_db *, u_char *, int, int, int, int,
+ int, int));
+
/*
* clear the dictionary
*/
@@ -411,7 +419,7 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
|| options[1] != CILEN_BSD_COMPRESS
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION
|| BSD_NBITS(options[2]) != db->maxbits
- || decomp && db->lens == NULL)
+ || (decomp && db->lens == NULL))
return 0;
if (decomp) {
@@ -481,11 +489,10 @@ bsd_compress(state, mret, mp, slen, maxolen)
struct bsd_dict *dictp;
u_char c;
int hval, disp, ent, ilen;
- struct mbuf *np;
u_char *rptr, *wptr;
u_char *cp_end;
int olen;
- struct mbuf *m, **mnp;
+ struct mbuf *m;
#define PUTBYTE(v) { \
++olen; \
@@ -831,7 +838,6 @@ bsd_decompress(state, cmp, dmpp)
struct mbuf *m, *dmp, *mret;
int adrs, ctrl, ilen;
int space, codelen, extra;
- struct mbuf *last;
/*
* Save the address/control from the PPP header
@@ -941,7 +947,7 @@ bsd_decompress(state, cmp, dmpp)
}
if (incode > max_ent + 2 || incode > db->maxmaxcode
- || incode > max_ent && oldcode == CLEAR) {
+ || (incode > max_ent && oldcode == CLEAR)) {
m_freem(mret);
if (db->debug) {
printf("bsd_decomp%d: bad code 0x%x oldcode=0x%x ",