Skip to content

Commit 9dd89f8

Browse files
authored
Merge pull request #5062 from ibuclaw/zlib1_2_11
Update zlib to the 1.2.11 release merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
2 parents 1605741 + 0c96000 commit 9dd89f8

File tree

12 files changed

+46
-35
lines changed

12 files changed

+46
-35
lines changed

etc/c/zlib.d

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* zlib.d: modified from zlib.h by Walter Bright */
22
/* updated from 1.2.1 to 1.2.3 by Thomas Kuehne */
33
/* updated from 1.2.3 to 1.2.8 by Dmitry Atamanov */
4-
/* updated from 1.2.8 to 1.2.10 by Iain Buclaw */
4+
/* updated from 1.2.8 to 1.2.11 by Iain Buclaw */
55

66
module etc.c.zlib;
77

88
import core.stdc.config;
99

1010
/* zlib.h -- interface of the 'zlib' general purpose compression library
11-
version 1.2.10, January 2nd, 2017
11+
version 1.2.11, January 15th, 2017
1212
1313
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
1414
@@ -40,8 +40,8 @@ import core.stdc.config;
4040
nothrow:
4141
extern (C):
4242

43-
const char[] ZLIB_VERSION = "1.2.10";
44-
const ZLIB_VERNUM = 0x12a0;
43+
const char[] ZLIB_VERSION = "1.2.11";
44+
const ZLIB_VERNUM = 0x12b0;
4545

4646
/*
4747
The 'zlib' compression library provides in-memory compression and
@@ -725,10 +725,11 @@ int deflateParams(z_streamp strm, int level, int strategy);
725725
used to switch between compression and straight copy of the input data, or
726726
to switch to a different kind of input data requiring a different strategy.
727727
If the compression approach (which is a function of the level) or the
728-
strategy is changed, then the input available so far is compressed with the
729-
old level and strategy using deflate(strm, Z_BLOCK). There are three
730-
approaches for the compression levels 0, 1..3, and 4..9 respectively. The
731-
new level and strategy will take effect at the next call of deflate().
728+
strategy is changed, and if any input has been consumed in a previous
729+
deflate() call, then the input available so far is compressed with the old
730+
level and strategy using deflate(strm, Z_BLOCK). There are three approaches
731+
for the compression levels 0, 1..3, and 4..9 respectively. The new level
732+
and strategy will take effect at the next call of deflate().
732733
733734
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
734735
not have enough output space to complete, then the parameter change will not

etc/c/zlib/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
ChangeLog file for zlib
33

4+
Changes in 1.2.11 (15 Jan 2017)
5+
- Fix deflate stored bug when pulling last block from window
6+
- Permit immediate deflateParams changes before any deflate input
7+
48
Changes in 1.2.10 (2 Jan 2017)
59
- Avoid warnings on snprintf() return value
610
- Fix bug in deflate_stored() for zero-length input

etc/c/zlib/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ZLIB DATA COMPRESSION LIBRARY
22

3-
zlib 1.2.10 is a general purpose data compression library. All the code is
3+
zlib 1.2.11 is a general purpose data compression library. All the code is
44
thread safe. The data format used by the zlib library is described by RFCs
55
(Request for Comments) 1950 to 1952 in the files
66
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
3131
issue of Dr. Dobb's Journal; a copy of the article is available at
3232
http://marknelson.us/1997/01/01/zlib-engine/ .
3333

34-
The changes made in version 1.2.10 are documented in the file ChangeLog.
34+
The changes made in version 1.2.11 are documented in the file ChangeLog.
3535

3636
Unsupported third party contributions are provided in directory contrib/ .
3737

etc/c/zlib/deflate.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#include "deflate.h"
5353

5454
const char deflate_copyright[] =
55-
" deflate 1.2.10 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
55+
" deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
5656
/*
5757
If you use the zlib library in a product, an acknowledgment is welcome
5858
in the documentation of your product. If for some reason you cannot
@@ -586,7 +586,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
586586
}
587587
func = configuration_table[s->level].func;
588588

589-
if ((strategy != s->strategy || func != configuration_table[level].func)) {
589+
if ((strategy != s->strategy || func != configuration_table[level].func) &&
590+
s->high_water) {
590591
/* Flush the last buffer: */
591592
int err = deflate(strm, Z_BLOCK);
592593
if (err == Z_STREAM_ERROR)
@@ -1671,8 +1672,6 @@ local block_state deflate_stored(s, flush)
16711672
len = left + s->strm->avail_in; /* limit len to the input */
16721673
if (len > have)
16731674
len = have; /* limit len to the output */
1674-
if (left > len)
1675-
left = len; /* limit window pull to len */
16761675

