summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-01-20 16:42:29 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-02-17 16:36:10 +0100
commit681039767f2ccc72e236246178893eb0989169c9 (patch)
tree2eccad54c5b5bc964335dc97fe5b0fec8449d16e /source/pdf
parent76a09166ddbe5b741f54f0fd203f2135e5b532c3 (diff)
downloadmupdf-681039767f2ccc72e236246178893eb0989169c9.tar.xz
Rename fz_close_* and fz_free_* to fz_drop_*.
Rename fz_close to fz_drop_stream. Rename fz_close_archive to fz_drop_archive. Rename fz_close_output to fz_drop_output. Rename fz_free_* to fz_drop_*. Rename pdf_free_* to pdf_drop_*. Rename xps_free_* to xps_drop_*.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-annot-edit.c4
-rw-r--r--source/pdf/pdf-annot.c10
-rw-r--r--source/pdf/pdf-appearance.c22
-rw-r--r--source/pdf/pdf-cmap-load.c6
-rw-r--r--source/pdf/pdf-cmap.c4
-rw-r--r--source/pdf/pdf-colorspace.c6
-rw-r--r--source/pdf/pdf-crypt.c26
-rw-r--r--source/pdf/pdf-device.c4
-rw-r--r--source/pdf/pdf-font.c8
-rw-r--r--source/pdf/pdf-form.c2
-rw-r--r--source/pdf/pdf-function.c10
-rw-r--r--source/pdf/pdf-image.c2
-rw-r--r--source/pdf/pdf-interpret.c12
-rw-r--r--source/pdf/pdf-object.c10
-rw-r--r--source/pdf/pdf-op-buffer.c4
-rw-r--r--source/pdf/pdf-outline.c2
-rw-r--r--source/pdf/pdf-page.c10
-rw-r--r--source/pdf/pdf-pattern.c8
-rw-r--r--source/pdf/pdf-pkcs7.c4
-rw-r--r--source/pdf/pdf-repair.c2
-rw-r--r--source/pdf/pdf-shade.c4
-rw-r--r--source/pdf/pdf-store.c8
-rw-r--r--source/pdf/pdf-stream.c12
-rw-r--r--source/pdf/pdf-write.c2
-rw-r--r--source/pdf/pdf-xobject.c10
-rw-r--r--source/pdf/pdf-xref.c26
26 files changed, 109 insertions, 109 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c
index 1e82accb..719f92bd 100644
--- a/source/pdf/pdf-annot-edit.c
+++ b/source/pdf/pdf-annot-edit.c
@@ -140,7 +140,7 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type)
/*
Linking must be done after any call that might throw because
- pdf_free_annot below actually frees a list. Put the new annot
+ pdf_drop_annot below actually frees a list. Put the new annot
at the end of the list, so that it will be drawn last.
*/
*page->annot_tailp = annot;
@@ -155,7 +155,7 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type)
}
fz_catch(ctx)
{
- pdf_free_annot(ctx, annot);
+ pdf_drop_annot(ctx, annot);
fz_rethrow(ctx);
}
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c
index 6b786985..72f5cd8e 100644
--- a/source/pdf/pdf-annot.c
+++ b/source/pdf/pdf-annot.c
@@ -369,7 +369,7 @@ pdf_load_link_annots(pdf_document *doc, pdf_obj *annots, const fz_matrix *page_c
}
void
-pdf_free_annot(fz_context *ctx, pdf_annot *annot)
+pdf_drop_annot(fz_context *ctx, pdf_annot *annot)
{
pdf_annot *next;
@@ -500,7 +500,7 @@ pdf_load_annots(pdf_document *doc, pdf_page *page, pdf_obj *annots)
}
fz_catch(ctx)
{
- pdf_free_annot(ctx, page->annots);
+ pdf_drop_annot(ctx, page->annots);
page->annots = NULL;
fz_rethrow(ctx);
}
@@ -573,7 +573,7 @@ pdf_load_annots(pdf_document *doc, pdf_page *page, pdf_obj *annots)
{
if (fz_caught(ctx) == FZ_ERROR_TRYLATER)
{
- pdf_free_annot(ctx, page->annots);
+ pdf_drop_annot(ctx, page->annots);
page->annots = NULL;
fz_rethrow(ctx);
}
@@ -584,8 +584,8 @@ pdf_load_annots(pdf_document *doc, pdf_page *page, pdf_obj *annots)
{
/* Move to next item in the linked list, dropping this one */
*itr = annot->next;
- annot->next = NULL; /* Required because pdf_free_annot follows the "next" chain */
- pdf_free_annot(ctx, annot);
+ annot->next = NULL; /* Required because pdf_drop_annot follows the "next" chain */
+ pdf_drop_annot(ctx, annot);
}
}
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index 8ff3993e..a8d8d6ef 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -147,7 +147,7 @@ void pdf_parse_da(fz_context *ctx, char *da, pdf_da_info *di)
fz_always(ctx)
{
fz_free(ctx, name);
- fz_close(str);
+ fz_drop_stream(str);
pdf_lexbuf_fin(&lbuf);
}
fz_catch(ctx)
@@ -809,7 +809,7 @@ static int get_matrix(pdf_document *doc, pdf_xobject *form, int q, fz_matrix *mt
}
fz_always(ctx)
{
- fz_close(str);
+ fz_drop_stream(str);
pdf_lexbuf_fin(&lbuf);
}
fz_catch(ctx)
@@ -1064,8 +1064,8 @@ static void update_marked_content(pdf_document *doc, pdf_xobject *form, fz_buffe
}
fz_always(ctx)
{
- fz_close(str_outer);
- fz_close(str_inner);
+ fz_drop_stream(str_outer);
+ fz_drop_stream(str_inner);
fz_drop_buffer(ctx, newbuf);
pdf_lexbuf_fin(&lbuf);
}
@@ -1387,7 +1387,7 @@ void pdf_set_annot_appearance(pdf_document *doc, pdf_annot *annot, fz_rect *rect
dev = pdf_new_pdf_device(doc, ap_obj, pdf_dict_gets(ap_obj, "Resources"), &mat);
fz_run_display_list(disp_list, dev, &ctm, &fz_infinite_rect, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
/* Mark the appearance as changed - required for partial update */
xobj = pdf_load_xobject(doc, ap_obj);
@@ -1406,7 +1406,7 @@ void pdf_set_annot_appearance(pdf_document *doc, pdf_annot *annot, fz_rect *rect
}
fz_catch(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
fz_rethrow(ctx);
}
}
@@ -1528,7 +1528,7 @@ void pdf_set_markup_appearance(pdf_document *doc, pdf_annot *annot, float color[
fz_always(ctx)
{
fz_free(ctx, qp);
- fz_free_device(dev);
+ fz_drop_device(dev);
fz_drop_stroke_state(ctx, stroke);
fz_drop_path(ctx, path);
fz_drop_display_list(ctx, strike_list);
@@ -1662,7 +1662,7 @@ void pdf_update_ink_appearance(pdf_document *doc, pdf_annot *annot)
fz_always(ctx)
{
fz_drop_colorspace(ctx, cs);
- fz_free_device(dev);
+ fz_drop_device(dev);
fz_drop_stroke_state(ctx, stroke);
fz_drop_path(ctx, path);
fz_drop_display_list(ctx, strike_list);
@@ -1905,7 +1905,7 @@ void pdf_update_text_annot_appearance(pdf_document *doc, pdf_annot *annot)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
fz_drop_display_list(ctx, dlist);
fz_drop_stroke_state(ctx, stroke);
fz_drop_path(ctx, path);
@@ -1970,7 +1970,7 @@ void pdf_update_free_text_annot_appearance(pdf_document *doc, pdf_annot *annot)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
fz_drop_display_list(ctx, dlist);
font_info_fin(ctx, &font_rec);
fz_drop_text(ctx, text);
@@ -2193,7 +2193,7 @@ void pdf_set_signature_appearance(pdf_document *doc, pdf_annot *annot, char *nam
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
fz_drop_display_list(ctx, dlist);
font_info_fin(ctx, &font_rec);
fz_drop_path(ctx, path);
diff --git a/source/pdf/pdf-cmap-load.c b/source/pdf/pdf-cmap-load.c
index 2e431215..e3bf943d 100644
--- a/source/pdf/pdf-cmap-load.c
+++ b/source/pdf/pdf-cmap-load.c
@@ -36,7 +36,7 @@ pdf_load_embedded_cmap(pdf_document *doc, pdf_obj *stmobj)
if (pdf_obj_marked(stmobj))
fz_throw(ctx, FZ_ERROR_GENERIC, "Recursion in embedded cmap");
- if ((cmap = pdf_find_item(ctx, pdf_free_cmap_imp, stmobj)) != NULL)
+ if ((cmap = pdf_find_item(ctx, pdf_drop_cmap_imp, stmobj)) != NULL)
{
return cmap;
}
@@ -47,7 +47,7 @@ pdf_load_embedded_cmap(pdf_document *doc, pdf_obj *stmobj)
phase = 1;
cmap = pdf_load_cmap(ctx, file);
phase = 2;
- fz_close(file);
+ fz_drop_stream(file);
file = NULL;
wmode = pdf_dict_gets(stmobj, "WMode");
@@ -76,7 +76,7 @@ pdf_load_embedded_cmap(pdf_document *doc, pdf_obj *stmobj)
fz_catch(ctx)
{
if (file)
- fz_close(file);
+ fz_drop_stream(file);
if (cmap)
pdf_drop_cmap(ctx, cmap);
if (phase < 1)
diff --git a/source/pdf/pdf-cmap.c b/source/pdf/pdf-cmap.c
index e9eb25b2..16167439 100644
--- a/source/pdf/pdf-cmap.c
+++ b/source/pdf/pdf-cmap.c
@@ -5,7 +5,7 @@
*/
void
-pdf_free_cmap_imp(fz_context *ctx, fz_storable *cmap_)
+pdf_drop_cmap_imp(fz_context *ctx, fz_storable *cmap_)
{
pdf_cmap *cmap = (pdf_cmap *)cmap_;
if (cmap->usecmap)
@@ -20,7 +20,7 @@ pdf_cmap *
pdf_new_cmap(fz_context *ctx)
{
pdf_cmap *cmap = fz_malloc_struct(ctx, pdf_cmap);
- FZ_INIT_STORABLE(cmap, 1, pdf_free_cmap_imp);
+ FZ_INIT_STORABLE(cmap, 1, pdf_drop_cmap_imp);
return cmap;
}
diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c
index 4b250f6c..50a6f9d1 100644
--- a/source/pdf/pdf-colorspace.c
+++ b/source/pdf/pdf-colorspace.c
@@ -84,7 +84,7 @@ rgb_to_lab(fz_context *ctx, fz_colorspace *cs, const float *rgb, float *lab)
lab[2] = rgb[2];
}
-static fz_colorspace k_device_lab = { {-1, fz_free_colorspace_imp}, 0, "Lab", 3, lab_to_rgb, rgb_to_lab };
+static fz_colorspace k_device_lab = { {-1, fz_drop_colorspace_imp}, 0, "Lab", 3, lab_to_rgb, rgb_to_lab };
static fz_colorspace *fz_device_lab = &k_device_lab;
/* Separation and DeviceN */
@@ -219,7 +219,7 @@ load_indexed(pdf_document *doc, pdf_obj *array)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -359,7 +359,7 @@ pdf_load_colorspace(pdf_document *doc, pdf_obj *obj)
fz_context *ctx = doc->ctx;
fz_colorspace *cs;
- if ((cs = pdf_find_item(ctx, fz_free_colorspace_imp, obj)) != NULL)
+ if ((cs = pdf_find_item(ctx, fz_drop_colorspace_imp, obj)) != NULL)
{
return cs;
}
diff --git a/source/pdf/pdf-crypt.c b/source/pdf/pdf-crypt.c
index d502c378..621885d0 100644
--- a/source/pdf/pdf-crypt.c
+++ b/source/pdf/pdf-crypt.c
@@ -58,12 +58,12 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
obj = pdf_dict_gets(dict, "Filter");
if (!pdf_is_name(obj))
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "unspecified encryption handler");
}
if (strcmp(pdf_to_name(obj), "Standard") != 0)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "unknown encryption handler: '%s'", pdf_to_name(obj));
}
@@ -73,7 +73,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
crypt->v = pdf_to_int(obj);
if (crypt->v != 1 && crypt->v != 2 && crypt->v != 4 && crypt->v != 5)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "unknown encryption version");
}
@@ -94,13 +94,13 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
}
else
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "encryption dictionary missing version and revision value");
}
if (crypt->r < 1 || crypt->r > 6)
{
int r = crypt->r;
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "unknown crypt revision %d", r);
}
@@ -112,7 +112,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
memcpy(crypt->o, pdf_to_str_buf(obj), 48);
else
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "encryption dictionary missing owner password");
}
@@ -129,7 +129,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
}
else
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "encryption dictionary missing user password");
}
@@ -147,7 +147,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
obj = pdf_dict_gets(dict, "OE");
if (!pdf_is_string(obj) || pdf_to_str_len(obj) != 32)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "encryption dictionary missing owner encryption key");
}
memcpy(crypt->oe, pdf_to_str_buf(obj), 32);
@@ -155,7 +155,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
obj = pdf_dict_gets(dict, "UE");
if (!pdf_is_string(obj) || pdf_to_str_len(obj) != 32)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "encryption dictionary missing user encryption key");
}
memcpy(crypt->ue, pdf_to_str_buf(obj), 32);
@@ -192,12 +192,12 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
if (crypt->length % 8 != 0)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "invalid encryption key length");
}
if (crypt->length < 40 || crypt->length > 128)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_throw(ctx, FZ_ERROR_GENERIC, "invalid encryption key length");
}
}
@@ -244,7 +244,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
}
fz_catch(ctx)
{
- pdf_free_crypt(ctx, crypt);
+ pdf_drop_crypt(ctx, crypt);
fz_rethrow_message(ctx, "cannot parse string crypt filter (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj));
}
@@ -257,7 +257,7 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
}
void
-pdf_free_crypt(fz_context *ctx, pdf_crypt *crypt)
+pdf_drop_crypt(fz_context *ctx, pdf_crypt *crypt)
{
pdf_drop_obj(crypt->id);
pdf_drop_obj(crypt->cf);
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index 139c4363..0d8974be 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -1238,7 +1238,7 @@ pdf_dev_end_tile(fz_device *dev)
}
static void
-pdf_dev_free_user(fz_device *dev)
+pdf_dev_drop_user(fz_device *dev)
{
pdf_device *pdev = dev->user;
pdf_document *doc = pdev->doc;
@@ -1322,7 +1322,7 @@ fz_device *pdf_new_pdf_device(pdf_document *doc, pdf_obj *contents, pdf_obj *res
}
dev->rebind = pdf_dev_rebind;
- dev->free_user = pdf_dev_free_user;
+ dev->drop_user = pdf_dev_drop_user;
dev->fill_path = pdf_dev_fill_path;
dev->stroke_path = pdf_dev_stroke_path;
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index 5ac722f0..a0ee8bee 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -337,7 +337,7 @@ pdf_drop_font(fz_context *ctx, pdf_font_desc *fontdesc)
}
static void
-pdf_free_font_imp(fz_context *ctx, fz_storable *fontdesc_)
+pdf_drop_font_imp(fz_context *ctx, fz_storable *fontdesc_)
{
pdf_font_desc *fontdesc = (pdf_font_desc *)fontdesc_;
@@ -362,7 +362,7 @@ pdf_new_font_desc(fz_context *ctx)
pdf_font_desc *fontdesc;
fontdesc = fz_malloc_struct(ctx, pdf_font_desc);
- FZ_INIT_STORABLE(fontdesc, 1, pdf_free_font_imp);
+ FZ_INIT_STORABLE(fontdesc, 1, pdf_drop_font_imp);
fontdesc->size = sizeof(pdf_font_desc);
fontdesc->font = NULL;
@@ -825,7 +825,7 @@ pdf_load_hail_mary_font(pdf_document *doc)
pdf_font_desc *fontdesc;
pdf_font_desc *existing;
- if ((fontdesc = fz_find_item(ctx, pdf_free_font_imp, &hail_mary_store_type, &hail_mary_store_type)) != NULL)
+ if ((fontdesc = fz_find_item(ctx, pdf_drop_font_imp, &hail_mary_store_type, &hail_mary_store_type)) != NULL)
{
return fontdesc;
}
@@ -1221,7 +1221,7 @@ pdf_load_font(pdf_document *doc, pdf_obj *rdb, pdf_obj *dict, int nested_depth)
pdf_font_desc *fontdesc;
int type3 = 0;
- if ((fontdesc = pdf_find_item(ctx, pdf_free_font_imp, dict)) != NULL)
+ if ((fontdesc = pdf_find_item(ctx, pdf_drop_font_imp, dict)) != NULL)
{
return fontdesc;
}
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index c5e2ef78..62e635ca 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -720,7 +720,7 @@ void pdf_update_page(pdf_document *doc, pdf_page *page)
*/
if (page->tmp_annots)
{
- pdf_free_annot(ctx, page->tmp_annots);
+ pdf_drop_annot(ctx, page->tmp_annots);
page->tmp_annots = NULL;
}
diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c
index 00920732..c8986e32 100644
--- a/source/pdf/pdf-function.c
+++ b/source/pdf/pdf-function.c
@@ -867,7 +867,7 @@ load_postscript_func(pdf_function *func, pdf_document *doc, pdf_obj *dict, int n
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
pdf_lexbuf_fin(&buf);
}
fz_catch(ctx)
@@ -1035,7 +1035,7 @@ load_sample_func(pdf_function *func, pdf_document *doc, pdf_obj *dict, int num,
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
@@ -1363,7 +1363,7 @@ eval_stitching_func(fz_context *ctx, pdf_function *func, float in, float *out)
*/
static void
-pdf_free_function_imp(fz_context *ctx, fz_storable *func_)
+pdf_drop_function_imp(fz_context *ctx, fz_storable *func_)
{
pdf_function *func = (pdf_function *)func_;
int i;
@@ -1637,13 +1637,13 @@ pdf_load_function(pdf_document *doc, pdf_obj *dict, int in, int out)
if (pdf_obj_marked(dict))
fz_throw(ctx, FZ_ERROR_GENERIC, "Recursion in function definition");
- if ((func = pdf_find_item(ctx, pdf_free_function_imp, dict)) != NULL)
+ if ((func = pdf_find_item(ctx, pdf_drop_function_imp, dict)) != NULL)
{
return (fz_function *)func;
}
func = fz_malloc_struct(ctx, pdf_function);
- FZ_INIT_STORABLE(&func->base, 1, pdf_free_function_imp);
+ FZ_INIT_STORABLE(&func->base, 1, pdf_drop_function_imp);
func->base.size = sizeof(*func);
func->base.evaluate = pdf_eval_function;
#ifndef NDEBUG
diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c
index ffd21dd6..dd96f4fb 100644
--- a/source/pdf/pdf-image.c
+++ b/source/pdf/pdf-image.c
@@ -281,7 +281,7 @@ pdf_load_image(pdf_document *doc, pdf_obj *dict)
fz_context *ctx = doc->ctx;
fz_image *image;
- if ((image = pdf_find_item(ctx, fz_free_image, dict)) != NULL)
+ if ((image = pdf_find_item(ctx, fz_drop_image_imp, dict)) != NULL)
{
return (fz_image *)image;
}
diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c
index 359f6eda..b67de46e 100644
--- a/source/pdf/pdf-interpret.c
+++ b/source/pdf/pdf-interpret.c
@@ -55,7 +55,7 @@ pdf_clear_stack(pdf_csi *csi)
}
static void
-pdf_free_csi(pdf_csi *csi)
+pdf_drop_csi(pdf_csi *csi)
{
fz_context *ctx = csi->doc->ctx;
@@ -557,7 +557,7 @@ pdf_process_annot(pdf_document *doc, pdf_page *page, pdf_annot *annot, const pdf
}
fz_always(ctx)
{
- pdf_free_csi(csi);
+ pdf_drop_csi(csi);
}
fz_catch(ctx)
{
@@ -581,7 +581,7 @@ pdf_process_contents_object(pdf_csi *csi, pdf_obj *rdb, pdf_obj *contents)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -605,7 +605,7 @@ pdf_process_contents_buffer(pdf_csi *csi, pdf_obj *rdb, fz_buffer *contents)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -626,7 +626,7 @@ pdf_process_stream_object(pdf_document *doc, pdf_obj *obj, const pdf_process *pr
}
fz_always(ctx)
{
- pdf_free_csi(csi);
+ pdf_drop_csi(csi);
}
fz_catch(ctx)
{
@@ -648,7 +648,7 @@ pdf_process_glyph(pdf_document *doc, pdf_obj *resources, fz_buffer *contents, pd
}
fz_always(ctx)
{
- pdf_free_csi(csi);
+ pdf_drop_csi(csi);
}
fz_catch(ctx)
{
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c
index a3c44fe2..c3ac178a 100644
--- a/source/pdf/pdf-object.c
+++ b/source/pdf/pdf-object.c
@@ -1315,7 +1315,7 @@ void pdf_clean_obj(pdf_obj *obj)
}
static void
-pdf_free_array(pdf_obj *obj)
+pdf_drop_array(pdf_obj *obj)
{
fz_context *ctx = obj->doc->ctx;
int i;
@@ -1328,7 +1328,7 @@ pdf_free_array(pdf_obj *obj)
}
static void
-pdf_free_dict(pdf_obj *obj)
+pdf_drop_dict(pdf_obj *obj)
{
int i;
fz_context *ctx = obj->doc->ctx;
@@ -1350,9 +1350,9 @@ pdf_drop_obj(pdf_obj *obj)
if (--obj->refs)
return;
if (obj->kind == PDF_ARRAY)
- pdf_free_array(obj);
+ pdf_drop_array(obj);
else if (obj->kind == PDF_DICT)
- pdf_free_dict(obj);
+ pdf_drop_dict(obj);
else
fz_free(obj->doc->ctx, obj);
}
@@ -1402,7 +1402,7 @@ pdf_obj *pdf_new_obj_from_str(pdf_document *doc, const char *src)
fz_always(ctx)
{
pdf_lexbuf_fin(&lexbuf);
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
diff --git a/source/pdf/pdf-op-buffer.c b/source/pdf/pdf-op-buffer.c
index 22436ce5..6142620c 100644
--- a/source/pdf/pdf-op-buffer.c
+++ b/source/pdf/pdf-op-buffer.c
@@ -790,7 +790,7 @@ free_processor_buffer(pdf_csi *csi, void *state_)
pdf_buffer_state *state = (pdf_buffer_state *)state_;
fz_context *ctx = state->ctx;
- fz_close_output(state->out);
+ fz_drop_output(state->out);
fz_free(ctx, state);
}
@@ -930,7 +930,7 @@ pdf_process *pdf_process_buffer(pdf_process *process, fz_context *ctx, fz_buffer
}
fz_catch(ctx)
{
- fz_close_output(out);
+ fz_drop_output(out);
fz_rethrow(ctx);
}
diff --git a/source/pdf/pdf-outline.c b/source/pdf/pdf-outline.c
index 44273dda..4e4ad642 100644
--- a/source/pdf/pdf-outline.c
+++ b/source/pdf/pdf-outline.c
@@ -50,7 +50,7 @@ pdf_load_outline_imp(pdf_document *doc, pdf_obj *dict)
}
fz_catch(ctx)
{
- fz_free_outline(ctx, first);
+ fz_drop_outline(ctx, first);
fz_rethrow(ctx);
}
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index 6543b7dc..cf4d1803 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -508,7 +508,7 @@ pdf_load_page(pdf_document *doc, int number)
{
if (fz_caught(ctx) != FZ_ERROR_TRYLATER)
{
- pdf_free_page(doc, page);
+ pdf_drop_page(doc, page);
fz_rethrow_message(ctx, "cannot load page %d contents (%d 0 R)", number + 1, pdf_to_num(pageref));
}
page->incomplete |= PDF_PAGE_INCOMPLETE_CONTENTS;
@@ -536,7 +536,7 @@ pdf_load_links(pdf_document *doc, pdf_page *page)
}
void
-pdf_free_page(pdf_document *doc, pdf_page *page)
+pdf_drop_page(pdf_document *doc, pdf_page *page)
{
if (page == NULL)
return;
@@ -545,11 +545,11 @@ pdf_free_page(pdf_document *doc, pdf_page *page)
if (page->links)
fz_drop_link(doc->ctx, page->links);
if (page->annots)
- pdf_free_annot(doc->ctx, page->annots);
+ pdf_drop_annot(doc->ctx, page->annots);
if (page->deleted_annots)
- pdf_free_annot(doc->ctx, page->deleted_annots);
+ pdf_drop_annot(doc->ctx, page->deleted_annots);
if (page->tmp_annots)
- pdf_free_annot(doc->ctx, page->tmp_annots);
+ pdf_drop_annot(doc->ctx, page->tmp_annots);
/* doc->focus, when not NULL, refers to one of
* the annotations and must be NULLed when the
* annotations are destroyed. doc->focus_obj
diff --git a/source/pdf/pdf-pattern.c b/source/pdf/pdf-pattern.c
index f13a49c9..785acfe5 100644
--- a/source/pdf/pdf-pattern.c
+++ b/source/pdf/pdf-pattern.c
@@ -13,7 +13,7 @@ pdf_drop_pattern(fz_context *ctx, pdf_pattern *pat)
}
static void
-pdf_free_pattern_imp(fz_context *ctx, fz_storable *pat_)
+pdf_drop_pattern_imp(fz_context *ctx, fz_storable *pat_)
{
pdf_pattern *pat = (pdf_pattern *)pat_;
@@ -39,13 +39,13 @@ pdf_load_pattern(pdf_document *doc, pdf_obj *dict)
pdf_obj *obj;
fz_context *ctx = doc->ctx;
- if ((pat = pdf_find_item(ctx, pdf_free_pattern_imp, dict)) != NULL)
+ if ((pat = pdf_find_item(ctx, pdf_drop_pattern_imp, dict)) != NULL)
{
return pat;
}
pat = fz_malloc_struct(ctx, pdf_pattern);
- FZ_INIT_STORABLE(pat, 1, pdf_free_pattern_imp);
+ FZ_INIT_STORABLE(pat, 1, pdf_drop_pattern_imp);
pat->resources = NULL;
pat->contents = NULL;
@@ -75,7 +75,7 @@ pdf_load_pattern(pdf_document *doc, pdf_obj *dict)
}
fz_catch(ctx)
{
- pdf_remove_item(ctx, pdf_free_pattern_imp, dict);
+ pdf_remove_item(ctx, pdf_drop_pattern_imp, dict);
pdf_drop_pattern(ctx, pat);
fz_rethrow_message(ctx, "cannot load pattern stream (%d %d R)", pdf_to_num(dict), pdf_to_gen(dict));
}
diff --git a/source/pdf/pdf-pkcs7.c b/source/pdf/pdf-pkcs7.c
index a36d1592..7af97a6d 100644
--- a/source/pdf/pdf-pkcs7.c
+++ b/source/pdf/pdf-pkcs7.c
@@ -357,7 +357,7 @@ struct pdf_signer_s
EVP_PKEY *pkey;
};
-void pdf_free_designated_name(pdf_designated_name *dn)
+void pdf_drop_designated_name(pdf_designated_name *dn)
{
if (dn)
fz_free(((pdf_designated_name_openssl *)dn)->ctx, dn);
@@ -776,7 +776,7 @@ void pdf_sign_signature(pdf_document *doc, pdf_widget *widget, const char *sigfi
fz_always(ctx)
{
pdf_drop_signer(signer);
- pdf_free_designated_name(dn);
+ pdf_drop_designated_name(dn);
fz_drop_buffer(ctx, fzbuf);
}
fz_catch(ctx)
diff --git a/source/pdf/pdf-repair.c b/source/pdf/pdf-repair.c
index 3bd3850a..3cc05fc5 100644
--- a/source/pdf/pdf-repair.c
+++ b/source/pdf/pdf-repair.c
@@ -225,7 +225,7 @@ pdf_repair_obj_stm(pdf_document *doc, int num, int gen)
}
fz_always(ctx)
{
- fz_close(stm);
+ fz_drop_stream(stm);
pdf_lexbuf_fin(&buf);
}
fz_catch(ctx)
diff --git a/source/pdf/pdf-shade.c b/source/pdf/pdf-shade.c
index 40728dc7..c5009059 100644
--- a/source/pdf/pdf-shade.c
+++ b/source/pdf/pdf-shade.c
@@ -330,7 +330,7 @@ pdf_load_shading_dict(pdf_document *doc, pdf_obj *dict, const fz_matrix *transfo
fz_try(ctx)
{
shade = fz_malloc_struct(ctx, fz_shade);
- FZ_INIT_STORABLE(shade, 1, fz_free_shade_imp);
+ FZ_INIT_STORABLE(shade, 1, fz_drop_shade_imp);
shade->type = FZ_MESH_TYPE4;
shade->use_background = 0;
shade->use_function = 0;
@@ -456,7 +456,7 @@ pdf_load_shading(pdf_document *doc, pdf_obj *dict)
fz_context *ctx = doc->ctx;
fz_shade *shade;
- if ((shade = pdf_find_item(ctx, fz_free_shade_imp, dict)) != NULL)
+ if ((shade = pdf_find_item(ctx, fz_drop_shade_imp, dict)) != NULL)
{
return shade;
}
diff --git a/source/pdf/pdf-store.c b/source/pdf/pdf-store.c
index f8b44c44..7349e9d4 100644
--- a/source/pdf/pdf-store.c
+++ b/source/pdf/pdf-store.c
@@ -66,13 +66,13 @@ pdf_store_item(fz_context *ctx, pdf_obj *key, void *val, unsigned int itemsize)
}
void *
-pdf_find_item(fz_context *ctx, fz_store_free_fn *free, pdf_obj *key)
+pdf_find_item(fz_context *ctx, fz_store_drop_fn *drop, pdf_obj *key)
{
- return fz_find_item(ctx, free, key, &pdf_obj_store_type);
+ return fz_find_item(ctx, drop, key, &pdf_obj_store_type);
}
void
-pdf_remove_item(fz_context *ctx, fz_store_free_fn *free, pdf_obj *key)
+pdf_remove_item(fz_context *ctx, fz_store_drop_fn *drop, pdf_obj *key)
{
- fz_remove_item(ctx, free, key, &pdf_obj_store_type);
+ fz_remove_item(ctx, drop, key, &pdf_obj_store_type);
}
diff --git a/source/pdf/pdf-stream.c b/source/pdf/pdf-stream.c
index f859719b..9efd1887 100644
--- a/source/pdf/pdf-stream.c
+++ b/source/pdf/pdf-stream.c
@@ -54,7 +54,7 @@ pdf_load_jbig2_globals(pdf_document *doc, pdf_obj *dict)
fz_var(buf);
- if ((globals = pdf_find_item(ctx, fz_free_jbig2_globals_imp, dict)) != NULL)
+ if ((globals = pdf_find_item(ctx, fz_drop_jbig2_globals_imp, dict)) != NULL)
{
return globals;
}
@@ -256,7 +256,7 @@ build_filter_chain(fz_stream *chain, pdf_document *doc, pdf_obj *fs, pdf_obj *ps
}
fz_catch(ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
@@ -332,7 +332,7 @@ pdf_open_filter(fz_stream *chain, pdf_document *doc, pdf_obj *stmobj, int num, i
}
fz_catch(doc->ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(doc->ctx);
}
@@ -384,7 +384,7 @@ pdf_load_compressed_inline_image(pdf_document *doc, pdf_obj *dict, int length, f
}
fz_catch(ctx)
{
- fz_free_compressed_buffer(ctx, bc);
+ fz_drop_compressed_buffer(ctx, bc);
fz_rethrow(ctx);
}
image->buffer = bc;
@@ -483,7 +483,7 @@ pdf_load_raw_renumbered_stream(pdf_document *doc, int num, int gen, int orig_num
buf = fz_read_all(stm, len);
- fz_close(stm);
+ fz_drop_stream(stm);
return buf;
}
@@ -543,7 +543,7 @@ pdf_load_image_stream(pdf_document *doc, int num, int gen, int orig_num, int ori
}
fz_always(ctx)
{
- fz_close(stm);
+ fz_drop_stream(stm);
}
fz_catch(ctx)
{
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 078719a6..32143c10 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -2553,7 +2553,7 @@ static void sanitise(pdf_document *doc)
pdf_clean_page_contents(doc, page, NULL);
- pdf_free_page(doc, page);
+ pdf_drop_page(doc, page);
}
}
diff --git a/source/pdf/pdf-xobject.c b/source/pdf/pdf-xobject.c
index c4259466..c350eb0a 100644
--- a/source/pdf/pdf-xobject.c
+++ b/source/pdf/pdf-xobject.c
@@ -13,7 +13,7 @@ pdf_drop_xobject(fz_context *ctx, pdf_xobject *xobj)
}
static void
-pdf_free_xobject_imp(fz_context *ctx, fz_storable *xobj_)
+pdf_drop_xobject_imp(fz_context *ctx, fz_storable *xobj_)
{
pdf_xobject *xobj = (pdf_xobject *)xobj_;
@@ -40,13 +40,13 @@ pdf_load_xobject(pdf_document *doc, pdf_obj *dict)
pdf_obj *obj;
fz_context *ctx = doc->ctx;
- if ((form = pdf_find_item(ctx, pdf_free_xobject_imp, dict)) != NULL)
+ if ((form = pdf_find_item(ctx, pdf_drop_xobject_imp, dict)) != NULL)
{
return form;
}
form = fz_malloc_struct(ctx, pdf_xobject);
- FZ_INIT_STORABLE(form, 1, pdf_free_xobject_imp);
+ FZ_INIT_STORABLE(form, 1, pdf_drop_xobject_imp);
form->resources = NULL;
form->contents = NULL;
form->colorspace = NULL;
@@ -105,7 +105,7 @@ pdf_load_xobject(pdf_document *doc, pdf_obj *dict)
}
fz_catch(ctx)
{
- pdf_remove_item(ctx, pdf_free_xobject_imp, dict);
+ pdf_remove_item(ctx, pdf_drop_xobject_imp, dict);
pdf_drop_xobject(ctx, form);
fz_rethrow_message(ctx, "cannot load xobject content stream (%d %d R)", pdf_to_num(dict), pdf_to_gen(dict));
}
@@ -182,7 +182,7 @@ pdf_new_xobject(pdf_document *doc, const fz_rect *bbox, const fz_matrix *mat)
obj = NULL;
form = fz_malloc_struct(ctx, pdf_xobject);
- FZ_INIT_STORABLE(form, 1, pdf_free_xobject_imp);
+ FZ_INIT_STORABLE(form, 1, pdf_drop_xobject_imp);
form->resources = NULL;
form->contents = NULL;
form->colorspace = NULL;
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 172c13e6..ef82cc2f 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -20,7 +20,7 @@ static inline int iswhite(int ch)
* xref tables
*/
-static void pdf_free_xref_sections(pdf_document *doc)
+static void pdf_drop_xref_sections(pdf_document *doc)
{
fz_context *ctx = doc->ctx;
int x, e;
@@ -439,7 +439,7 @@ void pdf_replace_xref(pdf_document *doc, pdf_xref_entry *entries, int n)
sub = fz_malloc_struct(ctx, pdf_xref_subsec);
/* The new table completely replaces the previous separate sections */
- pdf_free_xref_sections(doc);
+ pdf_drop_xref_sections(doc);
sub->table = entries;
sub->start = 0;
@@ -877,7 +877,7 @@ pdf_read_new_xref(pdf_document *doc, pdf_lexbuf *buf)
}
fz_always(ctx)
{
- fz_close(stm);
+ fz_drop_stream(stm);
}
fz_catch(ctx)
{
@@ -1306,7 +1306,7 @@ pdf_read_ocg(pdf_document *doc)
}
static void
-pdf_free_ocg(fz_context *ctx, pdf_ocg_descriptor *desc)
+pdf_drop_ocg(fz_context *ctx, pdf_ocg_descriptor *desc)
{
if (!desc)
return;
@@ -1359,7 +1359,7 @@ pdf_init_document(pdf_document *doc)
}
fz_catch(ctx)
{
- pdf_free_xref_sections(doc);
+ pdf_drop_xref_sections(doc);
fz_rethrow_if(ctx, FZ_ERROR_TRYLATER);
fz_warn(ctx, "trying to repair broken xref");
repaired = 1;
@@ -1492,15 +1492,15 @@ pdf_close_document(pdf_document *doc)
if (doc->js)
doc->drop_js(doc->js);
- pdf_free_xref_sections(doc);
+ pdf_drop_xref_sections(doc);
fz_free(ctx, doc->xref_index);
if (doc->focus_obj)
pdf_drop_obj(doc->focus_obj);
if (doc->file)
- fz_close(doc->file);
+ fz_drop_stream(doc->file);
if (doc->crypt)
- pdf_free_crypt(ctx, doc->crypt);
+ pdf_drop_crypt(ctx, doc->crypt);
pdf_drop_obj(doc->linear_obj);
if (doc->linear_page_refs)
@@ -1531,7 +1531,7 @@ pdf_close_document(pdf_document *doc)
}
fz_free(ctx, doc->type3_fonts);
- pdf_free_ocg(ctx, doc->ocg);
+ pdf_drop_ocg(ctx, doc->ocg);
fz_empty_store(ctx);
@@ -1659,7 +1659,7 @@ pdf_load_obj_stm(pdf_document *doc, int num, int gen, pdf_lexbuf *buf, int targe
}
fz_always(ctx)
{
- fz_close(stm);
+ fz_drop_stream(stm);
fz_free(ctx, ofsbuf);
fz_free(ctx, numbuf);
pdf_drop_obj(objstm);
@@ -2282,7 +2282,7 @@ pdf_new_document(fz_context *ctx, fz_stream *file)
doc->super.bound_annot = (fz_document_bound_annot_fn *)pdf_bound_annot;
doc->super.run_page_contents = NULL; /* see pdf_xref_aux.c */
doc->super.run_annot = NULL; /* see pdf_xref_aux.c */
- doc->super.free_page = (fz_document_free_page_fn *)pdf_free_page;
+ doc->super.free_page = (fz_document_free_page_fn *)pdf_drop_page;
doc->super.meta = (fz_document_meta_fn *)pdf_meta;
doc->super.page_presentation = (fz_document_page_presentation_fn *)pdf_page_presentation;
doc->super.write = (fz_document_write_fn *)pdf_write_document;
@@ -2331,7 +2331,7 @@ pdf_open_document_no_run(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -2543,7 +2543,7 @@ pdf_load_hints(pdf_document *doc, int objnum, int gennum)
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{