Lines Matching refs:s

73 typedef block_state (*compress_func) OF((deflate_state *s, int flush));
76 local void fill_window OF((deflate_state *s));
77 local block_state deflate_stored OF((deflate_state *s, int flush));
78 local block_state deflate_fast OF((deflate_state *s, int flush));
80 local block_state deflate_slow OF((deflate_state *s, int flush));
82 local block_state deflate_rle OF((deflate_state *s, int flush));
83 local block_state deflate_huff OF((deflate_state *s, int flush));
84 local void lm_init OF((deflate_state *s));
85 local void putShortMSB OF((deflate_state *s, uInt b));
90 uInt longest_match OF((deflate_state *s, IPos cur_match));
92 local uInt longest_match OF((deflate_state *s, IPos cur_match));
96 local void check_match OF((deflate_state *s, IPos start, IPos match,
164 #define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask) argument
178 #define INSERT_STRING(s, str, match_head) \ argument
179 (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
180 match_head = s->head[s->ins_h], \
181 s->head[s->ins_h] = (Pos)(str))
183 #define INSERT_STRING(s, str, match_head) \ argument
184 (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
185 match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
186 s->head[s->ins_h] = (Pos)(str))
193 #define CLEAR_HASH(s) \ argument
194 s->head[s->hash_size-1] = NIL; \
195 zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
221 deflate_state *s; local
265 s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
266 if (s == Z_NULL) return Z_MEM_ERROR;
267 strm->state = (struct internal_state FAR *)s;
268 s->strm = strm;
270 s->wrap = wrap;
271 s->gzhead = Z_NULL;
272 s->w_bits = windowBits;
273 s->w_size = 1 << s->w_bits;
274 s->w_mask = s->w_size - 1;
276 s->hash_bits = memLevel + 7;
277 s->hash_size = 1 << s->hash_bits;
278 s->hash_mask = s->hash_size - 1;
279 s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
281 s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
282 s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
283 s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
285 s->high_water = 0; /* nothing written to s->window yet */
287 s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
289 overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
290 s->pending_buf = (uchf *) overlay;
291 s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
293 if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
294 s->pending_buf == Z_NULL) {
295 s->status = FINISH_STATE;
300 s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
301 s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
303 s->level = level;
304 s->strategy = strategy;
305 s->method = (Byte)method;
316 deflate_state *s; local
326 s = strm->state;
327 if (s->wrap)
331 if (length > s->w_size) {
332 length = s->w_size;
335 zmemcpy(s->window, dictionary, length);
336 s->strstart = length;
337 s->block_start = (long)length;
343 s->ins_h = s->window[0];
344 UPDATE_HASH(s, s->ins_h, s->window[1]);
346 INSERT_STRING(s, n, hash_head);
356 deflate_state *s; local
367 s = (deflate_state *)strm->state;
368 s->pending = 0;
369 s->pending_out = s->pending_buf;
371 if (s->wrap < 0) {
372 s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
374 s->status = s->wrap ? INIT_STATE : BUSY_STATE;
377 s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
380 s->last_flush = Z_NO_FLUSH;
382 _tr_init(s);
383 lm_init(s);
417 deflate_state *s; local
422 s = strm->state;
432 func = configuration_table[s->level].func;
434 if ((strategy != s->strategy || func != configuration_table[level].func) &&
439 if (s->level != level) {
440 s->level = level;
441 s->max_lazy_match = configuration_table[level].max_lazy;
442 s->good_match = configuration_table[level].good_length;
443 s->nice_match = configuration_table[level].nice_length;
444 s->max_chain_length = configuration_table[level].max_chain;
446 s->strategy = strategy;
458 deflate_state *s; local
461 s = strm->state;
462 s->good_match = good_length;
463 s->max_lazy_match = max_lazy;
464 s->nice_match = nice_length;
465 s->max_chain_length = max_chain;
490 deflate_state *s; local
503 s = strm->state;
504 switch (s->wrap) {
509 wraplen = 6 + (s->strstart ? 4 : 0);
513 if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
514 if (s->gzhead->extra != Z_NULL)
515 wraplen += 2 + s->gzhead->extra_len;
516 str = s->gzhead->name;
521 str = s->gzhead->comment;
526 if (s->gzhead->hcrc)
535 if (s->w_bits != 15 || s->hash_bits != 8 + 7)
548 local void putShortMSB (s, b) in putShortMSB() argument
549 deflate_state *s; in putShortMSB()
552 put_byte(s, (Byte)(b >> 8));
553 put_byte(s, (Byte)(b & 0xff));
587 deflate_state *s; local
593 s = strm->state;
595 if (s->status == FINISH_STATE && flush != Z_FINISH) {
600 s->strm = strm; /* just in case */
601 old_flush = s->last_flush;
602 s->last_flush = flush;
605 if (s->status == INIT_STATE) {
607 if (s->wrap == 2) {
609 put_byte(s, 31);
610 put_byte(s, 139);
611 put_byte(s, 8);
612 if (s->gzhead == Z_NULL) {
613 put_byte(s, 0);
614 put_byte(s, 0);
615 put_byte(s, 0);
616 put_byte(s, 0);
617 put_byte(s, 0);
618 put_byte(s, s->level == 9 ? 2 :
619 (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
621 put_byte(s, OS_CODE);
622 s->status = BUSY_STATE;
625 put_byte(s, (s->gzhead->text ? 1 : 0) +
626 (s->gzhead->hcrc ? 2 : 0) +
627 (s->gzhead->extra == Z_NULL ? 0 : 4) +
628 (s->gzhead->name == Z_NULL ? 0 : 8) +
629 (s->gzhead->comment == Z_NULL ? 0 : 16)
631 put_byte(s, (Byte)(s->gzhead->time & 0xff));
632 put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
633 put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
634 put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
635 put_byte(s, s->level == 9 ? 2 :
636 (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
638 put_byte(s, s->gzhead->os & 0xff);
639 if (s->gzhead->extra != Z_NULL) {
640 put_byte(s, s->gzhead->extra_len & 0xff);
641 put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
643 if (s->gzhead->hcrc)
644 strm->adler = crc32(strm->adler, s->pending_buf,
645 s->pending);
646 s->gzindex = 0;
647 s->status = EXTRA_STATE;
653 uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
656 if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
658 else if (s->level < 6)
660 else if (s->level == 6)
665 if (s->strstart != 0) header |= PRESET_DICT;
668 s->status = BUSY_STATE;
669 putShortMSB(s, header);
672 if (s->strstart != 0) {
673 putShortMSB(s, (uInt)(strm->adler >> 16));
674 putShortMSB(s, (uInt)(strm->adler & 0xffff));
680 if (s->status == EXTRA_STATE) {
681 if (s->gzhead->extra != Z_NULL) {
682 uInt beg = s->pending; /* start of bytes to update crc */
684 while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
685 if (s->pending == s->pending_buf_size) {
686 if (s->gzhead->hcrc && s->pending > beg)
687 strm->adler = crc32(strm->adler, s->pending_buf + beg,
688 s->pending - beg);
690 beg = s->pending;
691 if (s->pending == s->pending_buf_size)
694 put_byte(s, s->gzhead->extra[s->gzindex]);
695 s->gzindex++;
697 if (s->gzhead->hcrc && s->pending > beg)
698 strm->adler = crc32(strm->adler, s->pending_buf + beg,
699 s->pending - beg);
700 if (s->gzindex == s->gzhead->extra_len) {
701 s->gzindex = 0;
702 s->status = NAME_STATE;
706 s->status = NAME_STATE;
708 if (s->status == NAME_STATE) {
709 if (s->gzhead->name != Z_NULL) {
710 uInt beg = s->pending; /* start of bytes to update crc */
714 if (s->pending == s->pending_buf_size) {
715 if (s->gzhead->hcrc && s->pending > beg)
716 strm->adler = crc32(strm->adler, s->pending_buf + beg,
717 s->pending - beg);
719 beg = s->pending;
720 if (s->pending == s->pending_buf_size) {
725 val = s->gzhead->name[s->gzindex++];
726 put_byte(s, val);
728 if (s->gzhead->hcrc && s->pending > beg)
729 strm->adler = crc32(strm->adler, s->pending_buf + beg,
730 s->pending - beg);
732 s->gzindex = 0;
733 s->status = COMMENT_STATE;
737 s->status = COMMENT_STATE;
739 if (s->status == COMMENT_STATE) {
740 if (s->gzhead->comment != Z_NULL) {
741 uInt beg = s->pending; /* start of bytes to update crc */
745 if (s->pending == s->pending_buf_size) {
746 if (s->gzhead->hcrc && s->pending > beg)
747 strm->adler = crc32(strm->adler, s->pending_buf + beg,
748 s->pending - beg);
750 beg = s->pending;
751 if (s->pending == s->pending_buf_size) {
756 val = s->gzhead->comment[s->gzindex++];
757 put_byte(s, val);
759 if (s->gzhead->hcrc && s->pending > beg)
760 strm->adler = crc32(strm->adler, s->pending_buf + beg,
761 s->pending - beg);
763 s->status = HCRC_STATE;
766 s->status = HCRC_STATE;
768 if (s->status == HCRC_STATE) {
769 if (s->gzhead->hcrc) {
770 if (s->pending + 2 > s->pending_buf_size)
772 if (s->pending + 2 <= s->pending_buf_size) {
773 put_byte(s, (Byte)(strm->adler & 0xff));
774 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
776 s->status = BUSY_STATE;
780 s->status = BUSY_STATE;
785 if (s->pending != 0) {
794 s->last_flush = -1;
808 if (s->status == FINISH_STATE && strm->avail_in != 0) {
814 if (strm->avail_in != 0 || s->lookahead != 0 ||
815 (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
818 bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
819 (s->strategy == Z_RLE ? deflate_rle(s, flush) :
820 (*(configuration_table[s->level].func))(s, flush));
823 s->status = FINISH_STATE;
827 s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
840 _tr_align(s);
842 _tr_stored_block(s, (char*)0, 0L, 0);
847 CLEAR_HASH(s); /* forget history */
848 if (s->lookahead == 0) {
849 s->strstart = 0;
850 s->block_start = 0L;
856 s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
864 if (s->wrap <= 0) return Z_STREAM_END;
868 if (s->wrap == 2) {
869 put_byte(s, (Byte)(strm->adler & 0xff));
870 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
871 put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
872 put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
873 put_byte(s, (Byte)(strm->total_in & 0xff));
874 put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
875 put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
876 put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
881 putShortMSB(s, (uInt)(strm->adler >> 16));
882 putShortMSB(s, (uInt)(strm->adler & 0xffff));
888 if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
889 return s->pending != 0 ? Z_OK : Z_STREAM_END;
1020 local void lm_init (s) in lm_init() argument
1021 deflate_state *s; in lm_init()
1023 s->window_size = (ulg)2L*s->w_size;
1025 CLEAR_HASH(s);
1029 s->max_lazy_match = configuration_table[s->level].max_lazy;
1030 s->good_match = configuration_table[s->level].good_length;
1031 s->nice_match = configuration_table[s->level].nice_length;
1032 s->max_chain_length = configuration_table[s->level].max_chain;
1034 s->strstart = 0;
1035 s->block_start = 0L;
1036 s->lookahead = 0;
1037 s->match_length = s->prev_length = MIN_MATCH-1;
1038 s->match_available = 0;
1039 s->ins_h = 0;
1061 local uInt longest_match(s, cur_match) in longest_match() argument
1062 deflate_state *s; in longest_match()
1065 unsigned chain_length = s->max_chain_length;/* max hash chain length */
1066 register Bytef *scan = s->window + s->strstart; /* current string */
1069 int best_len = s->prev_length; /* best match length so far */
1070 int nice_match = s->nice_match; /* stop if match long enough */
1071 IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
1072 s->strstart - (IPos)MAX_DIST(s) : NIL;
1076 Posf *prev = s->prev;
1077 uInt wmask = s->w_mask;
1083 register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
1087 register Bytef *strend = s->window + s->strstart + MAX_MATCH;
1095 Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
1098 if (s->prev_length >= s->good_match) {
1104 if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
1106 Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
1109 Assert(cur_match < s->strstart, "no future");
1110 match = s->window + cur_match;
1147 Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
1179 Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
1187 s->match_start = cur_match;
1200 if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
1201 return s->lookahead;
1210 local uInt longest_match(s, cur_match) in longest_match() argument
1211 deflate_state *s; in longest_match()
1214 register Bytef *scan = s->window + s->strstart; /* current string */
1217 register Bytef *strend = s->window + s->strstart + MAX_MATCH;
1222 Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
1224 Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
1226 Assert(cur_match < s->strstart, "no future");
1228 match = s->window + cur_match;
1253 Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
1259 s->match_start = cur_match;
1260 return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
1269 local void check_match(s, start, match, length) in check_match() argument
1270 deflate_state *s; in check_match()
1275 if (zmemcmp(s->window + match,
1276 s->window + start, length) != EQUAL) {
1280 fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
1286 do { putc(s->window[start++], stderr); } while (--length != 0);
1290 # define check_match(s, start, match, length) argument
1303 local void fill_window(s) in fill_window() argument
1304 deflate_state *s; in fill_window()
1309 uInt wsize = s->w_size;
1312 more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
1316 if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
1330 if (s->strstart >= wsize+MAX_DIST(s)) {
1332 zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
1333 s->match_start -= wsize;
1334 s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
1335 s->block_start -= (long) wsize;
1343 n = s->hash_size;
1344 p = &s->head[n];
1352 p = &s->prev[n];
1363 if (s->strm->avail_in == 0) return;
1378 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1379 s->lookahead += n;
1382 if (s->lookahead >= MIN_MATCH) {
1383 s->ins_h = s->window[s->strstart];
1384 UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
1393 } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
1402 if (s->high_water < s->window_size) {
1403 ulg curr = s->strstart + (ulg)(s->lookahead);
1406 if (s->high_water < curr) {
1410 init = s->window_size - curr;
1413 zmemzero(s->window + curr, (unsigned)init);
1414 s->high_water = curr + init;
1416 else if (s->high_water < (ulg)curr + WIN_INIT) {
1421 init = (ulg)curr + WIN_INIT - s->high_water;
1422 if (init > s->window_size - s->high_water)
1423 init = s->window_size - s->high_water;
1424 zmemzero(s->window + s->high_water, (unsigned)init);
1425 s->high_water += init;
1434 #define FLUSH_BLOCK_ONLY(s, last) { \ argument
1435 _tr_flush_block(s, (s->block_start >= 0L ? \
1436 (charf *)&s->window[(unsigned)s->block_start] : \
1438 (ulg)((long)s->strstart - s->block_start), \
1440 s->block_start = s->strstart; \
1441 flush_pending(s->strm); \
1446 #define FLUSH_BLOCK(s, last) { \ argument
1447 FLUSH_BLOCK_ONLY(s, last); \
1448 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1460 local block_state deflate_stored(s, flush) in deflate_stored() argument
1461 deflate_state *s; in deflate_stored()
1470 if (max_block_size > s->pending_buf_size - 5) {
1471 max_block_size = s->pending_buf_size - 5;
1477 if (s->lookahead <= 1) {
1479 Assert(s->strstart < s->w_size+MAX_DIST(s) ||
1480 s->block_start >= (long)s->w_size, "slide too late");
1482 fill_window(s);
1483 if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
1485 if (s->lookahead == 0) break; /* flush the current block */
1487 Assert(s->block_start >= 0L, "block gone");
1489 s->strstart += s->lookahead;
1490 s->lookahead = 0;
1493 max_start = s->block_start + max_block_size;
1494 if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
1496 s->lookahead = (uInt)(s->strstart - max_start);
1497 s->strstart = (uInt)max_start;
1498 FLUSH_BLOCK(s, 0);
1503 if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
1504 FLUSH_BLOCK(s, 0);
1507 FLUSH_BLOCK(s, flush == Z_FINISH);
1518 local block_state deflate_fast(s, flush) in deflate_fast() argument
1519 deflate_state *s; in deflate_fast()
1531 if (s->lookahead < MIN_LOOKAHEAD) {
1532 fill_window(s);
1533 if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
1536 if (s->lookahead == 0) break; /* flush the current block */
1543 if (s->lookahead >= MIN_MATCH) {
1544 INSERT_STRING(s, s->strstart, hash_head);
1550 if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
1555 s->match_length = longest_match (s, hash_head);
1558 if (s->match_length >= MIN_MATCH) {
1559 check_match(s, s->strstart, s->match_start, s->match_length);
1561 _tr_tally_dist(s, s->strstart - s->match_start,
1562 s->match_length - MIN_MATCH, bflush);
1564 s->lookahead -= s->match_length;
1570 if (s->match_length <= s->max_insert_length &&
1571 s->lookahead >= MIN_MATCH) {
1572 s->match_length--; /* string at strstart already in table */
1574 s->strstart++;
1575 INSERT_STRING(s, s->strstart, hash_head);
1579 } while (--s->match_length != 0);
1580 s->strstart++;
1584 s->strstart += s->match_length;
1585 s->match_length = 0;
1586 s->ins_h = s->window[s->strstart];
1587 UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
1597 Tracevv((stderr,"%c", s->window[s->strstart]));
1598 _tr_tally_lit (s, s->window[s->strstart], bflush);
1599 s->lookahead--;
1600 s->strstart++;
1602 if (bflush) FLUSH_BLOCK(s, 0);
1604 FLUSH_BLOCK(s, flush == Z_FINISH);
1614 local block_state deflate_slow(s, flush) in deflate_slow() argument
1615 deflate_state *s; in deflate_slow()
1628 if (s->lookahead < MIN_LOOKAHEAD) {
1629 fill_window(s);
1630 if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
1633 if (s->lookahead == 0) break; /* flush the current block */
1640 if (s->lookahead >= MIN_MATCH) {
1641 INSERT_STRING(s, s->strstart, hash_head);
1646 s->prev_length = s->match_length, s->prev_match = s->match_start;
1647 s->match_length = MIN_MATCH-1;
1649 if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
1650 s->strstart - hash_head <= MAX_DIST(s)) {
1655 s->match_length = longest_match (s, hash_head);
1658 if (s->match_length <= 5 && (s->strategy == Z_FILTERED
1660 || (s->match_length == MIN_MATCH &&
1661 s->strstart - s->match_start > TOO_FAR)
1668 s->match_length = MIN_MATCH-1;
1674 if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
1675 uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
1678 check_match(s, s->strstart-1, s->prev_match, s->prev_length);
1680 _tr_tally_dist(s, s->strstart -1 - s->prev_match,
1681 s->prev_length - MIN_MATCH, bflush);
1688 s->lookahead -= s->prev_length-1;
1689 s->prev_length -= 2;
1691 if (++s->strstart <= max_insert) {
1692 INSERT_STRING(s, s->strstart, hash_head);
1694 } while (--s->prev_length != 0);
1695 s->match_available = 0;
1696 s->match_length = MIN_MATCH-1;
1697 s->strstart++;
1699 if (bflush) FLUSH_BLOCK(s, 0);
1701 } else if (s->match_available) {
1706 Tracevv((stderr,"%c", s->window[s->strstart-1]));
1707 _tr_tally_lit(s, s->window[s->strstart-1], bflush);
1709 FLUSH_BLOCK_ONLY(s, 0);
1711 s->strstart++;
1712 s->lookahead--;
1713 if (s->strm->avail_out == 0) return need_more;
1718 s->match_available = 1;
1719 s->strstart++;
1720 s->lookahead--;
1724 if (s->match_available) {
1725 Tracevv((stderr,"%c", s->window[s->strstart-1]));
1726 _tr_tally_lit(s, s->window[s->strstart-1], bflush);
1727 s->match_available = 0;
1729 FLUSH_BLOCK(s, flush == Z_FINISH);
1739 local block_state deflate_rle(s, flush) in deflate_rle() argument
1740 deflate_state *s; in deflate_rle()
1752 if (s->lookahead < MAX_MATCH) {
1753 fill_window(s);
1754 if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
1757 if (s->lookahead == 0) break; /* flush the current block */
1761 s->match_length = 0;
1762 if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
1763 scan = s->window + s->strstart - 1;
1766 strend = s->window + s->strstart + MAX_MATCH;
1773 s->match_length = MAX_MATCH - (int)(strend - scan);
1774 if (s->match_length > s->lookahead)
1775 s->match_length = s->lookahead;
1780 if (s->match_length >= MIN_MATCH) {
1781 check_match(s, s->strstart, s->strstart - 1, s->match_length);
1783 _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
1785 s->lookahead -= s->match_length;
1786 s->strstart += s->match_length;
1787 s->match_length = 0;
1790 Tracevv((stderr,"%c", s->window[s->strstart]));
1791 _tr_tally_lit (s, s->window[s->strstart], bflush);
1792 s->lookahead--;
1793 s->strstart++;
1795 if (bflush) FLUSH_BLOCK(s, 0);
1797 FLUSH_BLOCK(s, flush == Z_FINISH);
1805 local block_state deflate_huff(s, flush) in deflate_huff() argument
1806 deflate_state *s; in deflate_huff()
1813 if (s->lookahead == 0) {
1814 fill_window(s);
1815 if (s->lookahead == 0) {
1823 s->match_length = 0;
1824 Tracevv((stderr,"%c", s->window[s->strstart]));
1825 _tr_tally_lit (s, s->window[s->strstart], bflush);
1826 s->lookahead--;
1827 s->strstart++;
1828 if (bflush) FLUSH_BLOCK(s, 0);
1830 FLUSH_BLOCK(s, flush == Z_FINISH);