View | Details | Raw Unified | Return to bug 1046197
Collapse All | Expand All

(-)zlib-1.2.8/deflate.c (-1 / +32 lines)
Lines 51-56 Link Here
51
51
52
#include "deflate.h"
52
#include "deflate.h"
53
53
54
#define read_buf dread_buf
55
54
const char deflate_copyright[] =
56
const char deflate_copyright[] =
55
   " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
57
   " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
56
/*
58
/*
Lines 670-676 Link Here
670
    deflate_state *s;
672
    deflate_state *s;
671
673
672
    if (strm == Z_NULL || strm->state == Z_NULL ||
674
    if (strm == Z_NULL || strm->state == Z_NULL ||
673
        flush > Z_BLOCK || flush < 0) {
675
        (flush > Z_BLOCK && flush != Z_INSERT_ONLY) || flush < 0) {
674
        return Z_STREAM_ERROR;
676
        return Z_STREAM_ERROR;
675
    }
677
    }
676
    s = strm->state;
678
    s = strm->state;
Lines 1593-1598 Link Here
1593
        s->strstart += s->lookahead;
1595
        s->strstart += s->lookahead;
1594
        s->lookahead = 0;
1596
        s->lookahead = 0;
1595
1597
1598
	if (flush == Z_INSERT_ONLY) {
1599
	    s->block_start = s->strstart;
1600
	    continue;
1601
	}
1602
1596
        /* Emit a stored block if pending_buf will be full: */
1603
        /* Emit a stored block if pending_buf will be full: */
1597
        max_start = s->block_start + max_block_size;
1604
        max_start = s->block_start + max_block_size;
1598
        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
1605
        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
Lines 1609-1614 Link Here
1609
        }
1616
        }
1610
    }
1617
    }
1611
    s->insert = 0;
1618
    s->insert = 0;
1619
    if (flush == Z_INSERT_ONLY) {
1620
	s->block_start = s->strstart;
1621
	return need_more;
1622
    }
1612
    if (flush == Z_FINISH) {
1623
    if (flush == Z_FINISH) {
1613
        FLUSH_BLOCK(s, 1);
1624
        FLUSH_BLOCK(s, 1);
1614
        return finish_done;
1625
        return finish_done;
Lines 1654-1659 Link Here
1654
            INSERT_STRING(s, s->strstart, hash_head);
1665
            INSERT_STRING(s, s->strstart, hash_head);
1655
        }
1666
        }
1656
1667
1668
	if (flush == Z_INSERT_ONLY) {
1669
	    s->strstart++;
1670
	    s->lookahead--;
1671
	    continue;
1672
	}
1673
1657
        /* Find the longest match, discarding those <= prev_length.
1674
        /* Find the longest match, discarding those <= prev_length.
1658
         * At this point we have always match_length < MIN_MATCH
1675
         * At this point we have always match_length < MIN_MATCH
1659
         */
1676
         */
Lines 1711-1716 Link Here
1711
        }
1728
        }
1712
        if (bflush) FLUSH_BLOCK(s, 0);
1729
        if (bflush) FLUSH_BLOCK(s, 0);
1713
    }
1730
    }
1731
    if (flush == Z_INSERT_ONLY) {
1732
	s->block_start = s->strstart;
1733
	return need_more;
1734
    }
1714
    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
1735
    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
1715
    if (flush == Z_FINISH) {
1736
    if (flush == Z_FINISH) {
1716
        FLUSH_BLOCK(s, 1);
1737
        FLUSH_BLOCK(s, 1);
Lines 1757-1762 Link Here
1757
            INSERT_STRING(s, s->strstart, hash_head);
1778
            INSERT_STRING(s, s->strstart, hash_head);
1758
        }
1779
        }
1759
1780
1781
	if (flush == Z_INSERT_ONLY) {
1782
	    s->strstart++;
1783
	    s->lookahead--;
1784
	    continue;
1785
	}
1786
1760
        /* Find the longest match, discarding those <= prev_length.
1787
        /* Find the longest match, discarding those <= prev_length.
1761
         */
1788
         */
1762
        s->prev_length = s->match_length, s->prev_match = s->match_start;
1789
        s->prev_length = s->match_length, s->prev_match = s->match_start;
Lines 1836-1841 Link Here
1836
            s->lookahead--;
1863
            s->lookahead--;
1837
        }
1864
        }
1838
    }
1865
    }
1866
    if (flush == Z_INSERT_ONLY) {
1867
	s->block_start = s->strstart;
1868
	return need_more;
1869
    }
1839
    Assert (flush != Z_NO_FLUSH, "no flush?");
1870
    Assert (flush != Z_NO_FLUSH, "no flush?");
1840
    if (s->match_available) {
1871
    if (s->match_available) {
1841
        Tracevv((stderr,"%c", s->window[s->strstart-1]));
1872
        Tracevv((stderr,"%c", s->window[s->strstart-1]));
(-)zlib-1.2.8/zlib.h (+1 lines)
Lines 169-174 Link Here
169
#define Z_BLOCK         5
169
#define Z_BLOCK         5
170
#define Z_TREES         6
170
#define Z_TREES         6
171
/* Allowed flush values; see deflate() and inflate() below for details */
171
/* Allowed flush values; see deflate() and inflate() below for details */
172
#define Z_INSERT_ONLY	7
172
173
173
#define Z_OK            0
174
#define Z_OK            0
174
#define Z_STREAM_END    1
175
#define Z_STREAM_END    1

Return to bug 1046197