]> git.ozlabs.org Git - ppp.git/blobdiff - netbsd-1.1/bsd-comp.c
updated
[ppp.git] / netbsd-1.1 / bsd-comp.c
index a86183beb1b0b2245f0c7e4c70d7f72abb1cd7ab..a5715e4897597ac5f232620e8cee71188e504c48 100644 (file)
@@ -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:
  *
 
 /*
  * 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 <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 +187,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
  */
@@ -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