summaryrefslogtreecommitdiff
path: root/source/fitz/output-ps.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-10-11 20:39:11 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-11-22 23:09:51 +0100
commit65996a1ffa6937ae5fa1825ef9cac09927163c1c (patch)
tree87f6c3cd3ef8b7cfd2fd8737a513ddba45538410 /source/fitz/output-ps.c
parent46fe810563b4ca04b9804fd1163d22ca76cfa4ac (diff)
downloadmupdf-65996a1ffa6937ae5fa1825ef9cac09927163c1c.tar.xz
Use custom allocator everywhere zlib is used.
Diffstat (limited to 'source/fitz/output-ps.c')
-rw-r--r--source/fitz/output-ps.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c
index 2d9ccf1f..b270fcd4 100644
--- a/source/fitz/output-ps.c
+++ b/source/fitz/output-ps.c
@@ -13,6 +13,16 @@ typedef struct ps_band_writer_s
unsigned char *output;
} ps_band_writer;
+static void *zalloc_ps(void *opaque, unsigned int items, unsigned int size)
+{
+ return fz_malloc_array_no_throw(opaque, items, size);
+}
+
+static void zfree_ps(void *opaque, void *address)
+{
+ fz_free(opaque, address);
+}
+
void
fz_write_ps_file_header(fz_context *ctx, fz_output *out)
{
@@ -70,6 +80,10 @@ ps_write_header(fz_context *ctx, fz_band_writer *writer_, const fz_colorspace *c
writer->super.h = h;
writer->super.n = n;
+ writer->stream.zalloc = zalloc_ps;
+ writer->stream.zfree = zfree_ps;
+ writer->stream.opaque = ctx;
+
err = deflateInit(&writer->stream, Z_DEFAULT_COMPRESSION);
if (err != Z_OK)
fz_throw(ctx, FZ_ERROR_GENERIC, "compression error %d", err);