summaryrefslogtreecommitdiff
path: root/drivers/net/bsd_comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bsd_comp.c')
-rw-r--r--drivers/net/bsd_comp.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c
index fb4098ed469e..bae1de1e7802 100644
--- a/drivers/net/bsd_comp.c
+++ b/drivers/net/bsd_comp.c
@@ -1,5 +1,5 @@
/*
- * Update: The Berkeley copyright was changed, and the change
+ * Update: The Berkeley copyright was changed, and the change
* is retroactive to all "true" BSD software (ie everything
* from UCB as opposed to other peoples code that just carried
* the same license). The new copyright doesn't clash with the
@@ -256,9 +256,9 @@ static int bsd_check (struct bsd_db *db) /* 1=output CLEAR */
db->in_count -= (db->in_count >> 2);
db->bytes_out -= (db->bytes_out >> 2);
}
-
+
db->checkpoint = db->in_count + CHECK_GAP;
-
+
if (db->max_ent >= db->maxmaxcode)
{
/* Reset the dictionary only if the ratio is worse,
@@ -274,7 +274,7 @@ static int bsd_check (struct bsd_db *db) /* 1=output CLEAR */
{
new_ratio /= db->bytes_out;
}
-
+
if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE)
{
bsd_clear (db);
@@ -293,7 +293,7 @@ static int bsd_check (struct bsd_db *db) /* 1=output CLEAR */
static void bsd_comp_stats (void *state, struct compstat *stats)
{
struct bsd_db *db = (struct bsd_db *) state;
-
+
stats->unc_bytes = db->uncomp_bytes;
stats->unc_packets = db->uncomp_count;
stats->comp_bytes = db->comp_bytes;
@@ -325,7 +325,7 @@ static void bsd_reset (void *state)
static void bsd_free (void *state)
{
struct bsd_db *db = state;
-
+
if (!db)
return;
@@ -468,7 +468,7 @@ static int bsd_init (void *state, unsigned char *options,
{
struct bsd_db *db = state;
int indx;
-
+
if ((opt_len != 3) || (options[0] != CI_BSD_COMPRESS) || (options[1] != 3)
|| (BSD_VERSION(options[2]) != BSD_CURRENT_VERSION)
|| (BSD_NBITS(options[2]) != db->maxbits)
@@ -500,9 +500,9 @@ static int bsd_init (void *state, unsigned char *options,
if (debug)
#endif
db->debug = 1;
-
+
bsd_reset(db);
-
+
return 1;
}
@@ -660,7 +660,7 @@ static int bsd_compress (void *state, unsigned char *rptr, unsigned char *obuf,
fcode = BSD_KEY (ent, c);
hval = BSD_HASH (ent, c, hshift);
dictp = dict_ptr (db, hval);
-
+
/* Validate and then check the entry. */
if (dictp->codem1 >= max_ent)
{
@@ -672,7 +672,7 @@ static int bsd_compress (void *state, unsigned char *rptr, unsigned char *obuf,
ent = dictp->codem1 + 1;
continue; /* found (prefix,suffix) */
}
-
+
/* continue probing until a match or invalid entry */
disp = (hval == 0) ? 1 : hval;
@@ -693,10 +693,10 @@ static int bsd_compress (void *state, unsigned char *rptr, unsigned char *obuf,
ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */
continue;
-
+
nomatch:
OUTPUT(ent); /* output the prefix */
-
+
/* code -> hashtable */
if (max_ent < db->maxmaxcode)
{
@@ -710,7 +710,7 @@ nomatch:
db->n_bits = ++n_bits;
mxcode = MAXCODE (n_bits);
}
-
+
/* Invalidate old hash table entry using
* this code, and then take it over.
*/
@@ -738,7 +738,7 @@ nomatch:
}
ent = c;
}
-
+
OUTPUT(ent); /* output the last code */
db->bytes_out += olen - PPP_HDRLEN - BSD_OVHD;
@@ -760,7 +760,7 @@ nomatch:
{
OUTPUT (CLEAR);
}
-
+
/*
* Pad dribble bits of last code with ones.
* Do not emit a completely useless byte of ones.
@@ -770,7 +770,7 @@ nomatch:
{
PUTBYTE((accm | (0xff << (bitno-8))) >> 24);
}
-
+
/*
* Increase code size if we would have without the packet
* boundary because the decompressor will do so.
@@ -856,7 +856,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
bitno = 32; /* 1st valid bit in accm */
n_bits = db->n_bits;
tgtbitno = 32 - n_bits; /* bitno when we have a code */
-
+
/*
* Save the address/control from the PPP header
* and then get the sequence number.
@@ -869,7 +869,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
ibuf += (PPP_HDRLEN + 2);
ilen = isize - (PPP_HDRLEN + 2);
-
+
/*
* Check the sequence number and give up if it differs from
* the value we're expecting.
@@ -897,7 +897,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
*wptr++ = adrs;
*wptr++ = ctrl;
*wptr++ = 0;
-
+
oldcode = CLEAR;
explen = 3;
@@ -934,7 +934,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
/*
* The dictionary must only be cleared at the end of a packet.
*/
-
+
if (incode == CLEAR)
{
if (ilen > 0)
@@ -945,7 +945,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
}
return DECOMP_FATALERROR; /* probably a bug */
}
-
+
bsd_clear(db);
break;
}
@@ -962,7 +962,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
}
return DECOMP_FATALERROR; /* probably a bug */
}
-
+
/* Special case for KwKwK string. */
if (incode > max_ent)
{
@@ -974,7 +974,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
finchar = incode;
extra = 0;
}
-
+
codelen = *(lens_ptr (db, finchar));
explen += codelen + extra;
if (explen > osize)
@@ -989,7 +989,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
}
return DECOMP_FATALERROR;
}
-
+
/*
* Decode this code and install it in the decompressed buffer.
*/
@@ -999,7 +999,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
while (finchar > LAST)
{
struct bsd_dict *dictp2 = dict_ptr (db, finchar);
-
+
dictp = dict_ptr (db, dictp2->cptr);
#ifdef DEBUG
if (--codelen <= 0 || dictp->codem1 != finchar-1)
@@ -1029,7 +1029,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
finchar = dictp->f.hs.prefix;
}
*--p = finchar;
-
+
#ifdef DEBUG
if (--codelen != 0)
{
@@ -1037,12 +1037,12 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
db->unit, codelen, incode, max_ent);
}
#endif
-
+
if (extra) /* the KwKwK case again */
{
*wptr++ = finchar;
}
-
+
/*
* If not first code in a packet, and
* if not out of code space, then allocate a new code.
@@ -1057,11 +1057,11 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
unsigned short *lens1, *lens2;
unsigned long fcode;
int hval, disp, indx;
-
+
fcode = BSD_KEY(oldcode,finchar);
hval = BSD_HASH(oldcode,finchar,db->hshift);
dictp = dict_ptr (db, hval);
-
+
/* look for a free hash table entry */
if (dictp->codem1 < max_ent)
{
@@ -1077,7 +1077,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
}
while (dictp->codem1 < max_ent);
}
-
+
/*
* Invalidate previous hash table entry
* assigned this code, and then take it over
@@ -1101,7 +1101,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
lens1 = lens_ptr (db, max_ent);
lens2 = lens_ptr (db, oldcode);
*lens1 = *lens2 + 1;
-
+
/* Expand code size if needed. */
if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode)
{
@@ -1127,7 +1127,7 @@ static int bsd_decompress (void *state, unsigned char *ibuf, int isize,
}
return explen;
}
-
+
/*************************************************************
* Table of addresses for the BSD compression module
*************************************************************/