aboutsummaryrefslogtreecommitdiff
path: root/zlibWrapper/examples/minigzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'zlibWrapper/examples/minigzip.c')
-rw-r--r--zlibWrapper/examples/minigzip.c67
1 files changed, 16 insertions, 51 deletions
diff --git a/zlibWrapper/examples/minigzip.c b/zlibWrapper/examples/minigzip.c
index 717a94df..1af81520 100644
--- a/zlibWrapper/examples/minigzip.c
+++ b/zlibWrapper/examples/minigzip.c
@@ -34,7 +34,7 @@
# include <sys/stat.h>
#endif
-#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
+#if defined(MSDOS) || defined(OS2) || defined(_WIN32) || defined(__CYGWIN__)
# include <fcntl.h>
# include <io.h>
# ifdef UNDER_CE
@@ -63,7 +63,7 @@
#endif
#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE)
-#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
+#ifndef _WIN32 /* unlink already in stdio.h for WIN32 */
extern int unlink _Z_OF((const char *));
#endif
#endif
@@ -82,8 +82,7 @@
The strwinerror function does not change the current setting
of GetLastError. */
-static char *strwinerror (error)
- DWORD error;
+static char *strwinerror(DWORD error)
{
static char buf[1024];
@@ -121,8 +120,7 @@ static char *strwinerror (error)
return buf;
}
-static void pwinerror (s)
- const char *s;
+static void pwinerror (const char *s)
{
if (s && *s)
fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ()));
@@ -198,11 +196,7 @@ const char *mode;
return gz_open(NULL, fd, mode);
}
-gzFile gz_open(path, fd, mode)
- const char *path;
- int fd;
- const char *mode;
-{
+gzFile gz_open(const char *path, int fd, const char *mode) {
gzFile gz;
int ret;
@@ -238,11 +232,7 @@ gzFile gz_open(path, fd, mode)
int gzwrite _Z_OF((gzFile, const void *, unsigned));
-int gzwrite(gz, buf, len)
- gzFile gz;
- const void *buf;
- unsigned len;
-{
+int gzwrite(gzFile gz, const void *buf, unsigned len) {
z_stream *strm;
unsigned char out[BUFLEN];
@@ -262,11 +252,7 @@ int gzwrite(gz, buf, len)
int gzread _Z_OF((gzFile, void *, unsigned));
-int gzread(gz, buf, len)
- gzFile gz;
- void *buf;
- unsigned len;
-{
+int gzread(gzFile gz, void *buf, unsigned len) {
int ret;
unsigned got;
unsigned char in[1];
@@ -299,9 +285,7 @@ int gzread(gz, buf, len)
int gzclose _Z_OF((gzFile));
-int gzclose(gz)
- gzFile gz;
-{
+int gzclose(gzFile gz) {
z_stream *strm;
unsigned char out[BUFLEN];
@@ -328,9 +312,7 @@ int gzclose(gz)
const char *gzerror _Z_OF((gzFile, int *));
-const char *gzerror(gz, err)
- gzFile gz;
- int *err;
+const char *gzerror(gzFile gz, int *err)
{
*err = gz->err;
return gz->msg;
@@ -353,8 +335,7 @@ int main _Z_OF((int argc, char *argv[]));
/* ===========================================================================
* 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);
@@ -364,9 +345,7 @@ void error(msg)
* 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;
@@ -397,10 +376,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;
int ifd = fileno(in);
@@ -432,10 +408,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;
int err;
@@ -459,10 +432,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;
gzFile out;
@@ -494,9 +464,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;
FILE *out;
@@ -546,10 +514,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 copyout = 0;
int uncompr = 0;
gzFile file;