Commit 0eec8ef1 authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Make lib/inflate.c look remotely like ANSI C, so that it can be

properly checked with the rest of the kernel.
parent 50441791
...@@ -271,14 +271,15 @@ STATIC const int dbits = 6; /* bits in base distance lookup table */ ...@@ -271,14 +271,15 @@ STATIC const int dbits = 6; /* bits in base distance lookup table */
STATIC unsigned hufts; /* track memory usage */ STATIC unsigned hufts; /* track memory usage */
STATIC int huft_build(b, n, s, d, e, t, m) STATIC int huft_build(
unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ unsigned *b, /* code lengths in bits (all assumed <= BMAX) */
unsigned n; /* number of codes (assumed <= N_MAX) */ unsigned n, /* number of codes (assumed <= N_MAX) */
unsigned s; /* number of simple-valued codes (0..s-1) */ unsigned s, /* number of simple-valued codes (0..s-1) */
const ush *d; /* list of base values for non-simple codes */ const ush *d, /* list of base values for non-simple codes */
const ush *e; /* list of extra bits for non-simple codes */ const ush *e, /* list of extra bits for non-simple codes */
struct huft **t; /* result: starting table */ struct huft **t, /* result: starting table */
int *m; /* maximum lookup bits, returns actual */ int *m /* maximum lookup bits, returns actual */
)
/* Given a list of code lengths and a maximum table size, make a set of /* Given a list of code lengths and a maximum table size, make a set of
tables to decode that set of codes. Return zero on success, one if tables to decode that set of codes. Return zero on success, one if
the given code set is incomplete (the tables are still built in this the given code set is incomplete (the tables are still built in this
...@@ -489,8 +490,9 @@ DEBG("huft7 "); ...@@ -489,8 +490,9 @@ DEBG("huft7 ");
STATIC int huft_free(t) STATIC int huft_free(
struct huft *t; /* table to free */ struct huft *t /* table to free */
)
/* Free the malloc'ed tables built by huft_build(), which makes a linked /* Free the malloc'ed tables built by huft_build(), which makes a linked
list of the tables it made, with the links in a dummy first entry of list of the tables it made, with the links in a dummy first entry of
each table. */ each table. */
...@@ -510,9 +512,12 @@ struct huft *t; /* table to free */ ...@@ -510,9 +512,12 @@ struct huft *t; /* table to free */
} }
STATIC int inflate_codes(tl, td, bl, bd) STATIC int inflate_codes(
struct huft *tl, *td; /* literal/length and distance decoder tables */ struct huft *tl, /* literal/length decoder tables */
int bl, bd; /* number of bits decoded by tl[] and td[] */ struct huft *td, /* distance decoder tables */
int bl, /* number of bits decoded by tl[] */
int bd /* number of bits decoded by td[] */
)
/* inflate (decompress) the codes in a deflated (compressed) block. /* inflate (decompress) the codes in a deflated (compressed) block.
Return an error code or zero if it all goes ok. */ Return an error code or zero if it all goes ok. */
{ {
...@@ -619,7 +624,7 @@ int bl, bd; /* number of bits decoded by tl[] and td[] */ ...@@ -619,7 +624,7 @@ int bl, bd; /* number of bits decoded by tl[] and td[] */
STATIC int inflate_stored() STATIC int inflate_stored(void)
/* "decompress" an inflated type 0 (stored) block. */ /* "decompress" an inflated type 0 (stored) block. */
{ {
unsigned n; /* number of bytes in block */ unsigned n; /* number of bytes in block */
...@@ -675,7 +680,7 @@ DEBG("<stor"); ...@@ -675,7 +680,7 @@ DEBG("<stor");
STATIC int inflate_fixed() STATIC int inflate_fixed(void)
/* decompress an inflated type 1 (fixed Huffman codes) block. We should /* decompress an inflated type 1 (fixed Huffman codes) block. We should
either replace this with a custom decoder, or at least precompute the either replace this with a custom decoder, or at least precompute the
Huffman tables. */ Huffman tables. */
...@@ -729,7 +734,7 @@ DEBG("<fix"); ...@@ -729,7 +734,7 @@ DEBG("<fix");
STATIC int inflate_dynamic() STATIC int inflate_dynamic(void)
/* decompress an inflated type 2 (dynamic Huffman codes) block. */ /* decompress an inflated type 2 (dynamic Huffman codes) block. */
{ {
int i; /* temporary variables */ int i; /* temporary variables */
...@@ -907,8 +912,9 @@ DEBG("dyn7 "); ...@@ -907,8 +912,9 @@ DEBG("dyn7 ");
STATIC int inflate_block(e) STATIC int inflate_block(
int *e; /* last block flag */ int *e /* last block flag */
)
/* decompress an inflated block */ /* decompress an inflated block */
{ {
unsigned t; /* block type */ unsigned t; /* block type */
...@@ -954,7 +960,7 @@ int *e; /* last block flag */ ...@@ -954,7 +960,7 @@ int *e; /* last block flag */
STATIC int inflate() STATIC int inflate(void)
/* decompress an inflated entry */ /* decompress an inflated entry */
{ {
int e; /* last block flag */ int e; /* last block flag */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment