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;
597 (s->status == FINISH_STATE && flush != Z_FINISH)) {
602 s->strm = strm; /* just in case */
603 old_flush = s->last_flush;
604 s->last_flush = flush;
607 if (s->status == INIT_STATE) {
609 if (s->wrap == 2) {
611 put_byte(s, 31);
612 put_byte(s, 139);
613 put_byte(s, 8);
614 if (s->gzhead == Z_NULL) {
615 put_byte(s, 0);
616 put_byte(s, 0);
617 put_byte(s, 0);
618 put_byte(s, 0);
619 put_byte(s, 0);
620 put_byte(s, s->level == 9 ? 2 :
621 (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
623 put_byte(s, OS_CODE);
624 s->status = BUSY_STATE;
627 put_byte(s, (s->gzhead->text ? 1 : 0) +
628 (s->gzhead->hcrc ? 2 : 0) +
629 (s->gzhead->extra == Z_NULL ? 0 : 4) +
630 (s->gzhead->name == Z_NULL ? 0 : 8) +
631 (s->gzhead->comment == Z_NULL ? 0 : 16)
633 put_byte(s, (Byte)(s->gzhead->time & 0xff));
634 put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
635 put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
636 put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
637 put_byte(s, s->level == 9 ? 2 :
638 (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
640 put_byte(s, s->gzhead->os & 0xff);
641 if (s->gzhead->extra != Z_NULL) {
642 put_byte(s, s->gzhead->extra_len & 0xff);
643 put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
645 if (s->gzhead->hcrc)
646 strm->adler = crc32(strm->adler, s->pending_buf,
647 s->pending);
648 s->gzindex = 0;
649 s->status = EXTRA_STATE;
655 uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
658 if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
660 else if (s->level < 6)
662 else if (s->level == 6)
667 if (s->strstart != 0) header |= PRESET_DICT;
670 s->status = BUSY_STATE;
671 putShortMSB(s, header);
674 if (s->strstart != 0) {
675 putShortMSB(s, (uInt)(strm->adler >> 16));
676 putShortMSB(s, (uInt)(strm->adler & 0xffff));
682 if (s->status == EXTRA_STATE) {
683 if (s->gzhead->extra != Z_NULL) {
684 uInt beg = s->pending; /* start of bytes to update crc */
686 while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
687 if (s->pending == s->pending_buf_size) {
688 if (s->gzhead->hcrc && s->pending > beg)
689 strm->adler = crc32(strm->adler, s->pending_buf + beg,
690 s->pending - beg);
692 beg = s->pending;
693 if (s->pending == s->pending_buf_size)
696 put_byte(s, s->gzhead->extra[s->gzindex]);
697 s->gzindex++;
699 if (s->gzhead->hcrc && s->pending > beg)
700 strm->adler = crc32(strm->adler, s->pending_buf + beg,
701 s->pending - beg);
702 if (s->gzindex == s->gzhead->extra_len) {
703 s->gzindex = 0;
704 s->status = NAME_STATE;
708 s->status = NAME_STATE;
710 if (s->status == NAME_STATE) {
711 if (s->gzhead->name != Z_NULL) {
712 uInt beg = s->pending; /* start of bytes to update crc */
716 if (s->pending == s->pending_buf_size) {
717 if (s->gzhead->hcrc && s->pending > beg)
718 strm->adler = crc32(strm->adler, s->pending_buf + beg,
719 s->pending - beg);
721 beg = s->pending;
722 if (s->pending == s->pending_buf_size) {
727 val = s->gzhead->name[s->gzindex++];
728 put_byte(s, val);
730 if (s->gzhead->hcrc && s->pending > beg)
731 strm->adler = crc32(strm->adler, s->pending_buf + beg,
732 s->pending - beg);
734 s->gzindex = 0;
735 s->status = COMMENT_STATE;
739 s->status = COMMENT_STATE;
741 if (s->status == COMMENT_STATE) {
742 if (s->gzhead->comment != Z_NULL) {
743 uInt beg = s->pending; /* start of bytes to update crc */
747 if (s->pending == s->pending_buf_size) {
748 if (s->gzhead->hcrc && s->pending > beg)
749 strm->adler = crc32(strm->adler, s->pending_buf + beg,
750 s->pending - beg);
752 beg = s->pending;
753 if (s->pending == s->pending_buf_size) {
758 val = s->gzhead->comment[s->gzindex++];
759 put_byte(s, val);
761 if (s->gzhead->hcrc && s->pending > beg)
762 strm->adler = crc32(strm->adler, s->pending_buf + beg,
763 s->pending - beg);
765 s->status = HCRC_STATE;
768 s->status = HCRC_STATE;
770 if (s->status == HCRC_STATE) {
771 if (s->gzhead->hcrc) {
772 if (s->pending + 2 > s->pending_buf_size)
774 if (s->pending + 2 <= s->pending_buf_size) {
775 put_byte(s, (Byte)(strm->adler & 0xff));
776 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
778 s->status = BUSY_STATE;
782 s->status = BUSY_STATE;
787 if (s->pending != 0) {
796 s->last_flush = -1;
810 if (s->status == FINISH_STATE && strm->avail_in != 0) {
816 if (strm->avail_in != 0 || s->lookahead != 0 ||
817 (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
820 bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
821 (s->strategy == Z_RLE ? deflate_rle(s, flush) :
822 (*(configuration_table[s->level].func))(s, flush));
825 s->status = FINISH_STATE;
829 s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
842 _tr_align(s);
844 _tr_stored_block(s, (char*)0, 0L, 0);
849 CLEAR_HASH(s); /* forget history */
850 if (s->lookahead == 0) {
851 s->strstart = 0;
852 s->block_start = 0L;
858 s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
866 if (s->wrap <= 0) return Z_STREAM_END;
870 if (s->wrap == 2) {
871 put_byte(s, (Byte)(strm->adler & 0xff));
872 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
873 put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
874 put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
875 put_byte(s, (Byte)(strm->total_in & 0xff));
876 put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
877 put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
878 put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
883 putShortMSB(s, (uInt)(strm->adler >> 16));
884 putShortMSB(s, (uInt)(strm->adler & 0xffff));
890 if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
891 return s->pending != 0 ? Z_OK : Z_STREAM_END;
1022 local void lm_init (s) in lm_init() argument
1023 deflate_state *s; in lm_init()
1025 s->window_size = (ulg)2L*s->w_size;
1027 CLEAR_HASH(s);
1031 s->max_lazy_match = configuration_table[s->level].max_lazy;
1032 s->good_match = configuration_table[s->level].good_length;
1033 s->nice_match = configuration_table[s->level].nice_length;
1034 s->max_chain_length = configuration_table[s->level].max_chain;
1036 s->strstart = 0;
1037 s->block_start = 0L;
1038 s->lookahead = 0;
1039 s->match_length = s->prev_length = MIN_MATCH-1;
1040 s->match_available = 0;
1041 s->ins_h = 0;
1063 local uInt longest_match(s, cur_match) in longest_match() argument
1064 deflate_state *s; in longest_match()
1067 unsigned chain_length = s->max_chain_length;/* max hash chain length */
1068 register Bytef *scan = s->window + s->strstart; /* current string */
1071 int best_len = s->prev_length; /* best match length so far */
1072 int nice_match = s->nice_match; /* stop if match long enough */
1073 IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
1074 s->strstart - (IPos)MAX_DIST(s) : NIL;
1078 Posf *prev = s->prev;
1079 uInt wmask = s->w_mask;
1085 register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
1089 register Bytef *strend = s->window + s->strstart + MAX_MATCH;
1097 Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
1100 if (s->prev_length >= s->good_match) {
1106 if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
1108 Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
1111 Assert(cur_match < s->strstart, "no future");
1112 match = s->window + cur_match;
1149 Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
1181 Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
1189 s->match_start = cur_match;
1202 if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
1203 return s->lookahead;
1212 local uInt longest_match(s, cur_match) in longest_match() argument
1213 deflate_state *s; in longest_match()
1216 register Bytef *scan = s->window + s->strstart; /* current string */
1219 register Bytef *strend = s->window + s->strstart + MAX_MATCH;
1224 Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
1226 Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
1228 Assert(cur_match < s->strstart, "no future");
1230 match = s->window + cur_match;
1255 Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
1261 s->match_start = cur_match;
1262 return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
1271 local void check_match(s, start, match, length) in check_match() argument
1272 deflate_state *s; in check_match()
1277 if (zmemcmp(s->window + match,
1278 s->window + start, length) != EQUAL) {
1282 fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
1288 do { putc(s->window[start++], stderr); } while (--length != 0);
1292 # define check_match(s, start, match, length) argument
1305 local void fill_window(s) in fill_window() argument
1306 deflate_state *s; in fill_window()
1311 uInt wsize = s->w_size;
1314 more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
1318 if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
1332 if (s->strstart >= wsize+MAX_DIST(s)) {
1334 zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
1335 s->match_start -= wsize;
1336 s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
1337 s->block_start -= (long) wsize;
1345 n = s->hash_size;
1346 p = &s->head[n];
1354 p = &s->prev[n];
1365 if (s->strm->avail_in == 0) return;
1380 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1381 s->lookahead += n;
1384 if (s->lookahead >= MIN_MATCH) {
1385 s->ins_h = s->window[s->strstart];
1386 UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
1395 } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
1404 if (s->high_water < s->window_size) {
1405 ulg curr = s->strstart + (ulg)(s->lookahead);
1408 if (s->high_water < curr) {
1412 init = s->window_size - curr;
1415 zmemzero(s->window + curr, (unsigned)init);
1416 s->high_water = curr + init;
1418 else if (s->high_water < (ulg)curr + WIN_INIT) {
1423 init = (ulg)curr + WIN_INIT - s->high_water;
1424 if (init > s->window_size - s->high_water)
1425 init = s->window_size - s->high_water;
1426 zmemzero(s->window + s->high_water, (unsigned)init);
1427 s->high_water += init;
1436 #define FLUSH_BLOCK_ONLY(s, last) { \ argument
1437 _tr_flush_block(s, (s->block_start >= 0L ? \
1438 (charf *)&s->window[(unsigned)s->block_start] : \
1440 (ulg)((long)s->strstart - s->block_start), \
1442 s->block_start = s->strstart; \
1443 flush_pending(s->strm); \
1448 #define FLUSH_BLOCK(s, last) { \ argument
1449 FLUSH_BLOCK_ONLY(s, last); \
1450 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1462 local block_state deflate_stored(s, flush) in deflate_stored() argument
1463 deflate_state *s; in deflate_stored()
1472 if (max_block_size > s->pending_buf_size - 5) {
1473 max_block_size = s->pending_buf_size - 5;
1479 if (s->lookahead <= 1) {
1481 Assert(s->strstart < s->w_size+MAX_DIST(s) ||
1482 s->block_start >= (long)s->w_size, "slide too late");
1484 fill_window(s);
1485 if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
1487 if (s->lookahead == 0) break; /* flush the current block */
1489 Assert(s->block_start >= 0L, "block gone");
1491 s->strstart += s->lookahead;
1492 s->lookahead = 0;
1495 max_start = s->block_start + max_block_size;
1496 if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
1498 s->lookahead = (uInt)(s->strstart - max_start);
1499 s->strstart = (uInt)max_start;
1500 FLUSH_BLOCK(s, 0);
1505 if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
1506 FLUSH_BLOCK(s, 0);
1509 FLUSH_BLOCK(s, flush == Z_FINISH);
1520 local block_state deflate_fast(s, flush) in deflate_fast() argument
1521 deflate_state *s; in deflate_fast()
1533 if (s->lookahead < MIN_LOOKAHEAD) {
1534 fill_window(s);
1535 if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
1538 if (s->lookahead == 0) break; /* flush the current block */
1545 if (s->lookahead >= MIN_MATCH) {
1546 INSERT_STRING(s, s->strstart, hash_head);
1552 if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
1557 s->match_length = longest_match (s, hash_head);
1560 if (s->match_length >= MIN_MATCH) {
1561 check_match(s, s->strstart, s->match_start, s->match_length);
1563 _tr_tally_dist(s, s->strstart - s->match_start,
1564 s->match_length - MIN_MATCH, bflush);
1566 s->lookahead -= s->match_length;
1572 if (s->match_length <= s->max_insert_length &&
1573 s->lookahead >= MIN_MATCH) {
1574 s->match_length--; /* string at strstart already in table */
1576 s->strstart++;
1577 INSERT_STRING(s, s->strstart, hash_head);
1581 } while (--s->match_length != 0);
1582 s->strstart++;
1586 s->strstart += s->match_length;
1587 s->match_length = 0;
1588 s->ins_h = s->window[s->strstart];
1589 UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
1599 Tracevv((stderr,"%c", s->window[s->strstart]));
1600 _tr_tally_lit (s, s->window[s->strstart], bflush);
1601 s->lookahead--;
1602 s->strstart++;
1604 if (bflush) FLUSH_BLOCK(s, 0);
1606 FLUSH_BLOCK(s, flush == Z_FINISH);
1616 local block_state deflate_slow(s, flush) in deflate_slow() argument
1617 deflate_state *s; in deflate_slow()
1630 if (s->lookahead < MIN_LOOKAHEAD) {
1631 fill_window(s);
1632 if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
1635 if (s->lookahead == 0) break; /* flush the current block */
1642 if (s->lookahead >= MIN_MATCH) {
1643 INSERT_STRING(s, s->strstart, hash_head);
1648 s->prev_length = s->match_length, s->prev_match = s->match_start;
1649 s->match_length = MIN_MATCH-1;
1651 if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
1652 s->strstart - hash_head <= MAX_DIST(s)) {
1657 s->match_length = longest_match (s, hash_head);
1660 if (s->match_length <= 5 && (s->strategy == Z_FILTERED
1662 || (s->match_length == MIN_MATCH &&
1663 s->strstart - s->match_start > TOO_FAR)
1670 s->match_length = MIN_MATCH-1;
1676 if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
1677 uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
1680 check_match(s, s->strstart-1, s->prev_match, s->prev_length);
1682 _tr_tally_dist(s, s->strstart -1 - s->prev_match,
1683 s->prev_length - MIN_MATCH, bflush);
1690 s->lookahead -= s->prev_length-1;
1691 s->prev_length -= 2;
1693 if (++s->strstart <= max_insert) {
1694 INSERT_STRING(s, s->strstart, hash_head);
1696 } while (--s->prev_length != 0);
1697 s->match_available = 0;
1698 s->match_length = MIN_MATCH-1;
1699 s->strstart++;
1701 if (bflush) FLUSH_BLOCK(s, 0);
1703 } else if (s->match_available) {
1708 Tracevv((stderr,"%c", s->window[s->strstart-1]));
1709 _tr_tally_lit(s, s->window[s->strstart-1], bflush);
1711 FLUSH_BLOCK_ONLY(s, 0);
1713 s->strstart++;
1714 s->lookahead--;
1715 if (s->strm->avail_out == 0) return need_more;
1720 s->match_available = 1;
1721 s->strstart++;
1722 s->lookahead--;
1726 if (s->match_available) {
1727 Tracevv((stderr,"%c", s->window[s->strstart-1]));
1728 _tr_tally_lit(s, s->window[s->strstart-1], bflush);
1729 s->match_available = 0;
1731 FLUSH_BLOCK(s, flush == Z_FINISH);
1741 local block_state deflate_rle(s, flush) in deflate_rle() argument
1742 deflate_state *s; in deflate_rle()
1754 if (s->lookahead < MAX_MATCH) {
1755 fill_window(s);
1756 if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
1759 if (s->lookahead == 0) break; /* flush the current block */
1763 s->match_length = 0;
1764 if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
1765 scan = s->window + s->strstart - 1;
1768 strend = s->window + s->strstart + MAX_MATCH;
1775 s->match_length = MAX_MATCH - (int)(strend - scan);
1776 if (s->match_length > s->lookahead)
1777 s->match_length = s->lookahead;
1782 if (s->match_length >= MIN_MATCH) {
1783 check_match(s, s->strstart, s->strstart - 1, s->match_length);
1785 _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
1787 s->lookahead -= s->match_length;
1788 s->strstart += s->match_length;
1789 s->match_length = 0;
1792 Tracevv((stderr,"%c", s->window[s->strstart]));
1793 _tr_tally_lit (s, s->window[s->strstart], bflush);
1794 s->lookahead--;
1795 s->strstart++;
1797 if (bflush) FLUSH_BLOCK(s, 0);
1799 FLUSH_BLOCK(s, flush == Z_FINISH);
1807 local block_state deflate_huff(s, flush) in deflate_huff() argument
1808 deflate_state *s; in deflate_huff()
1815 if (s->lookahead == 0) {
1816 fill_window(s);
1817 if (s->lookahead == 0) {
1825 s->match_length = 0;
1826 Tracevv((stderr,"%c", s->window[s->strstart]));
1827 _tr_tally_lit (s, s->window[s->strstart], bflush);
1828 s->lookahead--;
1829 s->strstart++;
1830 if (bflush) FLUSH_BLOCK(s, 0);
1832 FLUSH_BLOCK(s, flush == Z_FINISH);