diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2012-08-13 21:49:10 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2012-08-13 21:49:10 -0700 |
| commit | 360c3e9532a7086ed252e3ab187d03fb6b86c4ca (patch) | |
| tree | 1e0794f444893ca85752c86a389e3b36b9813509 | |
| parent | 62d6112a7981ad7c34f3b43cffdf00d4662a4f25 (diff) | |
| download | zlib-360c3e9532a7086ed252e3ab187d03fb6b86c4ca.tar.gz zlib-360c3e9532a7086ed252e3ab187d03fb6b86c4ca.tar.bz2 zlib-360c3e9532a7086ed252e3ab187d03fb6b86c4ca.zip | |
Update examples/gun.c for proper z_const usage.
| -rw-r--r-- | examples/gun.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/gun.c b/examples/gun.c index 72b0882..89e484f 100644 --- a/examples/gun.c +++ b/examples/gun.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* gun.c -- simple gunzip to give an example of the use of inflateBack() | 1 | /* gun.c -- simple gunzip to give an example of the use of inflateBack() |
| 2 | * Copyright (C) 2003, 2005, 2008, 2010 Mark Adler | 2 | * Copyright (C) 2003, 2005, 2008, 2010, 2012 Mark Adler |
| 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 | Version 1.6 17 January 2010 Mark Adler */ | 4 | Version 1.7 12 August 2012 Mark Adler */ |
| 5 | 5 | ||
| 6 | /* Version history: | 6 | /* Version history: |
| 7 | 1.0 16 Feb 2003 First version for testing of inflateBack() | 7 | 1.0 16 Feb 2003 First version for testing of inflateBack() |
| @@ -18,6 +18,7 @@ | |||
| 18 | 1.4 8 Dec 2006 LZW decompression speed improvements | 18 | 1.4 8 Dec 2006 LZW decompression speed improvements |
| 19 | 1.5 9 Feb 2008 Avoid warning in latest version of gcc | 19 | 1.5 9 Feb 2008 Avoid warning in latest version of gcc |
| 20 | 1.6 17 Jan 2010 Avoid signed/unsigned comparison warnings | 20 | 1.6 17 Jan 2010 Avoid signed/unsigned comparison warnings |
| 21 | 1.7 12 Aug 2012 Update for z_const usage in zlib 1.2.8 | ||
| 21 | */ | 22 | */ |
| 22 | 23 | ||
| 23 | /* | 24 | /* |
| @@ -85,7 +86,7 @@ struct ind { | |||
| 85 | /* Load input buffer, assumed to be empty, and return bytes loaded and a | 86 | /* Load input buffer, assumed to be empty, and return bytes loaded and a |
| 86 | pointer to them. read() is called until the buffer is full, or until it | 87 | pointer to them. read() is called until the buffer is full, or until it |
| 87 | returns end-of-file or error. Return 0 on error. */ | 88 | returns end-of-file or error. Return 0 on error. */ |
| 88 | local unsigned in(void *in_desc, unsigned char **buf) | 89 | local unsigned in(void *in_desc, z_const unsigned char **buf) |
| 89 | { | 90 | { |
| 90 | int ret; | 91 | int ret; |
| 91 | unsigned len; | 92 | unsigned len; |
| @@ -196,7 +197,7 @@ unsigned char match[65280 + 2]; /* buffer for reversed match or gzip | |||
| 196 | file, read error, or write error (a write error indicated by strm->next_in | 197 | file, read error, or write error (a write error indicated by strm->next_in |
| 197 | not equal to Z_NULL), or Z_DATA_ERROR for invalid input. | 198 | not equal to Z_NULL), or Z_DATA_ERROR for invalid input. |
| 198 | */ | 199 | */ |
| 199 | local int lunpipe(unsigned have, unsigned char *next, struct ind *indp, | 200 | local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, |
| 200 | int outfile, z_stream *strm) | 201 | int outfile, z_stream *strm) |
| 201 | { | 202 | { |
| 202 | int last; /* last byte read by NEXT(), or -1 if EOF */ | 203 | int last; /* last byte read by NEXT(), or -1 if EOF */ |
| @@ -383,7 +384,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) | |||
| 383 | { | 384 | { |
| 384 | int ret, first, last; | 385 | int ret, first, last; |
| 385 | unsigned have, flags, len; | 386 | unsigned have, flags, len; |
| 386 | unsigned char *next = NULL; | 387 | z_const unsigned char *next = NULL; |
| 387 | struct ind ind, *indp; | 388 | struct ind ind, *indp; |
| 388 | struct outd outd; | 389 | struct outd outd; |
| 389 | 390 | ||
