summaryrefslogtreecommitdiff
path: root/stream/stm_misc.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-08-14 18:34:56 +0200
committerTor Andersson <tor@ghostscript.com>2008-08-14 18:34:56 +0200
commitce8cf2a41a98aa48d5eee68b37c22cbf5aa5cd72 (patch)
tree5119a800e468dfe3f87dce7d264579606738fec4 /stream/stm_misc.c
parent34b787312f1546d9892bb4b6601943ac54d2fc02 (diff)
downloadmupdf-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.c5
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)
{