Module Name: src Committed By: tsutsui Date: Thu May 19 22:23:12 UTC 2011
Modified Files: src/common/dist/zlib: gzio.c src/distrib/utils/zcat: Makefile zcat.c Log Message: - WARNSfy - KNF, ANSIfy, remove __P(), misc cosmetics To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/dist/zlib/gzio.c cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/zcat/Makefile cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/zcat/zcat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/dist/zlib/gzio.c diff -u src/common/dist/zlib/gzio.c:1.2 src/common/dist/zlib/gzio.c:1.3 --- src/common/dist/zlib/gzio.c:1.2 Fri Jan 27 00:45:27 2006 +++ src/common/dist/zlib/gzio.c Thu May 19 22:23:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gzio.c,v 1.2 2006/01/27 00:45:27 christos Exp $ */ +/* $NetBSD: gzio.c,v 1.3 2011/05/19 22:23:12 tsutsui Exp $ */ /* gzio.c -- IO on .gz files * Copyright (C) 1995-2005 Jean-loup Gailly. @@ -76,11 +76,15 @@ local gzFile gz_open OF((const char *path, const char *mode, int fd)); +#ifndef NO_GZCOMPRESS local int do_flush OF((gzFile file, int flush)); +#endif local int get_byte OF((gz_stream *s)); local void check_header OF((gz_stream *s)); local int destroy OF((gz_stream *s)); +#ifndef NO_GZCOMPRESS local void putLong OF((FILE *file, uLong x)); +#endif local uLong getLong OF((gz_stream *s)); /* =========================================================================== @@ -917,6 +921,7 @@ return s->transparent; } +#ifndef NO_GZCOMPRESS /* =========================================================================== Outputs a long in LSB order to the given file */ @@ -930,6 +935,7 @@ x >>= 8; } } +#endif /* =========================================================================== Reads a long in LSB order from the given gz_stream. Sets z_err in case Index: src/distrib/utils/zcat/Makefile diff -u src/distrib/utils/zcat/Makefile:1.14 src/distrib/utils/zcat/Makefile:1.15 --- src/distrib/utils/zcat/Makefile:1.14 Sat Jan 14 21:15:40 2006 +++ src/distrib/utils/zcat/Makefile Thu May 19 22:23:12 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2006/01/14 21:15:40 christos Exp $ +# $NetBSD: Makefile,v 1.15 2011/05/19 22:23:12 tsutsui Exp $ # Small zcat (i.e. for install media) # # Note: gzio.c is compiled here so that crunchgen will assume @@ -8,6 +8,7 @@ SRCDIR= ${.CURDIR}/../../../common/dist/zlib +WARNS?= 4 PROG= zcat NOMAN= # defined Index: src/distrib/utils/zcat/zcat.c diff -u src/distrib/utils/zcat/zcat.c:1.3 src/distrib/utils/zcat/zcat.c:1.4 --- src/distrib/utils/zcat/zcat.c:1.3 Thu Nov 12 16:49:47 1998 +++ src/distrib/utils/zcat/zcat.c Thu May 19 22:23:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: zcat.c,v 1.3 1998/11/12 16:49:47 thorpej Exp $ */ +/* $NetBSD: zcat.c,v 1.4 2011/05/19 22:23:12 tsutsui Exp $ */ /* mini zcat.c -- a minimal zcat using the zlib compression library * Copyright (C) 1995-1996 Jean-loup Gailly. @@ -22,43 +22,45 @@ char *prog; -void error __P((const char *msg)); -void gz_uncompress __P((gzFile in, FILE *out)); -int main __P((int argc, char *argv[])); +void error(const char *msg); +void gz_uncompress(gzFile in, FILE *out); +int main(int argc, char *argv[]); /* =========================================================================== * Display error message and exit */ -void error(msg) - const char *msg; +void error(const char *msg) { - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); + + fprintf(stderr, "%s: %s\n", prog, msg); + exit(EXIT_SUCCESS); } /* =========================================================================== * Uncompress input to output then close both files. */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; -{ - char buf[BUFLEN]; - int len; - int err; - - for (;;) { - len = gzread(in, buf, sizeof(buf)); - if (len < 0) error (gzerror(in, &err)); - if (len == 0) break; +void gz_uncompress(gzFile in, FILE *out) +{ + char buf[BUFLEN]; + int len; + int err; + + for (;;) { + len = gzread(in, buf, sizeof(buf)); + if (len < 0) + error (gzerror(in, &err)); + if (len == 0) + break; - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); + if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { + error("failed fwrite"); + } } - } - if (fclose(out)) error("failed fclose"); + if (fclose(out)) + error("failed fclose"); - if (gzclose(in) != Z_OK) error("failed gzclose"); + if (gzclose(in) != Z_OK) + error("failed gzclose"); } @@ -66,39 +68,37 @@ * Usage: zcat [files...] */ -int main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { - gzFile zfp; + gzFile zfp; /* save program name and skip */ - prog = argv[0]; - argc--, argv++; + prog = argv[0]; + argc--, argv++; /* ignore any switches */ while (*argv && (**argv == '-')) { - argc--, argv++; - } + argc--, argv++; + } - if (argc == 0) { + if (argc == 0) { zfp = gzdopen(fileno(stdin), "rb"); if (zfp == NULL) error("can't gzdopen stdin"); gz_uncompress(zfp, stdout); return 0; - } + } do { /* file_uncompress(*argv); */ zfp = gzopen(*argv, "rb"); if (zfp == NULL) { fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); - exit(1); + exit(EXIT_FAILURE); } gz_uncompress(zfp, stdout); } while (argv++, --argc); - return 0; /* to avoid warning */ + return 0; /* to avoid warning */ } @@ -106,24 +106,28 @@ * XXX: hacks to keep gzio.c from pulling in deflate stuff */ -int deflateInit2_ (z_streamp strm, int level, int method, - int windowBits, int memLevel, int strategy, - const char *version, int stream_size) +int deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, int strategy, + const char *version, int stream_size) { - return(-1); + + return -1; } -int deflate (z_streamp strm, int flush) +int deflate(z_streamp strm, int flush) { - return(-1); + + return -1; } -int deflateEnd (z_streamp strm) +int deflateEnd(z_streamp strm) { - return(-1); + + return -1; } -int deflateParams (z_streamp strm, int level, int strategy) +int deflateParams(z_streamp strm, int level, int strategy) { - return(Z_STREAM_ERROR); + + return Z_STREAM_ERROR; }