summaryrefslogtreecommitdiff
path: root/bin/gzip
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-25 19:24:38 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-25 20:35:03 +0100
commita984eb367c032dbe2577f01238c3d1268526be70 (patch)
tree437fef40379b2758b129ccea39df3570fa2d145e /bin/gzip
parent8834571b202cf4dc9c649cfb096c213b6ecf1566 (diff)
Clang-tidy fixes
Diffstat (limited to 'bin/gzip')
-rw-r--r--bin/gzip/bits.c2
-rw-r--r--bin/gzip/deflate.c97
-rw-r--r--bin/gzip/gzip.c223
-rw-r--r--bin/gzip/gzip.h19
-rw-r--r--bin/gzip/inflate.c103
-rw-r--r--bin/gzip/trees.c94
-rw-r--r--bin/gzip/util.c87
-rw-r--r--bin/gzip/zip.c3
8 files changed, 241 insertions, 387 deletions
diff --git a/bin/gzip/bits.c b/bin/gzip/bits.c
index a3d31fbd..1a453648 100644
--- a/bin/gzip/bits.c
+++ b/bin/gzip/bits.c
@@ -177,7 +177,7 @@ void bi_windup()
*/
void copy_block(buf, len, header) char *buf; /* the input data */
unsigned len; /* its length */
-int header; /* true if block header must be written */
+int header; /* true if block header must be written */
{
bi_windup(); /* align on byte boundary */
diff --git a/bin/gzip/deflate.c b/bin/gzip/deflate.c
index 2f839851..790a85a6 100644
--- a/bin/gzip/deflate.c
+++ b/bin/gzip/deflate.c
@@ -102,8 +102,7 @@ static char rcsid[] = "$Id: deflate.c,v 1.1 2002/08/18 00:59:21 hpa Exp $";
error : cannot overlay window with tab_suffix and prev with tab_prefix0
#endif
#if HASH_BITS > BITS - 1
- error
- : cannot overlay head with tab_prefix1
+ error : cannot overlay head with tab_prefix1
#endif
#define HASH_SIZE (unsigned)(1 << HASH_BITS)
@@ -121,14 +120,14 @@ error : cannot overlay window with tab_suffix and prev with tab_prefix0
#ifndef TOO_FAR
#define TOO_FAR 4096
#endif
- /* Matches of length 3 are discarded if their distance exceeds TOO_FAR
- */
+ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR
+ */
- /* ===========================================================================
- * Local data used by the "longest match" routines.
- */
+ /* ===========================================================================
+ * Local data used by the "longest match" routines.
+ */
- typedef ush Pos;
+ typedef ush Pos;
typedef unsigned IPos;
/* A Pos is an index in the character window. We use short instead of int to
* save space in the various tables. IPos is used only for parameter passing.
@@ -213,7 +212,7 @@ unsigned good_match;
typedef struct config {
ush good_length; /* reduce lazy search above this match length */
- ush max_lazy; /* do not perform lazy search above this match length */
+ ush max_lazy; /* do not perform lazy search above this match length */
ush nice_length; /* quit search above this match length */
ush max_chain;
} config;
@@ -278,9 +277,9 @@ local void check_match OF((IPos start, IPos match, int length));
* input characters and the first MIN_MATCH bytes of s are valid
* (except for the last MIN_MATCH-1 bytes of the input file).
*/
-#define INSERT_STRING(s, match_head) \
- (UPDATE_HASH(ins_h, window[(s) + MIN_MATCH - 1]), \
- prev[(s) & WMASK] = (match_head) = head[ins_h], head[ins_h] = (s))
+#define INSERT_STRING(s, match_head) \
+ (UPDATE_HASH(ins_h, window[(s) + MIN_MATCH - 1]), prev[(s) & WMASK] = (match_head) = head[ins_h], \
+ head[ins_h] = (s))
/* ===========================================================================
* Initialize the "longest match" routines for a new file
@@ -319,8 +318,7 @@ void lm_init(int pack_level, ush *flags)
match_init(); /* initialize the asm code */
#endif
- lookahead = read_buf((char *)window,
- sizeof(int) <= 2 ? (unsigned)WSIZE : 2 * WSIZE);
+ lookahead = read_buf((char *)window, sizeof(int) <= 2 ? (unsigned)WSIZE : 2 * WSIZE);
if (lookahead == 0 || lookahead == (unsigned)EOF) {
eofile = 1, lookahead = 0;
@@ -362,8 +360,7 @@ IPos cur_match; /* current match */
register uch *match; /* matched string */
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;
+ 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.
*/
@@ -393,8 +390,7 @@ error:
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");
@@ -407,8 +403,7 @@ error:
/* This code assumes sizeof(unsigned short) == 2. Do not use
* UNALIGNED_OK if your compiler uses a different size.
*/
- if (*(ush *)(match + best_len - 1) != scan_end ||
- *(ush *)match != scan_start)
+ if (*(ush *)(match + best_len - 1) != scan_end || *(ush *)match != scan_start)
continue;
/* It is not necessary to compare scan[2] and match[2] since
@@ -423,16 +418,13 @@ error:
*/
scan++, match++;
do {
- } while (*(ush *)(scan += 2) == *(ush *)(match += 2) &&
- *(ush *)(scan += 2) == *(ush *)(match += 2) &&
- *(ush *)(scan += 2) == *(ush *)(match += 2) &&
- *(ush *)(scan += 2) == *(ush *)(match += 2) &&
+ } while (*(ush *)(scan += 2) == *(ush *)(match += 2) && *(ush *)(scan += 2) == *(ush *)(match += 2) &&
+ *(ush *)(scan += 2) == *(ush *)(match += 2) && *(ush *)(scan += 2) == *(ush *)(match += 2) &&
scan < strend);
/* The funny "do {}" generates better code on most compilers */
/* Here, scan <= window+strstart+257 */
- Assert(scan <= window + (unsigned)(window_size - 1),
- "wild scan");
+ Assert(scan <= window + (unsigned)(window_size - 1), "wild scan");
if (*scan == *match)
scan++;
@@ -441,8 +433,7 @@ error:
#else /* UNALIGNED_OK */
- if (match[best_len] != scan_end ||
- match[best_len - 1] != scan_end1 || *match != *scan ||
+ if (match[best_len] != scan_end || match[best_len - 1] != scan_end1 || *match != *scan ||
*++match != scan[1])
continue;
@@ -458,10 +449,8 @@ error:
* comparison; the 256th check will be made at strstart+258.
*/
do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
+ } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match &&
scan < strend);
len = MAX_MATCH - (int)(strend - scan);
@@ -481,8 +470,7 @@ error:
scan_end = scan[best_len];
#endif
}
- } while ((cur_match = prev[cur_match & WMASK]) > limit &&
- --chain_length != 0);
+ } while ((cur_match = prev[cur_match & WMASK]) > limit && --chain_length != 0);
return best_len;
}
@@ -496,10 +484,8 @@ local void check_match(start, match, length) IPos start, match;
int length;
{
/* check that the match is indeed a match */
- if (memcmp((char *)window + match, (char *)window + start, length) !=
- EQUAL) {
- fprintf(stderr, " start %d, match %d, length %d\n", start,
- match, length);
+ if (memcmp((char *)window + match, (char *)window + start, length) != EQUAL) {
+ fprintf(stderr, " start %d, match %d, length %d\n", start, match, length);
error("invalid match");
}
if (verbose > 1) {
@@ -524,8 +510,7 @@ int length;
local void fill_window()
{
register unsigned n, m;
- unsigned more =
- (unsigned)(window_size - (ulg)lookahead - (ulg)strstart);
+ unsigned more = (unsigned)(window_size - (ulg)lookahead - (ulg)strstart);
/* Amount of free space at the end of the window. */
/* If the window is almost full and there is insufficient lookahead,
@@ -540,8 +525,7 @@ local void fill_window()
/* By the IN assertion, the window is not empty so we can't
* confuse more == 0 with more == 64K on a 16 bit machine.
*/
- Assert(window_size == (ulg)2 * WSIZE,
- "no sliding with BIG_MEM");
+ Assert(window_size == (ulg)2 * WSIZE, "no sliding with BIG_MEM");
memcpy((char *)window, (char *)window + WSIZE, (unsigned)WSIZE);
match_start -= WSIZE;
@@ -577,10 +561,8 @@ local void fill_window()
* Flush the current block, with given end-of-file flag.
* IN assertion: strstart is set to the end of the current match.
*/
-#define FLUSH_BLOCK(eof) \
- flush_block(block_start >= 0L ? \
- (char *)&window[(unsigned)block_start] : \
- (char *)NULL, \
+#define FLUSH_BLOCK(eof) \
+ flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start] : (char *)NULL, \
(long)strstart - block_start, (eof))
/* ===========================================================================
@@ -619,8 +601,7 @@ local ulg deflate_fast()
if (match_length >= MIN_MATCH) {
check_match(strstart, match_start, match_length);
- flush = ct_tally(strstart - match_start,
- match_length - MIN_MATCH);
+ flush = ct_tally(strstart - match_start, match_length - MIN_MATCH);
lookahead -= match_length;
@@ -681,10 +662,10 @@ local ulg deflate_fast()
*/
ulg deflate()
{
- IPos hash_head; /* head of hash chain */
- IPos prev_match; /* previous match */
- int flush; /* set if current block must be flushed */
- int match_available = 0; /* set if previous match exists */
+ IPos hash_head; /* head of hash chain */
+ IPos prev_match; /* previous match */
+ int flush; /* set if current block must be flushed */
+ int match_available = 0; /* set if previous match exists */
register unsigned match_length = MIN_MATCH - 1; /* length of best match
*/
#ifdef DEBUG
@@ -706,8 +687,7 @@ ulg deflate()
prev_length = match_length, prev_match = match_start;
match_length = MIN_MATCH - 1;
- if (hash_head != NIL && prev_length < max_lazy_match &&
- strstart - hash_head <= MAX_DIST) {
+ if (hash_head != NIL && prev_length < max_lazy_match && strstart - hash_head <= MAX_DIST) {
/* To simplify the code, we prevent matches with the
* string of window index 0 (in particular we have to
* avoid a match of the string with itself at the start
@@ -719,8 +699,7 @@ 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.
@@ -734,8 +713,7 @@ ulg deflate()
if (prev_length >= MIN_MATCH && match_length <= prev_length) {
check_match(strstart - 1, prev_match, prev_length);
- flush = ct_tally(strstart - 1 - prev_match,
- prev_length - MIN_MATCH);
+ flush = 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.
@@ -779,8 +757,7 @@ ulg deflate()
strstart++;
lookahead--;
}
- Assert(strstart <= isize && lookahead <= isize,
- "a bit too far");
+ Assert(strstart <= isize && lookahead <= isize, "a bit too far");
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
diff --git a/bin/gzip/gzip.c b/bin/gzip/gzip.c
index b0e20bb1..919ab7a2 100644
--- a/bin/gzip/gzip.c
+++ b/bin/gzip/gzip.c
@@ -14,23 +14,21 @@
#include <stdio.h> // for fprintf, stderr, perror, fileno, stdin, stdout
#include <string.h> // for strcpy, strcmp, strlen, strcat, memcmp, strncmp
-static char *license_msg[] = {
- " Copyright (C) 1992-1993 Jean-loup Gailly",
- " This program is free software; you can redistribute it and/or modify",
- " it under the terms of the GNU General Public License as published by",
- " the Free Software Foundation; either version 2, or (at your option)",
- " any later version.",
- "",
- " This program is distributed in the hope that it will be useful,",
- " but WITHOUT ANY WARRANTY; without even the implied warranty of",
- " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
- " GNU General Public License for more details.",
- "",
- " You should have received a copy of the GNU General Public License",
- " along with this program; if not, write to the Free Software",
- " Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.",
- 0
-};
+static char *license_msg[] = { " Copyright (C) 1992-1993 Jean-loup Gailly",
+ " This program is free software; you can redistribute it and/or modify",
+ " it under the terms of the GNU General Public License as published by",
+ " the Free Software Foundation; either version 2, or (at your option)",
+ " any later version.",
+ "",
+ " This program is distributed in the hope that it will be useful,",
+ " but WITHOUT ANY WARRANTY; without even the implied warranty of",
+ " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
+ " GNU General Public License for more details.",
+ "",
+ " You should have received a copy of the GNU General Public License",
+ " along with this program; if not, write to the Free Software",
+ " Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.",
+ 0 };
/* Compress files with zip algorithm and 'compress' interface.
* See usage() and help() functions below for all options.
@@ -98,23 +96,23 @@ int decompress_wanted;
int decompress; /* decompress (-d) */
#define decompress_wanted decompress
#endif
-int force; /* don't ask questions, compress links (-f) */
-int no_name = -1; /* don't save or restore the original file name */
-int no_time = -1; /* don't save or restore the original file time */
-int verbose; /* be verbose (-v) */
-int quiet; /* be very quiet (-q) */
-int test; /* test .gz file integrity */
-int foreground; /* set if program run in foreground */
-char *progname; /* program name */
-int method = DEFLATED; /* compression method */
-int exit_code = OK; /* program exit code */
-int save_orig_name; /* set if original name must be saved */
-int last_member; /* set for .zip and .Z files */
-int part_nb; /* number of parts in .gz file */
-time_t time_stamp; /* original time stamp (modification time) */
-long ifile_size; /* input file size, -1 for devices (debug only) */
-char *env; /* contents of GZIP env variable */
-char **args = NULL; /* argv pointer if GZIP env variable defined */
+int force; /* don't ask questions, compress links (-f) */
+int no_name = -1; /* don't save or restore the original file name */
+int no_time = -1; /* don't save or restore the original file time */
+int verbose; /* be verbose (-v) */
+int quiet; /* be very quiet (-q) */
+int test; /* test .gz file integrity */
+int foreground; /* set if program run in foreground */
+char *progname; /* program name */
+int method = DEFLATED; /* compression method */
+int exit_code = OK; /* program exit code */
+int save_orig_name; /* set if original name must be saved */
+int last_member; /* set for .zip and .Z files */
+int part_nb; /* number of parts in .gz file */
+time_t time_stamp; /* original time stamp (modification time) */
+long ifile_size; /* input file size, -1 for devices (debug only) */
+char *env; /* contents of GZIP env variable */
+char **args = NULL; /* argv pointer if GZIP env variable defined */
char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */
int z_len; /* strlen(z_suffix) */
@@ -167,39 +165,36 @@ local void reset_times OF((char *name, struct stat *statb));
/* ======================================================================== */
local void usage()
{
- fprintf(stderr, "usage: %s [-cdfhlLnNtvV19] [-S suffix] [file ...]\n",
- progname);
+ fprintf(stderr, "usage: %s [-cdfhlLnNtvV19] [-S suffix] [file ...]\n", progname);
}
/* ======================================================================== */
local void help()
{
- static char *help_msg[] = {
- " -c --stdout write on standard output, keep original files unchanged",
- " -d --decompress decompress",
- " -f --force force overwrite of output file and compress links",
- " -h --help give this help",
- " -L --license display software license",
+ static char *help_msg[] = { " -c --stdout write on standard output, keep original files unchanged",
+ " -d --decompress decompress",
+ " -f --force force overwrite of output file and compress links",
+ " -h --help give this help",
+ " -L --license display software license",
#ifdef UNDOCUMENTED
- " -m --no-time do not save or restore the original modification time",
- " -M --time save or restore the original modification time",
+ " -m --no-time do not save or restore the original modification time",
+ " -M --time save or restore the original modification time",
#endif
- " -n --no-name do not save or restore the original name and time stamp",
- " -N --name save or restore the original name and time stamp",
- " -q --quiet suppress all warnings",
- " -S .suf --suffix .suf use suffix .suf on compressed files",
- " -t --test test compressed file integrity",
- " -v --verbose verbose mode",
- " -V --version display version number",
+ " -n --no-name do not save or restore the original name and time stamp",
+ " -N --name save or restore the original name and time stamp",
+ " -q --quiet suppress all warnings",
+ " -S .suf --suffix .suf use suffix .suf on compressed files",
+ " -t --test test compressed file integrity",
+ " -v --verbose verbose mode",
+ " -V --version display version number",
#ifdef SUPPORT_ZIP
- " -1 --fast compress faster",
- " -9 --best compress better",
- " file... files to (de)compress. If none given, use standard input.",
+ " -1 --fast compress faster",
+ " -9 --best compress better",
+ " file... files to (de)compress. If none given, use standard input.",
#else
- " file... files to decompress. If none given, use standard input.",
+ " file... files to decompress. If none given, use standard input.",
#endif
- 0
- };
+ 0 };
char **p = help_msg;
fprintf(stderr, "%s %s (%s)\n", progname, VERSION, REVDATE);
@@ -280,8 +275,7 @@ int main(int argc, char **argv)
strncpy(z_suffix, Z_SUFFIX, sizeof(z_suffix) - 1);
z_len = strlen(z_suffix);
- while ((optc = getopt(argc, argv, "cdfhH?LmMnNqrS:tvV123456789")) !=
- EOF) {
+ while ((optc = getopt(argc, argv, "cdfhH?LmMnNqrS:tvV123456789")) != EOF) {
switch (optc) {
case 'c':
to_stdout = 1;
@@ -356,9 +350,7 @@ int main(int argc, char **argv)
#ifndef SUPPORT_ZIP
if (!decompress_wanted) {
- fprintf(stderr,
- "%s: this version does not support compression\n",
- progname);
+ fprintf(stderr, "%s: this version does not support compression\n", progname);
do_exit(ERROR);
}
#endif
@@ -374,8 +366,7 @@ int main(int argc, char **argv)
file_count = argc - optind;
if ((z_len == 0 && !decompress) || z_len > MAX_SUFFIX) {
- fprintf(stderr, "%s: incorrect suffix '%s'\n", progname,
- optarg);
+ fprintf(stderr, "%s: incorrect suffix '%s'\n", progname, optarg);
do_exit(ERROR);
}
@@ -418,10 +409,8 @@ local void treat_stdin()
*
* Here we use the --force option to get the other behavior.
*/
- fprintf(stderr,
- "%s: compressed data not %s a terminal. Use -f to force %scompression.\n",
- progname, decompress ? "read from" : "written to",
- decompress ? "de" : "");
+ fprintf(stderr, "%s: compressed data not %s a terminal. Use -f to force %scompression.\n", progname,
+ decompress ? "read from" : "written to", decompress ? "de" : "");
fprintf(stderr, "For help, type: %s -h\n", progname);
do_exit(ERROR);
}
@@ -472,13 +461,11 @@ local void treat_stdin()
fprintf(stderr, " OK\n");
} else if (!decompress) {
- display_ratio(bytes_in - (bytes_out - header_bytes),
- bytes_in, stderr);
+ display_ratio(bytes_in - (bytes_out - header_bytes), bytes_in, stderr);
fprintf(stderr, "\n");
#ifdef DISPLAY_STDIN_RATIO
} else {
- display_ratio(bytes_out - (bytes_in - header_bytes),
- bytes_out, stderr);
+ display_ratio(bytes_out - (bytes_in - header_bytes), bytes_out, stderr);
fprintf(stderr, "\n");
#endif
}
@@ -504,19 +491,15 @@ local void treat_file(char *iname)
/* If the input name is that of a directory, recurse or ignore: */
if (S_ISDIR(istat.st_mode)) {
- WARN((stderr, "%s: %s is a directory -- ignored\n", progname,
- ifname));
+ WARN((stderr, "%s: %s is a directory -- ignored\n", progname, ifname));
return;
}
if (!S_ISREG(istat.st_mode)) {
- WARN((stderr,
- "%s: %s is not a directory or a regular file - ignored\n",
- progname, ifname));
+ WARN((stderr, "%s: %s is not a directory or a regular file - ignored\n", progname, ifname));
return;
}
if (istat.st_nlink > 1 && !to_stdout && !force) {
- WARN((stderr, "%s: %s has %d other link%c -- unchanged\n",
- progname, ifname, (int)istat.st_nlink - 1,
+ WARN((stderr, "%s: %s has %d other link%c -- unchanged\n", progname, ifname, (int)istat.st_nlink - 1,
istat.st_nlink > 2 ? 's' : ' '));
return;
}
@@ -568,8 +551,7 @@ local void treat_file(char *iname)
return;
if (!decompress && save_orig_name && !verbose && !quiet) {
- fprintf(stderr, "%s: %s compressed to %s\n", progname,
- ifname, ofname);
+ fprintf(stderr, "%s: %s compressed to %s\n", progname, ifname, ofname);
}
}
/* Keep the name even if not truncated except with --no-name: */
@@ -578,9 +560,7 @@ local void treat_file(char *iname)
if (verbose) {
fprintf(stderr, "%s:\t%s", ifname,
- (int)strlen(ifname) >= 15 ?
- "" :
- ((int)strlen(ifname) >= 7 ? "\t" : "\t\t"));
+ (int)strlen(ifname) >= 15 ? "" : ((int)strlen(ifname) >= 7 ? "\t" : "\t\t"));
}
/* Actually do the compression/decompression. Loop over zipped members.
@@ -614,11 +594,9 @@ local void treat_file(char *iname)
if (test) {
fprintf(stderr, " OK");
} else if (decompress) {
- display_ratio(bytes_out - (bytes_in - header_bytes),
- bytes_out, stderr);
+ display_ratio(bytes_out - (bytes_in - header_bytes), bytes_out, stderr);
} else {
- display_ratio(bytes_in - (bytes_out - header_bytes),
- bytes_in, stderr);
+ display_ratio(bytes_in - (bytes_out - header_bytes), bytes_in, stderr);
}
if (!test && !to_stdout) {
fprintf(stderr, " -- replaced with %s", ofname);
@@ -677,8 +655,7 @@ local int create_outfile()
if (decompress) {
/* name might be too long if an original name was saved
*/
- WARN((stderr, "%s: %s: warning, name truncated\n",
- progname, ofname));
+ WARN((stderr, "%s: %s: warning, name truncated\n", progname, ofname));
return OK;
}
close(ofd);
@@ -717,8 +694,7 @@ local char *get_suffix(char *name)
int nlen, slen;
char suffix[MAX_SUFFIX + 3]; /* last chars of name, forced to lower case
*/
- static char *known_suffixes[] = { z_suffix, ".gz", ".z", ".taz", ".tgz",
- "-gz", "-z", "_z", NULL };
+ static char *known_suffixes[] = { z_suffix, ".gz", ".z", ".taz", ".tgz", "-gz", "-z", "_z", NULL };
char **suf = known_suffixes;
if (strequ(z_suffix, "z"))
@@ -734,8 +710,7 @@ local char *get_suffix(char *name)
slen = strlen(suffix);
do {
int s = strlen(*suf);
- if (slen > s && suffix[slen - s - 1] != PATH_SEP &&
- strequ(suffix + slen - s, *suf)) {
+ if (slen > s && suffix[slen - s - 1] != PATH_SEP && strequ(suffix + slen - s, *suf)) {
return name + nlen - s;
}
} while (*++suf != NULL);
@@ -820,9 +795,7 @@ local int make_ofname()
/* Avoid annoying messages with -r */
if (verbose || !quiet) {
- WARN((stderr,
- "%s: %s: unknown suffix -- ignored\n",
- progname, ifname));
+ WARN((stderr, "%s: %s: unknown suffix -- ignored\n", progname, ifname));
}
return WARNING;
}
@@ -839,9 +812,7 @@ local int make_ofname()
} else if (suff != NULL) {
/* Avoid annoying messages with -r (see treat_dir()) */
if (verbose || !quiet) {
- fprintf(stderr,
- "%s: %s already has %s suffix -- unchanged\n",
- progname, ifname, suff);
+ fprintf(stderr, "%s: %s already has %s suffix -- unchanged\n", progname, ifname, suff);
}
if (exit_code == OK)
exit_code = WARNING;
@@ -889,13 +860,11 @@ local int get_method()
/* assume multiple members in gzip file except for record oriented I/O
*/
- if (memcmp(magic, GZIP_MAGIC, 2) == 0 ||
- memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) {
+ if (memcmp(magic, GZIP_MAGIC, 2) == 0 || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) {
method = (int)get_byte();
if (method != DEFLATED) {
- fprintf(stderr,
- "%s: %s: unknown method %d -- get newer version of gzip\n",
- progname, ifname, method);
+ fprintf(stderr, "%s: %s: unknown method %d -- get newer version of gzip\n", progname, ifname,
+ method);
exit_code = ERROR;
return -1;
}
@@ -903,24 +872,20 @@ local int get_method()
flags = (uch)get_byte();
if ((flags & ENCRYPTED) != 0) {
- fprintf(stderr,
- "%s: %s is encrypted -- get newer version of gzip\n",
- progname, ifname);
+ fprintf(stderr, "%s: %s is encrypted -- get newer version of gzip\n", progname, ifname);
exit_code = ERROR;
return -1;
}
if ((flags & CONTINUATION) != 0) {
- fprintf(stderr,
- "%s: %s is a a multi-part gzip file -- get newer version of gzip\n",
- progname, ifname);
+ fprintf(stderr, "%s: %s is a a multi-part gzip file -- get newer version of gzip\n", progname,
+ ifname);
exit_code = ERROR;
if (force <= 1)
return -1;
}
if ((flags & RESERVED) != 0) {
- fprintf(stderr,
- "%s: %s has flags 0x%x -- get newer version of gzip\n",
- progname, ifname, flags);
+ fprintf(stderr, "%s: %s has flags 0x%x -- get newer version of gzip\n", progname, ifname,
+ flags);
exit_code = ERROR;
if (force <= 1)
return -1;
@@ -939,17 +904,14 @@ local int get_method()
unsigned part = (unsigned)get_byte();
part |= ((unsigned)get_byte()) << 8;
if (verbose) {
- fprintf(stderr, "%s: %s: part number %u\n",
- progname, ifname, part);
+ fprintf(stderr, "%s: %s: part number %u\n", progname, ifname, part);
}
}
if ((flags & EXTRA_FIELD) != 0) {
unsigned len = (unsigned)get_byte();
len |= ((unsigned)get_byte()) << 8;
if (verbose) {
- fprintf(stderr,
- "%s: %s: extra field of %u bytes ignored\n",
- progname, ifname, len);
+ fprintf(stderr, "%s: %s: extra field of %u bytes ignored\n", progname, ifname, len);
}
while (len--)
(void)get_byte();
@@ -998,13 +960,11 @@ local int get_method()
return method;
if (part_nb == 1) {
- fprintf(stderr, "\n%s: %s: not in gzip format\n", progname,
- ifname);
+ fprintf(stderr, "\n%s: %s: not in gzip format\n", progname, ifname);
exit_code = ERROR;
return -1;
}
- WARN((stderr, "\n%s: %s: decompression OK, trailing garbage ignored\n",
- progname, ifname));
+ WARN((stderr, "\n%s: %s: decompression OK, trailing garbage ignored\n", progname, ifname));
return -2;
}
@@ -1017,12 +977,9 @@ local int same_file(struct stat *stat1, struct stat *stat2)
stat1->st_dev == stat2->st_dev
#ifdef NO_ST_INO
/* Can't rely on st_ino and st_dev, use other fields: */
- && stat1->st_mode == stat2->st_mode &&
- stat1->st_uid == stat2->st_uid &&
- stat1->st_gid == stat2->st_gid &&
- stat1->st_size == stat2->st_size &&
- stat1->st_atime == stat2->st_atime &&
- stat1->st_mtime == stat2->st_mtime &&
+ && stat1->st_mode == stat2->st_mode && stat1->st_uid == stat2->st_uid &&
+ stat1->st_gid == stat2->st_gid && stat1->st_size == stat2->st_size &&
+ stat1->st_atime == stat2->st_atime && stat1->st_mtime == stat2->st_mtime &&
stat1->st_ctime == stat2->st_ctime
#endif
;
@@ -1160,12 +1117,10 @@ local int check_ofname()
*/
if (same_file(&istat, &ostat)) {
if (strequ(ifname, ofname)) {
- fprintf(stderr,
- "%s: %s: cannot %scompress onto itself\n",
- progname, ifname, decompress ? "de" : "");
+ fprintf(stderr, "%s: %s: cannot %scompress onto itself\n", progname, ifname,
+ decompress ? "de" : "");
} else {
- fprintf(stderr, "%s: %s and %s are the same file\n",
- progname, ifname, ofname);
+ fprintf(stderr, "%s: %s and %s are the same file\n", progname, ifname, ofname);
}
exit_code = ERROR;
return ERROR;
diff --git a/bin/gzip/gzip.h b/bin/gzip/gzip.h
index 6e01f429..5258bc76 100644
--- a/bin/gzip/gzip.h
+++ b/bin/gzip/gzip.h
@@ -85,12 +85,11 @@ extern int method; /* compression method */
#ifdef DYN_ALLOC
#define EXTERN(type, array) extern type *near array
#define DECLARE(type, array, size) type *near array
-#define ALLOC(type, array, size) \
- { \
- array = (type *)fcalloc((size_t)(((size) + 1L) / 2), \
- 2 * sizeof(type)); \
- if (array == NULL) \
- error("insufficient memory"); \
+#define ALLOC(type, array, size) \
+ { \
+ array = (type *)fcalloc((size_t)(((size) + 1L) / 2), 2 * sizeof(type)); \
+ if (array == NULL) \
+ error("insufficient memory"); \
}
#define FREE(array) \
{ \
@@ -143,10 +142,10 @@ extern long ifile_size; /* input file size, -1 for devices (debug only) */
typedef int file_t; /* Do not use stdio */
#define NO_FILE (-1) /* in memory compression */
-#define PACK_MAGIC "\037\036" /* Magic header for packed files */
-#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */
-#define OLD_GZIP_MAGIC "\037\236" /* Magic header for gzip 0.5 = freeze 1.x */
-#define LZH_MAGIC "\037\240" /* Magic header for SCO LZH Compress files*/
+#define PACK_MAGIC "\037\036" /* Magic header for packed files */
+#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */
+#define OLD_GZIP_MAGIC "\037\236" /* Magic header for gzip 0.5 = freeze 1.x */
+#define LZH_MAGIC "\037\240" /* Magic header for SCO LZH Compress files*/
#define PKZIP_MAGIC "\120\113\003\004" /* Magic header for pkzip files */
/* gzip flag byte */
diff --git a/bin/gzip/inflate.c b/bin/gzip/inflate.c
index af2e1e92..29015a7d 100644
--- a/bin/gzip/inflate.c
+++ b/bin/gzip/inflate.c
@@ -126,8 +126,7 @@ struct huft {
};
/* Function prototypes */
-int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *, struct huft **,
- int *));
+int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *, struct huft **, int *));
int huft_free OF((struct huft *));
int inflate_codes OF((struct huft *, struct huft *, int, int));
int inflate_stored OF((void));
@@ -150,28 +149,22 @@ int inflate OF((void));
/* Tables for deflate from PKZIP's appnote.txt. */
static unsigned border[] = { /* Order of the bit length code lengths */
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
- 11, 4, 12, 3, 13, 2, 14, 1, 15
+ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
static ush cplens[] = { /* Copy lengths for literal codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15,
- 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83,
- 99, 115, 131, 163, 195, 227, 258, 0, 0
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
};
/* note: see note #13 above about the 258 in this list. */
static ush cplext[] = { /* Extra bits for literal codes 257..285 */
- 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, 99, 99
+ 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, 99, 99
}; /* 99==invalid */
static ush cpdist[] = { /* Copy offsets for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13,
- 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073,
- 4097, 6145, 8193, 12289, 16385, 24577
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129,
+ 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
};
static ush cpdext[] = { /* Extra bits for distance 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
+ 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
};
/* Macros for inflate() bit peeking and grabbing.
@@ -207,9 +200,8 @@ static ush cpdext[] = { /* Extra bits for distance codes */
ulg bb; /* bit buffer */
unsigned bk; /* bits in bit buffer */
-ush mask_bits[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f,
- 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff,
- 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff };
+ush mask_bits[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
+ 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff };
#ifdef CRYPT
uch cc;
@@ -271,8 +263,7 @@ int dbits = 6; /* bits in base distance lookup table */
unsigned hufts; /* track memory usage */
-int huft_build(unsigned *b, unsigned n, unsigned s, ush *d, ush *e,
- struct huft **t, int *m)
+int huft_build(unsigned *b, unsigned n, unsigned s, ush *d, ush *e, struct huft **t, int *m)
{
unsigned a; /* counter for codes of length k */
unsigned c[BMAX + 1]; /* bit length count table */
@@ -299,10 +290,7 @@ int huft_build(unsigned *b, unsigned n, unsigned s, ush *d, ush *e,
p = b;
i = n;
do {
- Tracecv(*p, (stderr,
- (n - i >= ' ' && n - i <= '~' ? "%c %d\n" :
- "0x%x %d\n"),
- n - i, *p));
+ Tracecv(*p, (stderr, (n - i >= ' ' && n - i <= '~' ? "%c %d\n" : "0x%x %d\n"), n - i, *p));
c[*p]++; /* assume all entries <= BMAX */
p++; /* Can't combine with above line (Solaris bug) */
} while (--i);
@@ -375,15 +363,13 @@ int huft_build(unsigned *b, unsigned n, unsigned s, ush *d, ush *e,
/* compute minimum size table less than or equal
* to l bits */
- z = (z = g - w) > (unsigned)l ?
- (unsigned)l :
- z; /* upper limit on table size */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w
- bit table
- */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from
- patterns left */
+ z = (z = g - w) > (unsigned)l ? (unsigned)l : z; /* upper limit on table size */
+ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w
+ bit table
+ */
+ { /* too few codes for k-w bit table */
+ f -= a + 1; /* deduct codes from
+ patterns left */
xp = c + k;
while (++j < z) /* try smaller tables up
to z bits */
@@ -392,38 +378,36 @@ int huft_build(unsigned *b, unsigned n, unsigned s, ush *d, ush *e,
break; /* enough codes
to use up j
bits */
- f -= *xp; /* else deduct codes
- from patterns */
+ f -= *xp; /* else deduct codes
+ from patterns */
}
}
z = 1 << j; /* table entries for j-bit table */
/* allocate and link in new table */
- if ((q = (struct huft *)malloc(
- (z + 1) * sizeof(struct huft))) ==
- (struct huft *)NULL) {
+ if ((q = (struct huft *)malloc((z + 1) * sizeof(struct huft))) == (struct huft *)NULL) {
if (h)
huft_free(u[0]);
return 3; /* not enough memory */
}
hufts += z + 1; /* track memory usage */
- *t = q + 1; /* link to list for huft_free() */
+ *t = q + 1; /* link to list for huft_free() */
*(t = &(q->v.t)) = (struct huft *)NULL;
u[h] = ++q; /* table starts after link */
/* connect to last table, if there is one */
if (h) {
- x[h] = i; /* save pattern for backing up
- */
- r.b = (uch)l; /* bits to dump before
- this table */
+ x[h] = i; /* save pattern for backing up
+ */
+ r.b = (uch)l; /* bits to dump before
+ this table */
r.e = (uch)(16 + j); /* bits in this
table */
- r.v.t = q; /* pointer to this table */
- j = i >> (w - l); /* (get around Turbo C
- bug) */
- u[h - 1][j] = r; /* connect to last
- table */
+ r.v.t = q; /* pointer to this table */
+ j = i >> (w - l); /* (get around Turbo C
+ bug) */
+ u[h - 1][j] = r; /* connect to last
+ table */
}
}
@@ -435,9 +419,9 @@ int huft_build(unsigned *b, unsigned n, unsigned s, ush *d, ush *e,
r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is
end-of-block
code */
- r.v.n = (ush)(*p); /* simple code is just the
- value */
- p++; /* one compiler does not like *p++ */
+ r.v.n = (ush)(*p); /* simple code is just the
+ value */
+ p++; /* one compiler does not like *p++ */
} else {
r.e = (uch)e[*p - s]; /* non-simple--look up in
lists */
@@ -508,9 +492,7 @@ int inflate_codes(struct huft *tl, struct huft *td, int bl, int bd)
DUMPBITS(t->b)
e -= 16;
NEEDBITS(e)
- } while (
- (e = (t = t->v.t + ((unsigned)b & mask_bits[e]))
- ->e) > 16);
+ } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16);
DUMPBITS(t->b)
if (e == 16) /* then it's a literal */
{
@@ -540,9 +522,7 @@ int inflate_codes(struct huft *tl, struct huft *td, int bl, int bd)
DUMPBITS(t->b)
e -= 16;
NEEDBITS(e)
- } while ((e = (t = t->v.t +
- ((unsigned)b & mask_bits[e]))
- ->e) > 16);
+ } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16);
DUMPBITS(t->b)
NEEDBITS(e)
d = w - t->v.n - ((unsigned)b & mask_bits[e]);
@@ -551,11 +531,7 @@ int inflate_codes(struct huft *tl, struct huft *td, int bl, int bd)
/* do the copy */
do {
- n -= (e = (e = WSIZE -
- ((d &= WSIZE - 1) > w ? d : w)) >
- n ?
- n :
- e);
+ n -= (e = (e = WSIZE - ((d &= WSIZE - 1) > w ? d : w)) > n ? n : e);
#if !defined(NOMEMCPY) && !defined(DEBUG)
if (w - d >= e) /* (this test assumes unsigned
comparison) */
@@ -568,8 +544,7 @@ int inflate_codes(struct huft *tl, struct huft *td, int bl, int bd)
#endif /* !NOMEMCPY */
do {
slide[w++] = slide[d++];
- Tracevv((stderr, "%c",
- slide[w - 1]));
+ Tracevv((stderr, "%c", slide[w - 1]));
} while (--e);
if (w == WSIZE) {
flush_output(w);
diff --git a/bin/gzip/trees.c b/bin/gzip/trees.c
index 1b73553d..41e296a2 100644
--- a/bin/gzip/trees.c
+++ b/bin/gzip/trees.c
@@ -89,12 +89,10 @@ static char rcsid[] = "$Id: trees.c,v 1.1 2002/08/18 00:59:21 hpa Exp $";
/* number of codes used to transfer the bit lengths */
local int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
- = { 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 };
+ = { 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 };
local int extra_dbits[D_CODES] /* extra bits for each distance code */
- = { 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 };
+ = { 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 };
local int extra_blbits[BL_CODES] /* extra bits for each bit length code */
= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 };
@@ -203,23 +201,16 @@ typedef struct tree_desc {
int max_code; /* largest code with non zero frequency */
} tree_desc;
-local tree_desc l_desc = {
- dyn_ltree, static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS, 0
-};
+local tree_desc l_desc = { dyn_ltree, static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS, 0 };
-local tree_desc d_desc = { dyn_dtree, static_dtree, extra_dbits,
- 0, D_CODES, MAX_BITS,
- 0 };
+local tree_desc d_desc = { dyn_dtree, static_dtree, extra_dbits, 0, D_CODES, MAX_BITS, 0 };
-local tree_desc bl_desc = { bl_tree, (ct_data *)0, extra_blbits,
- 0, BL_CODES, MAX_BL_BITS,
- 0 };
+local tree_desc bl_desc = { bl_tree, (ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS, 0 };
local ush bl_count[MAX_BITS + 1];
/* number of codes at each bit length for an optimal tree */
-local uch bl_order[BL_CODES] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
- 11, 4, 12, 3, 13, 2, 14, 1, 15 };
+local uch bl_order[BL_CODES] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
/* The lengths of the bit length codes are sent in order of decreasing
* probability, to avoid transmitting the lengths for unused bit length codes.
*/
@@ -317,8 +308,7 @@ local void set_file_type OF((void));
}
#endif
-#define d_code(dist) \
- ((dist) < 256 ? dist_code[dist] : dist_code[256 + ((dist) >> 7)])
+#define d_code(dist) ((dist) < 256 ? dist_code[dist] : dist_code[256 + ((dist) >> 7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. dist_code[256] and dist_code[257] are never
* used.
@@ -449,9 +439,8 @@ local void init_block()
* Compares to subtrees, using the tree depth as tie breaker when
* the subtrees have equal frequency. This minimizes the worst case length.
*/
-#define smaller(tree, n, m) \
- ((tree)[n].Freq < (tree)[m].Freq || \
- ((tree)[n].Freq == (tree)[m].Freq && depth[n] <= depth[m]))
+#define smaller(tree, n, m) \
+ ((tree)[n].Freq < (tree)[m].Freq || ((tree)[n].Freq == (tree)[m].Freq && depth[n] <= depth[m]))
/* ===========================================================================
* Restore the heap property by moving down the tree starting at node k,
@@ -569,10 +558,8 @@ local void gen_bitlen(desc) tree_desc *desc; /* the tree descriptor */
if (m > max_code)
continue;
if (tree[m].Len != (unsigned)bits) {
- 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;
+ 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;
tree[m].Len = (ush)bits;
}
n--;
@@ -589,7 +576,7 @@ local void gen_bitlen(desc) tree_desc *desc; /* the tree descriptor */
* zero code length.
*/
local void gen_codes(tree, max_code) ct_data *tree; /* the tree to decorate */
-int max_code; /* largest code with non zero frequency */
+int max_code; /* largest code with non zero frequency */
{
ush next_code[MAX_BITS + 1]; /* next code value for each bit length */
ush code = 0; /* running code value */
@@ -605,8 +592,7 @@ int max_code; /* largest code with non zero frequency */
/* Check that the bit counts in bl_count are consistent. The last code
* must be all ones.
*/
- Assert(code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
- "inconsistent bit counts");
+ Assert(code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1, "inconsistent bit counts");
Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
for (n = 0; n <= max_code; n++) {
@@ -616,10 +602,8 @@ int max_code; /* largest code with non zero frequency */
/* Now reverse the bits */
tree[n].Code = bi_reverse(next_code[len]++, len);
- Tracec(tree != static_ltree,
- (stderr, "\nn %3d %c l %2d c %4x (%x) ", n,
- (isgraph(n) ? n : ' '), len, tree[n].Code,
- next_code[len] - 1));
+ Tracec(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ", n, (isgraph(n) ? n : ' '), len,
+ tree[n].Code, next_code[len] - 1));
}
}
@@ -693,8 +677,7 @@ local void build_tree(desc) tree_desc *desc; /* the tree descriptor */
tree[n].Dad = tree[m].Dad = (ush)node;
#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,
+ fprintf(stderr, "\nnode %d(%d), sons %d(%d) %d(%d)", node, tree[node].Freq, n, tree[n].Freq, m,
tree[m].Freq);
}
#endif
@@ -722,7 +705,7 @@ local void build_tree(desc) tree_desc *desc; /* the tree descriptor */
* during the construction of bl_tree.)
*/
local void scan_tree(tree, max_code) ct_data *tree; /* the tree to be scanned */
-int max_code; /* and its largest code of non zero frequency */
+int max_code; /* and its largest code of non zero frequency */
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
@@ -770,7 +753,7 @@ int max_code; /* and its largest code of non zero frequency */
* bl_tree.
*/
local void send_tree(tree, max_code) ct_data *tree; /* the tree to be scanned */
-int max_code; /* and its largest code of non zero frequency */
+int max_code; /* and its largest code of non zero frequency */
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
@@ -864,15 +847,12 @@ local int build_bl_tree()
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
-local void send_all_trees(lcodes, dcodes, blcodes) int lcodes, dcodes,
- blcodes; /* number of codes for each tree */
+local void send_all_trees(lcodes, dcodes, blcodes) int lcodes, dcodes, blcodes; /* number of codes for each tree */
{
int rank; /* index in bl_order */
- Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4,
- "not enough codes");
- Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
- "too many 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: "));
send_bits(lcodes - 257, 5); /* not +255 as stated in appnote.txt */
send_bits(dcodes - 1, 5);
@@ -902,7 +882,7 @@ ulg stored_len; /* length of input block */
int eof; /* true if this is the last block for a file */
{
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
- int max_blindex; /* index of last bit length code of non zero freq */
+ int max_blindex; /* index of last bit length code of non zero freq */
flag_buf[last_flags] = flags; /* Save the flags for the last 8 items */
@@ -931,10 +911,8 @@ int eof; /* true if this is the last block for a file */
static_lenb = (static_len + 3 + 7) >> 3;
input_len += stored_len; /* for debugging only */
- 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));
+ 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));
if (static_lenb <= opt_lenb)
opt_lenb = static_lenb;
@@ -946,8 +924,7 @@ int eof; /* true if this is the last block for a file */
#ifdef FORCE_METHOD
if (level == 1 && eof && compressed_len == 0L) { /* force stored file */
#else
- if (stored_len <= opt_lenb && eof && compressed_len == 0L &&
- seekable()) {
+ if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) {
#endif
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there:
*/
@@ -982,13 +959,11 @@ int eof; /* true if this is the last block for a file */
} else if (static_lenb == opt_lenb) {
#endif
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);
+ 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);
compressed_len += 3 + opt_len;
}
@@ -1000,8 +975,7 @@ int eof; /* true if this is the last block for a file */
bi_windup();
compressed_len += 7; /* align on byte boundary */
}
- Tracev((stderr, "\ncomprlen %lu(%lu) ", compressed_len >> 3,
- compressed_len - 7 * eof));
+ Tracev((stderr, "\ncomprlen %lu(%lu) ", compressed_len >> 3, compressed_len - 7 * eof));
return compressed_len >> 3;
}
@@ -1021,8 +995,7 @@ int lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
} else {
/* Here, lc is the match length - MIN_MATCH */
dist--; /* dist = match distance - 1 */
- Assert((ush)dist < (ush)MAX_DIST &&
- (ush)lc <= (ush)(MAX_MATCH - MIN_MATCH) &&
+ Assert((ush)dist < (ush)MAX_DIST && (ush)lc <= (ush)(MAX_MATCH - MIN_MATCH) &&
(ush)d_code(dist) < (ush)D_CODES,
"ct_tally: bad match");
@@ -1046,14 +1019,11 @@ int lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
ulg in_length = (ulg)strstart - block_start;
int dcode;
for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)dyn_dtree[dcode].Freq *
- (5L + extra_dbits[dcode]);
+ out_length += (ulg)dyn_dtree[dcode].Freq * (5L + extra_dbits[dcode]);
}
out_length >>= 3;
- 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));
+ 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));
if (last_dist < last_lit / 2 && out_length < in_length / 2)
return 1;
}
diff --git a/bin/gzip/util.c b/bin/gzip/util.c
index 056f85e9..b6b037c0 100644
--- a/bin/gzip/util.c
+++ b/bin/gzip/util.c
@@ -58,8 +58,7 @@ ulg updcrc(uch *s, unsigned n)
c = crc;
if (n)
do {
- c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^
- (c >> 8);
+ c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8);
} while (--n);
}
crc = c;
@@ -316,56 +315,36 @@ voidp xmalloc(unsigned size)
* Table of CRC-32's of all single-byte values (made by makecrc.c)
*/
ulg crc_32_tab[] = {
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
- 0x2d02ef8dL
+ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L,
+ 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L,
+ 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L,
+ 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L,
+ 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L,
+ 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL,
+ 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL,
+ 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L,
+ 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L,
+ 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L,
+ 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL,
+ 0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L,
+ 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL,
+ 0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L,
+ 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L,
+ 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L,
+ 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL,
+ 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L,
+ 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL,
+ 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL,
+ 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L,
+ 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L,
+ 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L,
+ 0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL,
+ 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL,
+ 0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL
};
diff --git a/bin/gzip/zip.c b/bin/gzip/zip.c
index e373edff..e3041b20 100644
--- a/bin/gzip/zip.c
+++ b/bin/gzip/zip.c
@@ -72,8 +72,7 @@ int in, out; /* input and output file descriptors */
*/
if (ifile_size != -1L && isize != (ulg)ifile_size) {
Trace((stderr, " actual=%ld, read=%ld ", ifile_size, isize));
- fprintf(stderr, "%s: %s: file size changed while zipping\n",
- progname, ifname);
+ fprintf(stderr, "%s: %s: file size changed while zipping\n", progname, ifname);
}
#endif