From eadebf9b4a7626db0b43c8cb43a324e8051cb346 Mon Sep 17 00:00:00 2001 From: markm Date: Sun, 2 Dec 2001 13:31:22 +0000 Subject: WARNS=2 fix and 'register' removal. --- usr.bin/compress/Makefile | 2 +- usr.bin/compress/compress.c | 22 +++++++++++----------- usr.bin/compress/zopen.c | 35 +++++++++++++++++++---------------- 3 files changed, 31 insertions(+), 28 deletions(-) (limited to 'usr.bin/compress') diff --git a/usr.bin/compress/Makefile b/usr.bin/compress/Makefile index 77e01ba..498ab04 100644 --- a/usr.bin/compress/Makefile +++ b/usr.bin/compress/Makefile @@ -2,8 +2,8 @@ # $FreeBSD$ PROG= compress -CFLAGS+=-Wall SRCS= compress.c zopen.c +WARNS?= 2 LINKS= ${BINDIR}/compress ${BINDIR}/uncompress MLINKS= compress.1 uncompress.1 diff --git a/usr.bin/compress/compress.c b/usr.bin/compress/compress.c index 4f91f6c..24048eb 100644 --- a/usr.bin/compress/compress.c +++ b/usr.bin/compress/compress.c @@ -64,12 +64,12 @@ static const char rcsid[] = #include "zopen.h" -void compress __P((char *, char *, int)); +void compress __P((const char *, const char *, int)); void cwarn __P((const char *, ...)) __printflike(1, 2); void cwarnx __P((const char *, ...)) __printflike(1, 2); -void decompress __P((char *, char *, int)); -int permission __P((char *)); -void setfile __P((char *, struct stat *)); +void decompress __P((const char *, const char *, int)); +int permission __P((const char *)); +void setfile __P((const char *, struct stat *)); void usage __P((int)); int eval, force, verbose; @@ -196,10 +196,10 @@ main(argc, argv) void compress(in, out, bits) - char *in, *out; + const char *in, *out; int bits; { - register int nr; + size_t nr; struct stat isb, sb; FILE *ifp, *ofp; int exists, isreg, oreg; @@ -286,10 +286,10 @@ err: if (ofp) { void decompress(in, out, bits) - char *in, *out; + const char *in, *out; int bits; { - register int nr; + size_t nr; struct stat sb; FILE *ifp, *ofp; int exists, isreg, oreg; @@ -353,8 +353,8 @@ err: if (ofp) { void setfile(name, fs) - char *name; - register struct stat *fs; + const char *name; + struct stat *fs; { static struct timeval tv[2]; @@ -385,7 +385,7 @@ setfile(name, fs) int permission(fname) - char *fname; + const char *fname; { int ch, first; diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c index abe31f2..35e00b0 100644 --- a/usr.bin/compress/zopen.c +++ b/usr.bin/compress/zopen.c @@ -33,6 +33,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #if defined(LIBC_SCCS) && !defined(lint) @@ -101,8 +103,8 @@ struct s_zstate { enum { S_START, S_MIDDLE, S_EOF } zs_state; /* State of computation */ - int zs_n_bits; /* Number of bits/code. */ - int zs_maxbits; /* User settable max # bits/code. */ + size_t zs_n_bits; /* Number of bits/code. */ + size_t zs_maxbits; /* User settable max # bits/code. */ code_int zs_maxcode; /* Maximum code, given n_bits. */ code_int zs_maxmaxcode; /* Should NEVER generate this code. */ count_int zs_htab [HSIZE]; @@ -117,7 +119,7 @@ struct s_zstate { int zs_clear_flg; long zs_ratio; count_int zs_checkpoint; - int zs_offset; + size_t zs_offset; long zs_in_count; /* Length of input. */ long zs_bytes_out; /* Length of compressed output. */ long zs_out_count; /* # of codes output (for debugging). */ @@ -238,8 +240,8 @@ zwrite(cookie, wbp, num) const char *wbp; int num; { - register code_int i; - register int c, disp; + code_int i; + int c, disp; struct s_zstate *zs; const u_char *bp; u_char tmp; @@ -250,7 +252,7 @@ zwrite(cookie, wbp, num) zs = cookie; count = num; - bp = (u_char *)wbp; + bp = wbp; if (state == S_MIDDLE) goto middle; state = S_MIDDLE; @@ -374,8 +376,9 @@ output(zs, ocode) struct s_zstate *zs; code_int ocode; { - register int bits, r_off; - register char_type *bp; + int r_off; + size_t bits; + char_type *bp; r_off = offset; bits = n_bits; @@ -464,7 +467,7 @@ zread(cookie, rbp, num) char *rbp; int num; { - register u_int count; + u_int count; struct s_zstate *zs; u_char *bp, header[3]; @@ -573,9 +576,9 @@ static code_int getcode(zs) struct s_zstate *zs; { - register code_int gcode; - register int r_off, bits; - register char_type *bp; + code_int gcode; + int r_off, bits; + char_type *bp; bp = gbuf; if (clear_flg > 0 || roffset >= size || free_ent > maxcode) { @@ -632,7 +635,7 @@ static int cl_block(zs) /* Table clear for block compress. */ struct s_zstate *zs; { - register long rat; + long rat; checkpoint = in_count + CHECK_GAP; @@ -660,10 +663,10 @@ cl_block(zs) /* Table clear for block compress. */ static void cl_hash(zs, cl_hsize) /* Reset code table. */ struct s_zstate *zs; - register count_int cl_hsize; + count_int cl_hsize; { - register count_int *htab_p; - register long i, m1; + count_int *htab_p; + long i, m1; m1 = -1; htab_p = htab + cl_hsize; -- cgit v1.1