diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-09-14 17:36:57 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2011-09-15 14:50:17 +0100 |
commit | b51ef0eea028c73b6379e832eaa34fff3fbbb927 (patch) | |
tree | 1ab685ccd356e7fdc832b2e3322c0486b2670cfb /fitz/stm_read.c | |
parent | 89ae81f651bfa112b8e07317eb6983beaf7cb212 (diff) | |
download | mupdf-b51ef0eea028c73b6379e832eaa34fff3fbbb927.tar.xz |
Add context to mupdf.
Huge pervasive change to lots of files, adding a context for exception
handling and allocation.
In time we'll move more statics into there.
Also fix some for(i = 0; i < function(...); i++) calls.
Diffstat (limited to 'fitz/stm_read.c')
-rw-r--r-- | fitz/stm_read.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fitz/stm_read.c b/fitz/stm_read.c index 89811333..062916c5 100644 --- a/fitz/stm_read.c +++ b/fitz/stm_read.c @@ -99,27 +99,28 @@ fz_read_all(fz_buffer **bufp, fz_stream *stm, int initial) { fz_buffer *buf; int n; + fz_context *ctx = stm->ctx; if (initial < 1024) initial = 1024; - buf = fz_new_buffer(initial); + buf = fz_new_buffer(ctx, initial); while (1) { if (buf->len == buf->cap) - fz_grow_buffer(buf); + fz_grow_buffer(ctx, buf); if (buf->len / 200 > initial) { - fz_drop_buffer(buf); + fz_drop_buffer(ctx, buf); return fz_error_make("compression bomb detected"); } n = fz_read(stm, buf->data + buf->len, buf->cap - buf->len); if (n < 0) { - fz_drop_buffer(buf); + fz_drop_buffer(ctx, buf); return fz_error_note(n, "read error"); } if (n == 0) |