flate

deflate implementation
git clone git://git.suckless.org/flate
Log | Files | Refs | README

commit 4a020d947fc3b3067b901d048b74c8abed7d4da6
parent a1f02b32650d405defac98da43ce6a4ca26dd202
Author: nsz <nszabolcs@gmail.com>
Date:   Sun, 23 Aug 2009 20:06:20 +0200

fix lzguard bug
Diffstat:
deflate.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/deflate.c b/deflate.c @@ -560,7 +560,7 @@ static int shiftwin(State *s) { static int endblock(State *s) { if ((s->pos >= 2*WinSize && !shiftwin(s)) || s->pos - s->startpos >= BlockSize || - s->lzbuf - s->lz >= LzGuard || (s->eof && s->pos == s->endpos)) { + s->lz - s->lzbuf >= LzGuard || (s->eof && s->pos == s->endpos)) { /* deflate block */ flushlit(s); if (s->prevm.len) @@ -619,8 +619,8 @@ static int deflate_state(State *s) { guard = calcguard(s); /*fprintf(stderr,"guard:%d pos:%d nin:%d\n", guard, s->pos, s->inend - s->in);*/ for (;;) { - if (s->pos >= guard || s->lzbuf - s->lz >= LzGuard) { -/*fprintf(stderr,"guard:%d pos:%d len:%d end:%d start:%d nin:%d\n", guard, s->pos, s->pos - s->startpos, s->endpos, s->startpos, s->inend - s->in);*/ + if (s->pos >= guard || s->lz - s->lzbuf >= LzGuard) { +/*fprintf(stderr,"guard:%d pos:%d len:%d lzlen:%d end:%d start:%d nin:%d\n", guard, s->pos, s->pos - s->startpos, s->lz - s->lzbuf, s->endpos, s->startpos, s->inend - s->in);*/ if (endblock(s)) return (s->state = FlateOut); if (!fillsrc(s))