Annotate minigzip.c too.
authorjbj <devnull@localhost>
Tue, 3 Aug 2004 06:32:42 +0000 (06:32 +0000)
committerjbj <devnull@localhost>
Tue, 3 Aug 2004 06:32:42 +0000 (06:32 +0000)
CVS patchset: 7387
CVS date: 2004/08/03 06:32:42

zlib/.splintrc
zlib/Makefile.am
zlib/minigzip.c

index 8a3d3f4..71f0122 100644 (file)
@@ -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
index 2e50af5..705e366 100644 (file)
@@ -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
index 6de35dd..af071dc 100644 (file)
@@ -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
 
 #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;