diff options
author | jbj <devnull@localhost> | 2004-08-03 06:32:42 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-08-03 06:32:42 +0000 |
commit | 2b86cac35f6c633d500fda5c88262b93307c3093 (patch) | |
tree | 38ff59164f6222bc5113c10f386444f734be7249 /zlib | |
parent | e5a9674ee310e6c36d253c4509221331af77acf4 (diff) | |
download | librpm-tizen-2b86cac35f6c633d500fda5c88262b93307c3093.tar.gz librpm-tizen-2b86cac35f6c633d500fda5c88262b93307c3093.tar.bz2 librpm-tizen-2b86cac35f6c633d500fda5c88262b93307c3093.zip |
Annotate minigzip.c too.
CVS patchset: 7387
CVS date: 2004/08/03 06:32:42
Diffstat (limited to 'zlib')
-rw-r--r-- | zlib/.splintrc | 2 | ||||
-rw-r--r-- | zlib/Makefile.am | 2 | ||||
-rw-r--r-- | zlib/minigzip.c | 76 |
3 files changed, 43 insertions, 37 deletions
diff --git a/zlib/.splintrc b/zlib/.splintrc index 8a3d3f4fa..71f0122d2 100644 --- a/zlib/.splintrc +++ b/zlib/.splintrc @@ -1,6 +1,6 @@ -I. -DHAVE_CONFIG_H -D_GNU_SOURCE -DSTDC -DHAVE_UNISTD_H -DHAS_snprintf -DHAS_vsnprintf -DUSE_MMAP -DWITH_RSYNC_PAD -+partial +#+partial +forcehints -warnposix diff --git a/zlib/Makefile.am b/zlib/Makefile.am index 2e50af57d..705e366b6 100644 --- a/zlib/Makefile.am +++ b/zlib/Makefile.am @@ -35,7 +35,7 @@ sources: .PHONY: lint lint: - $(LINT) $(DEFS) $(INCLUDES) $(libz_la_SOURCES) + $(LINT) $(DEFS) $(INCLUDES) $(libz_la_SOURCES) minigzip.c .PHONY: doxygen doxygen apidocs: Doxyfile diff --git a/zlib/minigzip.c b/zlib/minigzip.c index 6de35dde9..af071dc72 100644 --- a/zlib/minigzip.c +++ b/zlib/minigzip.c @@ -52,7 +52,7 @@ # include <unix.h> /* for fileno */ #endif -#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ +#if !defined(WIN32) && !defined(__LCLINT__) /* unlink already in stdio.h for WIN32 */ extern int unlink OF((const char *)); #endif @@ -64,42 +64,57 @@ #define BUFLEN 16384 #define MAX_NAME_LEN 1024 -#ifdef MAXSEG_64K +#if defined(MAXSEG_64K) || defined(__LCLINT__) # define local static /* Needed for systems with limitation on stack size. */ #else # define local #endif -char *prog; +/*@unchecked@*/ +local char *prog; -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); +local void error OF((const char *msg)) + /*@globals fileSystem @*/ + /*@modifies fileSystem @*/; +local void gz_compress OF((FILE *in, gzFile out)) + /*@globals fileSystem @*/ + /*@modifies in, out, fileSystem @*/; #ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); +local int gz_compress_mmap OF((FILE *in, gzFile out)) + /*@globals fileSystem @*/ + /*@modifies in, out, fileSystem @*/; #endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); +local void gz_uncompress OF((gzFile in, FILE *out)) + /*@globals fileSystem @*/ + /*@modifies in, out, fileSystem @*/; +local void file_compress OF((char *file, char *mode)) + /*@globals fileSystem, internalState @*/ + /*@modifies fileSystem, internalState @*/; +local void file_uncompress OF((char *file)) + /*@globals fileSystem, internalState @*/ + /*@modifies fileSystem, internalState @*/; +int main OF((int argc, char *argv[])) + /*@globals prog, fileSystem, internalState @*/ + /*@modifies prog, fileSystem, internalState @*/; /* =========================================================================== * 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); +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + exit(EXIT_FAILURE); } /* =========================================================================== * Compress input to output then close both files. */ -void gz_compress(in, out) - FILE *in; - gzFile out; +void gz_compress(FILE *in, gzFile out) { local char buf[BUFLEN]; int len; @@ -115,7 +130,7 @@ void gz_compress(in, out) len = (int)fread(buf, 1, sizeof(buf), in); if (ferror(in)) { perror("fread"); - exit(1); + exit(EXIT_FAILURE); } if (len == 0) break; @@ -130,9 +145,7 @@ void gz_compress(in, out) /* Try compressing the input file at once using mmap. Return Z_OK if * if success, Z_ERRNO otherwise. */ -int gz_compress_mmap(in, out) - FILE *in; - gzFile out; +int gz_compress_mmap(FILE *in, gzFile out) { int len; int err; @@ -165,9 +178,7 @@ int gz_compress_mmap(in, out) /* =========================================================================== * Uncompress input to output then close both files. */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; +void gz_uncompress(gzFile in, FILE *out) { local char buf[BUFLEN]; int len; @@ -192,9 +203,7 @@ void gz_uncompress(in, out) * Compress the given file: create a corresponding .gz file and remove the * original. */ -void file_compress(file, mode) - char *file; - char *mode; +void file_compress(char *file, char *mode) { local char outfile[MAX_NAME_LEN]; FILE *in; @@ -206,12 +215,12 @@ void file_compress(file, mode) in = fopen(file, "rb"); if (in == NULL) { perror(file); - exit(1); + exit(EXIT_FAILURE); } out = gzopen(outfile, mode); if (out == NULL) { fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); + exit(EXIT_FAILURE); } gz_compress(in, out); @@ -222,8 +231,7 @@ void file_compress(file, mode) /* =========================================================================== * Uncompress the given file and remove the original. */ -void file_uncompress(file) - char *file; +void file_uncompress(char *file) { local char buf[MAX_NAME_LEN]; char *infile, *outfile; @@ -245,12 +253,12 @@ void file_uncompress(file) in = gzopen(infile, "rb"); if (in == NULL) { fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); + exit(EXIT_FAILURE); } out = fopen(outfile, "wb"); if (out == NULL) { perror(file); - exit(1); + exit(EXIT_FAILURE); } gz_uncompress(in, out); @@ -268,9 +276,7 @@ void file_uncompress(file) * -1 to -9 : compression level */ -int main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { int uncompr = 0; gzFile file; |