From 4f49317deff939df854a8d9fecd7502cf2b4c9b2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 30 Jul 2010 11:57:31 +0000 Subject: Make an educated guess at the stream length by looking at the filters used in pdf_loadstream. --- fitz/fitz.h | 2 +- fitz/stm_read.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'fitz') diff --git a/fitz/fitz.h b/fitz/fitz.h index 1af70f6a..44f1c070 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -501,7 +501,7 @@ void fz_seek(fz_stream *stm, int offset, int whence); int fz_read(fz_stream *stm, unsigned char *buf, int len); void fz_readline(fz_stream *stm, char *buf, int max); -fz_error fz_readall(fz_buffer **bufp, fz_stream *stm); +fz_error fz_readall(fz_buffer **bufp, fz_stream *stm, int initial); static inline int fz_readbyte(fz_stream *stm) { diff --git a/fitz/stm_read.c b/fitz/stm_read.c index 3bdddade..fb251214 100644 --- a/fitz/stm_read.c +++ b/fitz/stm_read.c @@ -55,12 +55,15 @@ fz_fillbuffer(fz_stream *stm) } fz_error -fz_readall(fz_buffer **bufp, fz_stream *stm) +fz_readall(fz_buffer **bufp, fz_stream *stm, int initial) { fz_buffer *buf; int n; - buf = fz_newbuffer(16 * 1024); + if (initial < 1024) + initial = 1024; + + buf = fz_newbuffer(initial); while (1) { -- cgit v1.2.3