diff options
Diffstat (limited to 'minigzip.c')
-rw-r--r-- | minigzip.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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 Jean-loup Gailly. | 2 | * Copyright (C) 1995-1996 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 | ||
@@ -18,14 +18,13 @@ | |||
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | #include "zlib.h" | 19 | #include "zlib.h" |
20 | 20 | ||
21 | #ifndef __GO32__ | ||
22 | extern void exit OF((int)); | ||
23 | #endif | ||
24 | extern int unlink OF((const char *)); | ||
25 | |||
26 | #ifdef STDC | 21 | #ifdef STDC |
27 | # include <string.h> | 22 | # include <string.h> |
23 | # include <stdlib.h> | ||
24 | #else | ||
25 | extern void exit OF((int)); | ||
28 | #endif | 26 | #endif |
27 | extern int unlink OF((const char *)); | ||
29 | 28 | ||
30 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) | 29 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) |
31 | # include <fcntl.h> | 30 | # include <fcntl.h> |
@@ -53,7 +52,7 @@ extern int unlink OF((const char *)); | |||
53 | 52 | ||
54 | char *prog; | 53 | char *prog; |
55 | 54 | ||
56 | void error OF((char *msg)); | 55 | void error OF((const char *msg)); |
57 | void gz_compress OF((FILE *in, gzFile out)); | 56 | void gz_compress OF((FILE *in, gzFile out)); |
58 | void gz_uncompress OF((gzFile in, FILE *out)); | 57 | void gz_uncompress OF((gzFile in, FILE *out)); |
59 | void file_compress OF((char *file)); | 58 | void file_compress OF((char *file)); |
@@ -64,7 +63,7 @@ int main OF((int argc, char *argv[])); | |||
64 | * Display error message and exit | 63 | * Display error message and exit |
65 | */ | 64 | */ |
66 | void error(msg) | 65 | void error(msg) |
67 | char *msg; | 66 | const char *msg; |
68 | { | 67 | { |
69 | fprintf(stderr, "%s: %s\n", prog, msg); | 68 | fprintf(stderr, "%s: %s\n", prog, msg); |
70 | exit(1); | 69 | exit(1); |
@@ -89,7 +88,7 @@ void gz_compress(in, out) | |||
89 | } | 88 | } |
90 | if (len == 0) break; | 89 | if (len == 0) break; |
91 | 90 | ||
92 | if (gzwrite(out, buf, len) != len) error(gzerror(out, &err)); | 91 | if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); |
93 | } | 92 | } |
94 | fclose(in); | 93 | fclose(in); |
95 | if (gzclose(out) != Z_OK) error("failed gzclose"); | 94 | if (gzclose(out) != Z_OK) error("failed gzclose"); |
@@ -111,7 +110,9 @@ void gz_uncompress(in, out) | |||
111 | if (len < 0) error (gzerror(in, &err)); | 110 | if (len < 0) error (gzerror(in, &err)); |
112 | if (len == 0) break; | 111 | if (len == 0) break; |
113 | 112 | ||
114 | if (fwrite(buf, 1, len, out) != (uInt)len) error("failed fwrite"); | 113 | if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { |
114 | error("failed fwrite"); | ||
115 | } | ||
115 | } | 116 | } |
116 | if (fclose(out)) error("failed fclose"); | 117 | if (fclose(out)) error("failed fclose"); |
117 | 118 | ||