summaryrefslogtreecommitdiff
path: root/minigzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'minigzip.c')
-rw-r--r--minigzip.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/minigzip.c b/minigzip.c
index 48c21d5..fa0a188 100644
--- a/minigzip.c
+++ b/minigzip.c
@@ -1,5 +1,5 @@
1/* minigzip.c -- simulate gzip using the zlib compression library 1/* minigzip.c -- simulate gzip using the zlib compression library
2 * Copyright (C) 1995-1996 Jean-loup Gailly. 2 * Copyright (C) 1995 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
@@ -52,7 +52,7 @@ extern int unlink OF((const char *));
52 52
53char *prog; 53char *prog;
54 54
55void error OF((const char *msg)); 55void error OF((char *msg));
56void gz_compress OF((FILE *in, gzFile out)); 56void gz_compress OF((FILE *in, gzFile out));
57void gz_uncompress OF((gzFile in, FILE *out)); 57void gz_uncompress OF((gzFile in, FILE *out));
58void file_compress OF((char *file)); 58void file_compress OF((char *file));
@@ -63,7 +63,7 @@ int main OF((int argc, char *argv[]));
63 * Display error message and exit 63 * Display error message and exit
64 */ 64 */
65void error(msg) 65void error(msg)
66 const char *msg; 66 char *msg;
67{ 67{
68 fprintf(stderr, "%s: %s\n", prog, msg); 68 fprintf(stderr, "%s: %s\n", prog, msg);
69 exit(1); 69 exit(1);
@@ -88,7 +88,7 @@ void gz_compress(in, out)
88 } 88 }
89 if (len == 0) break; 89 if (len == 0) break;
90 90
91 if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); 91 if (gzwrite(out, buf, len) != len) error(gzerror(out, &err));
92 } 92 }
93 fclose(in); 93 fclose(in);
94 if (gzclose(out) != Z_OK) error("failed gzclose"); 94 if (gzclose(out) != Z_OK) error("failed gzclose");
@@ -110,9 +110,7 @@ void gz_uncompress(in, out)
110 if (len < 0) error (gzerror(in, &err)); 110 if (len < 0) error (gzerror(in, &err));
111 if (len == 0) break; 111 if (len == 0) break;
112 112
113 if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { 113 if (fwrite(buf, 1, len, out) != (uInt)len) error("failed fwrite");
114 error("failed fwrite");
115 }
116 } 114 }
117 if (fclose(out)) error("failed fclose"); 115 if (fclose(out)) error("failed fclose");
118 116