From ce8cf2a41a98aa48d5eee68b37c22cbf5aa5cd72 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 14 Aug 2008 18:34:56 +0200 Subject: Double the buffer size each time it needs to grow instead of incrementing it by a small value. This fixes a lot of performance issues when loading images. --- stream/stm_misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'stream/stm_misc.c') diff --git a/stream/stm_misc.c b/stream/stm_misc.c index 1098c016..b91b6c7e 100644 --- a/stream/stm_misc.c +++ b/stream/stm_misc.c @@ -83,7 +83,10 @@ fz_readall(fz_buffer **bufp, fz_stream *stm) { if (len - pos == 0) { - len += CHUNKSIZE; + if (len == 0) + len = CHUNKSIZE; + else + len = len * 2; newbuf = fz_realloc(buf, len); if (!newbuf) { -- cgit v1.2.3