diff options
author | Tor Andersson <tor@ghostscript.com> | 2008-08-14 18:34:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2008-08-14 18:34:56 +0200 |
commit | ce8cf2a41a98aa48d5eee68b37c22cbf5aa5cd72 (patch) | |
tree | 5119a800e468dfe3f87dce7d264579606738fec4 /stream/stm_misc.c | |
parent | 34b787312f1546d9892bb4b6601943ac54d2fc02 (diff) | |
download | mupdf-ce8cf2a41a98aa48d5eee68b37c22cbf5aa5cd72.tar.xz |
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.
Diffstat (limited to 'stream/stm_misc.c')
-rw-r--r-- | stream/stm_misc.c | 5 |
1 files changed, 4 insertions, 1 deletions
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) { |