diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-08-14 00:30:44 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-08-14 00:30:44 -0700 |
commit | a2981775a91d762c1747e987e30aaa022e0393fd (patch) | |
tree | 02a58441f316f5d2120fffe0802a071f7ca7e859 /examples | |
parent | aa210a1b84615440e0f7fb84e03e0a5f17872279 (diff) | |
download | zlib-a2981775a91d762c1747e987e30aaa022e0393fd.tar.gz zlib-a2981775a91d762c1747e987e30aaa022e0393fd.tar.bz2 zlib-a2981775a91d762c1747e987e30aaa022e0393fd.zip |
Clean up examples/gzjoin.c for z_const usage.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gzjoin.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/gzjoin.c b/examples/gzjoin.c index 129347c..89e8098 100644 --- a/examples/gzjoin.c +++ b/examples/gzjoin.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* gzjoin -- command to join gzip files into one gzip file | 1 | /* gzjoin -- command to join gzip files into one gzip file |
2 | 2 | ||
3 | Copyright (C) 2004 Mark Adler, all rights reserved | 3 | Copyright (C) 2004, 2005, 2012 Mark Adler, all rights reserved |
4 | version 1.0, 11 Dec 2004 | 4 | version 1.2, 14 Aug 2012 |
5 | 5 | ||
6 | This software is provided 'as-is', without any express or implied | 6 | This software is provided 'as-is', without any express or implied |
7 | warranty. In no event will the author be held liable for any damages | 7 | warranty. In no event will the author be held liable for any damages |
@@ -27,6 +27,7 @@ | |||
27 | * | 27 | * |
28 | * 1.0 11 Dec 2004 - First version | 28 | * 1.0 11 Dec 2004 - First version |
29 | * 1.1 12 Jun 2005 - Changed ssize_t to long for portability | 29 | * 1.1 12 Jun 2005 - Changed ssize_t to long for portability |
30 | * 1.2 14 Aug 2012 - Clean up for z_const usage | ||
30 | */ | 31 | */ |
31 | 32 | ||
32 | /* | 33 | /* |
@@ -308,7 +309,7 @@ local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, | |||
308 | /* inflate and copy compressed data, clear last-block bit if requested */ | 309 | /* inflate and copy compressed data, clear last-block bit if requested */ |
309 | len = 0; | 310 | len = 0; |
310 | zpull(&strm, in); | 311 | zpull(&strm, in); |
311 | start = strm.next_in; | 312 | start = in->next; |
312 | last = start[0] & 1; | 313 | last = start[0] & 1; |
313 | if (last && clr) | 314 | if (last && clr) |
314 | start[0] &= ~1; | 315 | start[0] &= ~1; |
@@ -351,7 +352,7 @@ local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, | |||
351 | pos = 0x100 >> pos; | 352 | pos = 0x100 >> pos; |
352 | last = strm.next_in[-1] & pos; | 353 | last = strm.next_in[-1] & pos; |
353 | if (last && clr) | 354 | if (last && clr) |
354 | strm.next_in[-1] &= ~pos; | 355 | in->buf[strm.next_in - in->buf - 1] &= ~pos; |
355 | } | 356 | } |
356 | else { | 357 | else { |
357 | /* next last-block bit is in next unused byte */ | 358 | /* next last-block bit is in next unused byte */ |
@@ -364,14 +365,14 @@ local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, | |||
364 | } | 365 | } |
365 | last = strm.next_in[0] & 1; | 366 | last = strm.next_in[0] & 1; |
366 | if (last && clr) | 367 | if (last && clr) |
367 | strm.next_in[0] &= ~1; | 368 | in->buf[strm.next_in - in->buf] &= ~1; |
368 | } | 369 | } |
369 | } | 370 | } |
370 | } | 371 | } |
371 | 372 | ||
372 | /* update buffer with unused input */ | 373 | /* update buffer with unused input */ |
373 | in->left = strm.avail_in; | 374 | in->left = strm.avail_in; |
374 | in->next = strm.next_in; | 375 | in->next = in->buf + (strm.next_in - in->buf); |
375 | 376 | ||
376 | /* copy used input, write empty blocks to get to byte boundary */ | 377 | /* copy used input, write empty blocks to get to byte boundary */ |
377 | pos = strm.data_type & 7; | 378 | pos = strm.data_type & 7; |