aboutsummaryrefslogtreecommitdiff
path: root/deflate.c
diff options
context:
space:
mode:
Diffstat (limited to 'deflate.c')
-rw-r--r--deflate.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/deflate.c b/deflate.c
index 12fbd5a..3c04f5d 100644
--- a/deflate.c
+++ b/deflate.c
@@ -638,19 +638,22 @@ local void putShortMSB (s, b)
638local void flush_pending(strm) 638local void flush_pending(strm)
639 z_streamp strm; 639 z_streamp strm;
640{ 640{
641 unsigned len = strm->state->pending; 641 unsigned len;
642 deflate_state *s = strm->state;
642 643
644 _tr_flush_bits(s);
645 len = s->pending;
643 if (len > strm->avail_out) len = strm->avail_out; 646 if (len > strm->avail_out) len = strm->avail_out;
644 if (len == 0) return; 647 if (len == 0) return;
645 648
646 zmemcpy(strm->next_out, strm->state->pending_out, len); 649 zmemcpy(strm->next_out, s->pending_out, len);
647 strm->next_out += len; 650 strm->next_out += len;
648 strm->state->pending_out += len; 651 s->pending_out += len;
649 strm->total_out += len; 652 strm->total_out += len;
650 strm->avail_out -= len; 653 strm->avail_out -= len;
651 strm->state->pending -= len; 654 s->pending -= len;
652 if (strm->state->pending == 0) { 655 if (s->pending == 0) {
653 strm->state->pending_out = strm->state->pending_buf; 656 s->pending_out = s->pending_buf;
654 } 657 }
655} 658}
656 659