From 074cd54f24d7b2121c3873e3b62a2161b2e014e0 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 23 May 2014 11:46:04 +0100 Subject: Bug 695183: Inflate large buffers at a time for speed. When I changed the stream implementations to use implementation specific buffers, rather than a generic public one in every fz_stream, I changed fz_read_byte to only get a single byte at a time. I noted at the time that the underlying stream was free to decode larger blocks if it wanted too, but I forgot to actually do this for the flate decoder. Fixing this here should solve the speed issues. --- source/fitz/filter-flate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/fitz/filter-flate.c b/source/fitz/filter-flate.c index b306c9c3..4b01d0be 100644 --- a/source/fitz/filter-flate.c +++ b/source/fitz/filter-flate.c @@ -22,16 +22,14 @@ static void zfree(void *opaque, void *ptr) } static int -next_flated(fz_stream *stm, int outlen) +next_flated(fz_stream *stm, int required) { fz_flate *state = stm->state; fz_stream *chain = state->chain; z_streamp zp = &state->z; int code; unsigned char *outbuf = state->buffer; - - if (outlen > sizeof(state->buffer)) - outlen = sizeof(state->buffer); + int outlen = sizeof(state->buffer); if (stm->eof) return EOF; -- cgit v1.2.3