summaryrefslogtreecommitdiff
path: root/fitz/filt_flate.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-09-14 17:36:57 +0100
committerRobin Watts <Robin.Watts@artifex.com>2011-09-15 14:50:17 +0100
commitb51ef0eea028c73b6379e832eaa34fff3fbbb927 (patch)
tree1ab685ccd356e7fdc832b2e3322c0486b2670cfb /fitz/filt_flate.c
parent89ae81f651bfa112b8e07317eb6983beaf7cb212 (diff)
downloadmupdf-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/filt_flate.c')
-rw-r--r--fitz/filt_flate.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fitz/filt_flate.c b/fitz/filt_flate.c
index 4d4caf37..b7ef163d 100644
--- a/fitz/filt_flate.c
+++ b/fitz/filt_flate.c
@@ -12,12 +12,12 @@ struct fz_flate_s
static void *zalloc(void *opaque, unsigned int items, unsigned int size)
{
- return fz_calloc(items, size);
+ return fz_calloc(opaque, items, size);
}
static void zfree(void *opaque, void *ptr)
{
- fz_free(ptr);
+ fz_free(opaque, ptr);
}
static int
@@ -77,7 +77,7 @@ close_flated(fz_stream *stm)
fz_warn("zlib error: inflateEnd: %s", state->z.msg);
fz_close(state->chain);
- fz_free(state);
+ fz_free(stm->ctx, state);
}
fz_stream *
@@ -86,12 +86,12 @@ fz_open_flated(fz_stream *chain)
fz_flate *state;
int code;
- state = fz_malloc(sizeof(fz_flate));
+ state = fz_malloc(chain->ctx, sizeof(fz_flate));
state->chain = chain;
state->z.zalloc = zalloc;
state->z.zfree = zfree;
- state->z.opaque = NULL;
+ state->z.opaque = chain->ctx;
state->z.next_in = NULL;
state->z.avail_in = 0;
@@ -99,5 +99,5 @@ fz_open_flated(fz_stream *chain)
if (code != Z_OK)
fz_warn("zlib error: inflateInit: %s", state->z.msg);
- return fz_new_stream(state, read_flated, close_flated);
+ return fz_new_stream(chain->ctx, state, read_flated, close_flated);
}