16771676
/* If the stored block would be less than min_block in length, or if
16781677
* unable to copy all of the available input when flushing, then try
@@ -1681,13 +1680,13 @@ local block_state deflate_stored(s, flush)
16811680
*/
16821681
if (len < min_block && ((len == 0 && flush != Z_FINISH) ||
16831682
flush == Z_NO_FLUSH ||
1684-
len - left != s->strm->avail_in))
1683+
len != left + s->strm->avail_in))
16851684
break;
16861685

16871686
/* Make a dummy stored block in pending to get the header bytes,
16881687
* including any pending bits. This also updates the debugging counts.
16891688
*/
1690-
last = flush == Z_FINISH && len - left == s->strm->avail_in ? 1 : 0;
1689+
last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
16911690
_tr_stored_block(s, (char *)0, 0L, last);
16921691

16931692
/* Replace the lengths in the dummy stored block with len. */
@@ -1699,14 +1698,16 @@ local block_state deflate_stored(s, flush)
16991698
/* Write the stored block header bytes. */
17001699
flush_pending(s->strm);
17011700

1702-
/* Update debugging counts for the data about to be copied. */
17031701
#ifdef ZLIB_DEBUG
1702+
/* Update debugging counts for the data about to be copied. */
17041703
s->compressed_len += len << 3;
17051704
s->bits_sent += len << 3;
17061705
#endif
17071706

17081707
/* Copy uncompressed bytes from the window to next_out. */
17091708
if (left) {
1709+
if (left > len)
1710+
left = len;
17101711
zmemcpy(s->strm->next_out, s->window + s->block_start, left);
17111712
s->strm->next_out += left;
17121713
s->strm->avail_out -= left;
@@ -1756,6 +1757,8 @@ local block_state deflate_stored(s, flush)
17561757
s->block_start = s->strstart;
17571758
s->insert += MIN(used, s->w_size - s->insert);
17581759
}
1760+
if (s->high_water < s->strstart)
1761+
s->high_water = s->strstart;
17591762

17601763
/* If the last block was written to next_out, then done. */
17611764
if (last)
@@ -1783,6 +1786,8 @@ local block_state deflate_stored(s, flush)
17831786
read_buf(s->strm, s->window + s->strstart, have);
17841787
s->strstart += have;
17851788
}
1789+
if (s->high_water < s->strstart)
1790+
s->high_water = s->strstart;
17861791

17871792
/* There was not enough avail_out to write a complete worthy or flushed
17881793
* stored block to next_out. Write a stored block to pending instead, if we

etc/c/zlib/gzlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* gzlib.c -- zlib functions common to reading and writing gzip files
2-
* Copyright (C) 2004, 2010, 2011, 2012, 2013, 2016 Mark Adler
2+
* Copyright (C) 2004-2017 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

etc/c/zlib/gzwrite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* gzwrite.c -- zlib functions for writing gzip files
2-
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
2+
* Copyright (C) 2004-2017 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

etc/c/zlib/inffast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* inffast.c -- fast decoding
2-
* Copyright (C) 1995-2008, 2010, 2013, 2016 Mark Adler
2+
* Copyright (C) 1995-2017 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

etc/c/zlib/inftrees.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define MAXBITS 15
1010

1111
const char inflate_copyright[] =
12-
" inflate 1.2.10 Copyright 1995-2017 Mark Adler ";
12+
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
1313
/*
1414
If you use the zlib library in a product, an acknowledgment is welcome
1515
in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
6262
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
6363
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
6464
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65-
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 202};
65+
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
6666
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
6767
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
6868
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

etc/c/zlib/trees.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* trees.c -- output deflated data using Huffman coding
2-
* Copyright (C) 1995-2016 Jean-loup Gailly
2+
* Copyright (C) 1995-2017 Jean-loup Gailly
33
* detect_data_type() function provided freely by Cosmin Truta, 2006
44
* For conditions of distribution and use, see copyright notice in zlib.h
55
*/
@@ -906,7 +906,7 @@ void ZLIB_INTERNAL _tr_align(s)
906906

907907
/* ===========================================================================
908908
* Determine the best encoding for the current block: dynamic trees, static
909-
* trees or store, and output the encoded block to the zip file.
909+
* trees or store, and write out the encoded block.
910910
*/
911911
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
912912
deflate_state *s;

etc/c/zlib/zlib.3

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH ZLIB 3 "2 Jan 2017"
1+
.TH ZLIB 3 "15 Jan 2017"
22
.SH NAME
33
zlib \- compression/decompression library
44
.SH SYNOPSIS
@@ -105,7 +105,7 @@ before asking for help.
105105
Send questions and/or comments to zlib@gzip.org,
106106
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
107107
.SH AUTHORS AND LICENSE
108-
Version 1.2.10
108+
Version 1.2.11
109109
.LP
110110
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
111111
.LP

0 commit comments

Comments
 (0)