diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2017-01-15 08:15:55 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2017-01-15 09:29:27 -0800 |
commit | 7d9c9d410a7f8c732fdb0cac2b268659d624a6b6 (patch) | |
tree | 28364d8e65fd21ae538277caa0b306c6cb25d181 | |
parent | 37ed2112a1727293f4fd431df85dc821ee475d3d (diff) | |
download | zlib-7d9c9d410a7f8c732fdb0cac2b268659d624a6b6.tar.gz zlib-7d9c9d410a7f8c732fdb0cac2b268659d624a6b6.tar.bz2 zlib-7d9c9d410a7f8c732fdb0cac2b268659d624a6b6.zip |
Update high water mark in deflate_stored.
This avoids unnecessary filling of bytes in the sliding window
buffer when switching from level zero to a non-zero level. This
also provides a consistent indication of deflate having taken
input for a later commit ...
-rw-r--r-- | deflate.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1756,6 +1756,8 @@ local block_state deflate_stored(s, flush) | |||
1756 | s->block_start = s->strstart; | 1756 | s->block_start = s->strstart; |
1757 | s->insert += MIN(used, s->w_size - s->insert); | 1757 | s->insert += MIN(used, s->w_size - s->insert); |
1758 | } | 1758 | } |
1759 | if (s->high_water < s->strstart) | ||
1760 | s->high_water = s->strstart; | ||
1759 | 1761 | ||
1760 | /* If the last block was written to next_out, then done. */ | 1762 | /* If the last block was written to next_out, then done. */ |
1761 | if (last) | 1763 | if (last) |
@@ -1783,6 +1785,8 @@ local block_state deflate_stored(s, flush) | |||
1783 | read_buf(s->strm, s->window + s->strstart, have); | 1785 | read_buf(s->strm, s->window + s->strstart, have); |
1784 | s->strstart += have; | 1786 | s->strstart += have; |
1785 | } | 1787 | } |
1788 | if (s->high_water < s->strstart) | ||
1789 | s->high_water = s->strstart; | ||
1786 | 1790 | ||
1787 | /* There was not enough avail_out to write a complete worthy or flushed | 1791 | /* There was not enough avail_out to write a complete worthy or flushed |
1788 | * stored block to next_out. Write a stored block to pending instead, if we | 1792 | * stored block to next_out. Write a stored block to pending instead, if we |