X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=netbsd-1.1%2Fbsd-comp.c;h=a5715e4897597ac5f232620e8cee71188e504c48;hp=a86183beb1b0b2245f0c7e4c70d7f72abb1cd7ab;hb=35104970a907227262c863d2b31cc7fa72b47535;hpb=7005827d79039deaac4646047fb08992e47d6b59 diff --git a/netbsd-1.1/bsd-comp.c b/netbsd-1.1/bsd-comp.c index a86183b..a5715e4 100644 --- a/netbsd-1.1/bsd-comp.c +++ b/netbsd-1.1/bsd-comp.c @@ -1,4 +1,4 @@ -/* $Id: bsd-comp.c,v 1.1 1995/12/11 05:17:05 paulus Exp $ */ +/* $Id: bsd-comp.c,v 1.3 1996/04/04 02:48:56 paulus Exp $ */ /* Because this code is derived from the 4.3BSD compress source: * @@ -41,12 +41,11 @@ /* * This version is for use with mbufs on BSD-derived systems. - * - * $Id: bsd-comp.c,v 1.1 1995/12/11 05:17:05 paulus Exp $ */ #include #include +#include #include #include #include @@ -188,6 +187,12 @@ struct compressor ppp_bsd_compress = { #define RATIO_SCALE (1<>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 */ @@ -309,7 +314,7 @@ bsd_alloc(options, opt_len, decomp) u_int newlen, hsize, hshift, maxmaxcode; struct bsd_db *db; - if (opt_len != CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS + if (opt_len < CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS || options[1] != CILEN_BSD_COMPRESS || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION) return NULL; @@ -407,7 +412,7 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp) { int i; - if (opt_len != CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS + if (opt_len < CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS || options[1] != CILEN_BSD_COMPRESS || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION || BSD_NBITS(options[2]) != db->maxbits @@ -481,11 +486,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 +835,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