summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2019-02-09 13:34:38 +0100
committerSebastian Rasmussen <sebras@gmail.com>2019-02-12 19:06:46 +0100
commit0d942b34ae4a5385f5cd3cfa9b2c708f56c65860 (patch)
tree073347c3fd9ded3ba61ab5bad4723c7730e8cd7c
parent0fb8c19f9b848fb691dc067a0feebbfee539672b (diff)
downloadghostpdl-0d942b34ae4a5385f5cd3cfa9b2c708f56c65860.tar.gz
jbig2dec: Return allocator once it is retired.
-rw-r--r--jbig2dec/CHANGES7
-rw-r--r--jbig2dec/jbig2.c10
-rw-r--r--jbig2dec/jbig2.h4
3 files changed, 15 insertions, 6 deletions
diff --git a/jbig2dec/CHANGES b/jbig2dec/CHANGES
index be4363e1c..f49f71623 100644
--- a/jbig2dec/CHANGES
+++ b/jbig2dec/CHANGES
@@ -1,3 +1,10 @@
+Version 0.16
+
+* API change allowing for library users to get the custom allocator
+ so it may be freed if necessary. This is useful if the allocator
+ is extended with e.g. a custom pointer needed by the allocator
+ callbacks.
+
Version 0.15 (2018 September 04)
* Bug fix release, with many security related and stability fixes
diff --git a/jbig2dec/jbig2.c b/jbig2dec/jbig2.c
index 595c05727..64d9256d1 100644
--- a/jbig2dec/jbig2.c
+++ b/jbig2dec/jbig2.c
@@ -391,14 +391,14 @@ jbig2_data_in(Jbig2Ctx *ctx, const unsigned char *data, size_t size)
}
}
-void
+Jbig2Allocator *
jbig2_ctx_free(Jbig2Ctx *ctx)
{
Jbig2Allocator *ca;
int i;
if (ctx == NULL)
- return;
+ return NULL;
ca = ctx->allocator;
jbig2_free(ca, ctx->buf);
@@ -416,6 +416,8 @@ jbig2_ctx_free(Jbig2Ctx *ctx)
}
jbig2_free(ca, ctx);
+
+ return ca;
}
Jbig2GlobalCtx *
@@ -424,10 +426,10 @@ jbig2_make_global_ctx(Jbig2Ctx *ctx)
return (Jbig2GlobalCtx *) ctx;
}
-void
+Jbig2Allocator *
jbig2_global_ctx_free(Jbig2GlobalCtx *global_ctx)
{
- jbig2_ctx_free((Jbig2Ctx *) global_ctx);
+ return jbig2_ctx_free((Jbig2Ctx *) global_ctx);
}
/* I'm not committed to keeping the word stream interface. It's handy
diff --git a/jbig2dec/jbig2.h b/jbig2dec/jbig2.h
index 82d7c31aa..3556ec16f 100644
--- a/jbig2dec/jbig2.h
+++ b/jbig2dec/jbig2.h
@@ -79,11 +79,11 @@ struct _Jbig2Allocator {
/* decoder context */
Jbig2Ctx *jbig2_ctx_new(Jbig2Allocator *allocator,
Jbig2Options options, Jbig2GlobalCtx *global_ctx, Jbig2ErrorCallback error_callback, void *error_callback_data);
-void jbig2_ctx_free(Jbig2Ctx *ctx);
+Jbig2Allocator *jbig2_ctx_free(Jbig2Ctx *ctx);
/* global context for embedded streams */
Jbig2GlobalCtx *jbig2_make_global_ctx(Jbig2Ctx *ctx);
-void jbig2_global_ctx_free(Jbig2GlobalCtx *global_ctx);
+Jbig2Allocator *jbig2_global_ctx_free(Jbig2GlobalCtx *global_ctx);
/* submit data to the decoder */
int jbig2_data_in(Jbig2Ctx *ctx, const unsigned char *data, size_t size);