From 56bcb184fac036a45cb8937238d51778d0a796aa Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Fri, 9 Sep 2011 23:11:37 -0700 Subject: zlib 0.99 --- minigzip.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'minigzip.c') diff --git a/minigzip.c b/minigzip.c index 1aa67f2..48c21d5 100644 --- a/minigzip.c +++ b/minigzip.c @@ -1,5 +1,5 @@ /* minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995 Jean-loup Gailly. + * Copyright (C) 1995-1996 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -18,14 +18,13 @@ #include #include "zlib.h" -#ifndef __GO32__ -extern void exit OF((int)); -#endif -extern int unlink OF((const char *)); - #ifdef STDC # include +# include +#else + extern void exit OF((int)); #endif +extern int unlink OF((const char *)); #if defined(MSDOS) || defined(OS2) || defined(WIN32) # include @@ -53,7 +52,7 @@ extern int unlink OF((const char *)); char *prog; -void error OF((char *msg)); +void error OF((const char *msg)); void gz_compress OF((FILE *in, gzFile out)); void gz_uncompress OF((gzFile in, FILE *out)); void file_compress OF((char *file)); @@ -64,7 +63,7 @@ int main OF((int argc, char *argv[])); * Display error message and exit */ void error(msg) - char *msg; + const char *msg; { fprintf(stderr, "%s: %s\n", prog, msg); exit(1); @@ -89,7 +88,7 @@ void gz_compress(in, out) } if (len == 0) break; - if (gzwrite(out, buf, len) != len) error(gzerror(out, &err)); + if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); } fclose(in); if (gzclose(out) != Z_OK) error("failed gzclose"); @@ -111,7 +110,9 @@ void gz_uncompress(in, out) if (len < 0) error (gzerror(in, &err)); if (len == 0) break; - if (fwrite(buf, 1, len, out) != (uInt)len) error("failed fwrite"); + if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { + error("failed fwrite"); + } } if (fclose(out)) error("failed fclose"); -- cgit v1.2.3-55-g6feb