Run through indent

This commit is contained in:
Glenn L McGrath 2002-08-22 13:21:26 +00:00
parent b37367aa77
commit d827e8b665

View File

@ -387,6 +387,7 @@ static ulg updcrc(uch *s, unsigned n)
static ulg crc = (ulg) 0xffffffffL; /* shift register contents */
register ulg c; /* temporary variable */
static unsigned long crc_32_tab[256];
if (crc_table_empty) {
unsigned long csr; /* crc shift register */
const unsigned long e = 0xedb88320L; /* polynomial exclusive-or pattern */
@ -901,7 +902,6 @@ static int longest_match(IPos cur_match)
register int len; /* length of current match */
int best_len = prev_length; /* best match length so far */
IPos limit =
strstart > (IPos) MAX_DIST ? strstart - (IPos) MAX_DIST : NIL;
/* Stop when cur_match becomes <= limit. To simplify the code,
* we prevent matches with the string of window index 0.
@ -921,8 +921,7 @@ static int longest_match(IPos cur_match)
if (prev_length >= good_match) {
chain_length >>= 2;
}
Assert(strstart <= window_size - MIN_LOOKAHEAD,
"insufficient lookahead");
Assert(strstart <= window_size - MIN_LOOKAHEAD, "insufficient lookahead");
do {
Assert(cur_match < strstart, "no future");
@ -951,8 +950,7 @@ static int longest_match(IPos cur_match)
} while (*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
scan < strend);
*++scan == *++match && *++scan == *++match && scan < strend);
len = MAX_MATCH - (int) (strend - scan);
scan = strend - MAX_MATCH;
@ -1007,7 +1005,6 @@ static void fill_window()
{
register unsigned n, m;
unsigned more =
(unsigned) (window_size - (ulg) lookahead - (ulg) strstart);
/* Amount of free space at the end of the window. */
@ -1100,8 +1097,7 @@ static ulg deflate()
match_length = lookahead;
/* Ignore a length 3 match if it is too distant: */
if (match_length == MIN_MATCH
&& strstart - match_start > TOO_FAR) {
if (match_length == MIN_MATCH && strstart - match_start > TOO_FAR) {
/* If prev_match is also MIN_MATCH, match_start is garbage
* but we will ignore the current match anyway.
*/
@ -1116,8 +1112,7 @@ static ulg deflate()
check_match(strstart - 1, prev_match, prev_length);
flush =
ct_tally(strstart - 1 - prev_match,
prev_length - MIN_MATCH);
ct_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH);
/* Insert in hash table all strings up to the end of the match.
* strstart-1 and strstart are already inserted.
@ -1201,9 +1196,6 @@ typedef struct dirent dir_type;
typedef RETSIGTYPE(*sig_type) (int);
/* ======================================================================== */
// int main (argc, argv)
// int argc;
// char **argv;
int gzip_main(int argc, char **argv)
{
int result;
@ -1224,8 +1216,15 @@ int gzip_main(int argc, char **argv)
force = 1;
break;
/* Ignore 1-9 (compression level) options */
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
case 'q':
break;
@ -1296,7 +1295,8 @@ int gzip_main(int argc, char **argv)
/* Open output file */
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
outFileNum = open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW);
outFileNum =
open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW);
#else
outFileNum = open(path, O_RDWR | O_CREAT | O_EXCL);
#endif
@ -1313,7 +1313,8 @@ int gzip_main(int argc, char **argv)
}
if (path == NULL && isatty(outFileNum) && force == 0) {
error_msg("compressed data not written to a terminal. Use -f to force compression.");
error_msg
("compressed data not written to a terminal. Use -f to force compression.");
free(path);
continue;
}
@ -1429,12 +1430,14 @@ typedef uch extra_bits_t;
/* extra bits for each length code */
static const extra_bits_t extra_lbits[LENGTH_CODES]
= { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
4, 4, 5, 5, 5, 5, 0 };
4, 4, 5, 5, 5, 5, 0
};
/* extra bits for each distance code */
static const extra_bits_t extra_dbits[D_CODES]
= { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 13, 13 };
10, 10, 11, 11, 12, 12, 13, 13
};
/* extra bits for each bit length code */
static const extra_bits_t extra_blbits[BL_CODES]
@ -1487,9 +1490,14 @@ static const extra_bits_t extra_blbits[BL_CODES]
#define REPZ_3_10 17
/* repeat a zero length 3-10 times (3 bits of repeat count) */
#define REPZ_11_138 18
/* repeat a zero length 11-138 times (7 bits of repeat count) *//* ===========================================================================
/* repeat a zero length 11-138 times (7 bits of repeat count) */
/* ===========================================================================
* Local data
*//* Data structure describing a single value and its code string. */ typedef struct ct_data {
*/
/* Data structure describing a single value and its code string. */
typedef struct ct_data {
union {
ush freq; /* frequency count */
ush code; /* bit string */
@ -1541,14 +1549,16 @@ typedef struct tree_desc {
static tree_desc l_desc =
{ dyn_ltree, static_ltree, extra_lbits, LITERALS + 1, L_CODES,
MAX_BITS, 0 };
MAX_BITS, 0
};
static tree_desc d_desc =
{ dyn_dtree, static_dtree, extra_dbits, 0, D_CODES, MAX_BITS, 0 };
static tree_desc bl_desc =
{ bl_tree, (ct_data *) 0, extra_blbits, 0, BL_CODES, MAX_BL_BITS,
0 };
0
};
static ush bl_count[MAX_BITS + 1];
@ -1902,12 +1912,10 @@ static void gen_bitlen(tree_desc *desc)
if (m > max_code)
continue;
if (tree[m].Len != (unsigned) bits) {
Trace(
(stderr, "code %d bits %d->%d\n", m, tree[m].Len,
Trace((stderr, "code %d bits %d->%d\n", m, tree[m].Len,
bits));
opt_len +=
((long) bits -
(long) tree[m].Len) * (long) tree[m].Freq;
((long) bits - (long) tree[m].Len) * (long) tree[m].Freq;
tree[m].Len = (ush) bits;
}
n--;
@ -2030,8 +2038,7 @@ static void build_tree(tree_desc *desc)
#ifdef DUMP_BL_TREE
if (tree == bl_tree) {
fprintf(stderr, "\nnode %d(%d), sons %d(%d) %d(%d)",
node, tree[node].Freq, n, tree[n].Freq, m,
tree[m].Freq);
node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
}
#endif
/* and insert the new node in the heap */
@ -2184,9 +2191,7 @@ static const int build_bl_tree()
}
/* Update opt_len to include the bit length tree and counts */
opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
Tracev(
(stderr, "\ndyn trees: dyn %ld, stat %ld", opt_len,
static_len));
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", opt_len, static_len));
return max_blindex;
}
@ -2200,8 +2205,7 @@ static void send_all_trees(int lcodes, int dcodes, int blcodes)
{
int rank; /* index in bl_order */
Assert(lcodes >= 257 && dcodes >= 1
&& blcodes >= 4, "not enough codes");
Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
Assert(lcodes <= L_CODES && dcodes <= D_CODES
&& blcodes <= BL_CODES, "too many codes");
Tracev((stderr, "\nbl counts: "));
@ -2242,9 +2246,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
Tracev((stderr, "\nlit data: dyn %ld, stat %ld", opt_len, static_len));
build_tree((tree_desc *) (&d_desc));
Tracev(
(stderr, "\ndist data: dyn %ld, stat %ld", opt_len,
static_len));
Tracev((stderr, "\ndist data: dyn %ld, stat %ld", opt_len, static_len));
/* At this point, opt_len and static_len are the total bit lengths of
* the compressed block data, excluding the tree representations.
*/
@ -2258,8 +2260,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
opt_lenb = (opt_len + 3 + 7) >> 3;
static_lenb = (static_len + 3 + 7) >> 3;
Trace(
(stderr,
Trace((stderr,
"\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ",
opt_lenb, opt_len, static_lenb, static_len, stored_len,
last_lit, last_dist));
@ -2271,8 +2272,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
* and if the zip file can be seeked (to rewrite the local header),
* the whole file is transformed into a stored file:
*/
if (stored_len <= opt_lenb && eof && compressed_len == 0L
&& seekable()) {
if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) {
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
if (buf == (char *) 0)
error_msg("block vanished");
@ -2297,15 +2297,13 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
} else if (static_lenb == opt_lenb) {
send_bits((STATIC_TREES << 1) + eof, 3);
compress_block((ct_data *) static_ltree,
(ct_data *) static_dtree);
compress_block((ct_data *) static_ltree, (ct_data *) static_dtree);
compressed_len += 3 + static_len;
} else {
send_bits((DYN_TREES << 1) + eof, 3);
send_all_trees(l_desc.max_code + 1, d_desc.max_code + 1,
max_blindex + 1);
compress_block((ct_data *) dyn_ltree,
(ct_data *) dyn_dtree);
compress_block((ct_data *) dyn_ltree, (ct_data *) dyn_dtree);
compressed_len += 3 + opt_len;
}
Assert(compressed_len == bits_sent, "bad compressed size");
@ -2363,8 +2361,7 @@ static int ct_tally(int dist, int lc)
(ulg) dyn_dtree[dcode].Freq * (5L + extra_dbits[dcode]);
}
out_length >>= 3;
Trace(
(stderr,
Trace((stderr,
"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
last_lit, last_dist, in_length, out_length,
100L - out_length * 100L / in_length));