diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-01-21 16:42:45 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2015-02-17 18:05:39 +0100 |
commit | f84a189d5f94250e46d2cbd1a75aba00130e2dd6 (patch) | |
tree | 8ee614ab90de1baa8941f91ae4946ed5c2e70721 /source/fitz/filter-leech.c | |
parent | 681039767f2ccc72e236246178893eb0989169c9 (diff) | |
download | mupdf-f84a189d5f94250e46d2cbd1a75aba00130e2dd6.tar.xz |
Add ctx parameter and remove embedded contexts for API regularity.
Purge several embedded contexts:
Remove embedded context in fz_output.
Remove embedded context in fz_stream.
Remove embedded context in fz_device.
Remove fz_rebind_stream (since it is no longer necessary).
Remove embedded context in svg_device.
Remove embedded context in XML parser.
Add ctx argument to fz_document functions.
Remove embedded context in fz_document.
Remove embedded context in pdf_document.
Remove embedded context in pdf_obj.
Make fz_page independent of fz_document in the interface.
We shouldn't need to pass the document to all functions handling a page.
If a page is tied to the source document, it's redundant; otherwise it's
just pointless.
Fix reference counting oddity in fz_new_image_from_pixmap.
Diffstat (limited to 'source/fitz/filter-leech.c')
-rw-r--r-- | source/fitz/filter-leech.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/source/fitz/filter-leech.c b/source/fitz/filter-leech.c index 67a43a29..90e28565 100644 --- a/source/fitz/filter-leech.c +++ b/source/fitz/filter-leech.c @@ -11,18 +11,18 @@ struct fz_leech_s }; static int -next_leech(fz_stream *stm, int max) +next_leech(fz_context *ctx, fz_stream *stm, int max) { fz_leech *state = stm->state; fz_buffer *buffer = state->buffer; - int n = fz_available(state->chain, max); + int n = fz_available(ctx, state->chain, max); if (n > max) n = max; while (buffer->cap < buffer->len + n) { - fz_grow_buffer(stm->ctx, state->buffer); + fz_grow_buffer(ctx, state->buffer); } memcpy(buffer->data + buffer->len, state->chain->rp, n); stm->rp = buffer->data + buffer->len; @@ -40,22 +40,14 @@ close_leech(fz_context *ctx, void *state_) { fz_leech *state = (fz_leech *)state_; - fz_drop_stream(state->chain); + fz_drop_stream(ctx, state->chain); fz_free(ctx, state); } -static fz_stream * -rebind_leech(fz_stream *s) -{ - fz_leech *state = s->state; - return state->chain; -} - fz_stream * -fz_open_leecher(fz_stream *chain, fz_buffer *buffer) +fz_open_leecher(fz_context *ctx, fz_stream *chain, fz_buffer *buffer) { fz_leech *state = NULL; - fz_context *ctx = chain->ctx; fz_var(state); @@ -68,8 +60,8 @@ fz_open_leecher(fz_stream *chain, fz_buffer *buffer) fz_catch(ctx) { fz_free(ctx, state); - fz_drop_stream(chain); + fz_drop_stream(ctx, chain); fz_rethrow(ctx); } - return fz_new_stream(ctx, state, next_leech, close_leech, rebind_leech); + return fz_new_stream(ctx, state, next_leech, close_leech); } |