From bb440c5d057cf8c9f38ab07bdd5d23a0b6192e74 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 11 Aug 2010 14:28:24 +0000 Subject: Unstuff extra bytes read when the filters are closed instead of only when EOD is encountered. --- fitz/filt_faxd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'fitz/filt_faxd.c') diff --git a/fitz/filt_faxd.c b/fitz/filt_faxd.c index e4a81724..dd6ac9d0 100644 --- a/fitz/filt_faxd.c +++ b/fitz/filt_faxd.c @@ -549,7 +549,6 @@ readfaxd(fz_stream *stm, unsigned char *buf, int len) unsigned char *ep = buf + len; unsigned char *tmp; fz_error error; - int i; if (fax->stage == SDONE) return 0; @@ -692,12 +691,6 @@ eol: rtc: fax->stage = SDONE; - - /* try to put back any extra bytes we read */ - i = (32 - fax->bidx) / 8; - while (i--) - fz_unreadbyte(fax->chain); - return p - buf; } @@ -705,6 +698,13 @@ static void closefaxd(fz_stream *stm) { fz_faxd *fax = stm->state; + int i; + + /* if we read any extra bytes, try to put them back */ + i = (32 - fax->bidx) / 8; + while (i--) + fz_unreadbyte(fax->chain); + fz_close(fax->chain); fz_free(fax->ref); fz_free(fax->dst); -- cgit v1.2.3