summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/cbz.h2
-rw-r--r--include/mupdf/fitz/colorspace.h2
-rw-r--r--include/mupdf/fitz/compressed-buffer.h2
-rw-r--r--include/mupdf/fitz/context.h8
-rw-r--r--include/mupdf/fitz/device.h10
-rw-r--r--include/mupdf/fitz/display-list.h2
-rw-r--r--include/mupdf/fitz/document.h2
-rw-r--r--include/mupdf/fitz/filter.h2
-rw-r--r--include/mupdf/fitz/hash.h2
-rw-r--r--include/mupdf/fitz/image.h2
-rw-r--r--include/mupdf/fitz/link.h2
-rw-r--r--include/mupdf/fitz/outline.h4
-rw-r--r--include/mupdf/fitz/output.h4
-rw-r--r--include/mupdf/fitz/pixmap.h7
-rw-r--r--include/mupdf/fitz/shade.h2
-rw-r--r--include/mupdf/fitz/store.h18
-rw-r--r--include/mupdf/fitz/stream.h6
-rw-r--r--include/mupdf/fitz/structured-text.h4
-rw-r--r--include/mupdf/fitz/tree.h2
-rw-r--r--include/mupdf/fitz/unzip.h2
-rw-r--r--include/mupdf/fitz/xml.h4
-rw-r--r--include/mupdf/img.h2
-rw-r--r--include/mupdf/pdf/annot.h2
-rw-r--r--include/mupdf/pdf/cmap.h2
-rw-r--r--include/mupdf/pdf/crypt.h4
-rw-r--r--include/mupdf/pdf/document.h2
-rw-r--r--include/mupdf/pdf/page.h4
-rw-r--r--include/mupdf/pdf/resource.h4
-rw-r--r--include/mupdf/tiff.h2
-rw-r--r--include/mupdf/xps.h10
-rw-r--r--platform/android/jni/mupdf.c56
-rw-r--r--platform/ios/Classes/MuDocumentController.m2
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m18
-rw-r--r--platform/ios/Classes/MuPageViewReflow.m8
-rw-r--r--platform/ios/Classes/MuPrintPageRenderer.m2
-rw-r--r--platform/ios/common.m6
-rw-r--r--platform/x11/jstest_main.c2
-rw-r--r--platform/x11/pdfapp.c24
-rw-r--r--platform/x11/win_main.c2
-rw-r--r--platform/x11/x11_main.c2
-rw-r--r--scripts/cmapdump.c8
-rw-r--r--source/cbz/mucbz.c4
-rw-r--r--source/fitz/bbox-device.c4
-rw-r--r--source/fitz/buffer.c2
-rw-r--r--source/fitz/colorspace.c20
-rw-r--r--source/fitz/compressed-buffer.c2
-rw-r--r--source/fitz/context.c8
-rw-r--r--source/fitz/device.c6
-rw-r--r--source/fitz/draw-device.c24
-rw-r--r--source/fitz/draw-edge.c4
-rw-r--r--source/fitz/draw-imp.h2
-rw-r--r--source/fitz/draw-scale-simple.c2
-rw-r--r--source/fitz/filter-basic.c28
-rw-r--r--source/fitz/filter-dct.c8
-rw-r--r--source/fitz/filter-fax.c4
-rw-r--r--source/fitz/filter-flate.c4
-rw-r--r--source/fitz/filter-jbig2.c8
-rw-r--r--source/fitz/filter-leech.c4
-rw-r--r--source/fitz/filter-lzw.c4
-rw-r--r--source/fitz/filter-predict.c4
-rw-r--r--source/fitz/font.c6
-rw-r--r--source/fitz/glyph.c12
-rw-r--r--source/fitz/hash.c2
-rw-r--r--source/fitz/image.c16
-rw-r--r--source/fitz/link.c6
-rw-r--r--source/fitz/list-device.c4
-rw-r--r--source/fitz/load-tiff.c12
-rw-r--r--source/fitz/outline.c6
-rw-r--r--source/fitz/output-pcl.c4
-rw-r--r--source/fitz/output-pwg.c4
-rw-r--r--source/fitz/output.c2
-rw-r--r--source/fitz/pixmap.c14
-rw-r--r--source/fitz/shade.c12
-rw-r--r--source/fitz/stext-device.c20
-rw-r--r--source/fitz/store.c32
-rw-r--r--source/fitz/stream-open.c2
-rw-r--r--source/fitz/stream-read.c2
-rw-r--r--source/fitz/svg-device.c6
-rw-r--r--source/fitz/test-device.c6
-rw-r--r--source/fitz/tree.c10
-rw-r--r--source/fitz/unzip.c8
-rw-r--r--source/fitz/xml.c6
-rw-r--r--source/img/muimage.c4
-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
-rw-r--r--source/tiff/mutiff.c4
-rw-r--r--source/tools/mjsgen.c2
-rw-r--r--source/tools/mudraw.c40
-rw-r--r--source/tools/pdfclean.c2
-rw-r--r--source/tools/pdfextract.c2
-rw-r--r--source/tools/pdfinfo.c4
-rw-r--r--source/tools/pdfposter.c2
-rw-r--r--source/tools/pdfshow.c4
-rw-r--r--source/xps/xps-doc.c36
-rw-r--r--source/xps/xps-glyphs.c2
-rw-r--r--source/xps/xps-gradient.c4
-rw-r--r--source/xps/xps-image.c2
-rw-r--r--source/xps/xps-outline.c4
-rw-r--r--source/xps/xps-resource.c8
-rw-r--r--source/xps/xps-tile.c4
-rw-r--r--source/xps/xps-zip.c10
125 files changed, 468 insertions, 469 deletions
diff --git a/include/mupdf/cbz.h b/include/mupdf/cbz.h
index 5c0f9a66..7aebe3f2 100644
--- a/include/mupdf/cbz.h
+++ b/include/mupdf/cbz.h
@@ -28,7 +28,7 @@ cbz_document *cbz_open_document(fz_context *ctx, const char *filename);
filename to locate the document to open. Increments the
reference count of the stream. See fz_open_file,
fz_open_file_w or fz_open_fd for opening a stream, and
- fz_close for closing an open stream.
+ fz_drop_stream for closing an open stream.
*/
cbz_document *cbz_open_document_with_stream(fz_context *ctx, fz_stream *file);
diff --git a/include/mupdf/fitz/colorspace.h b/include/mupdf/fitz/colorspace.h
index 1572211f..7cd6aba5 100644
--- a/include/mupdf/fitz/colorspace.h
+++ b/include/mupdf/fitz/colorspace.h
@@ -84,7 +84,7 @@ fz_colorspace *fz_new_colorspace(fz_context *ctx, char *name, int n);
fz_colorspace *fz_new_indexed_colorspace(fz_context *ctx, fz_colorspace *base, int high, unsigned char *lookup);
fz_colorspace *fz_keep_colorspace(fz_context *ctx, fz_colorspace *colorspace);
void fz_drop_colorspace(fz_context *ctx, fz_colorspace *colorspace);
-void fz_free_colorspace_imp(fz_context *ctx, fz_storable *colorspace);
+void fz_drop_colorspace_imp(fz_context *ctx, fz_storable *colorspace);
void fz_convert_color(fz_context *ctx, fz_colorspace *dsts, float *dstv, fz_colorspace *srcs, const float *srcv);
diff --git a/include/mupdf/fitz/compressed-buffer.h b/include/mupdf/fitz/compressed-buffer.h
index 384a7744..5139b90d 100644
--- a/include/mupdf/fitz/compressed-buffer.h
+++ b/include/mupdf/fitz/compressed-buffer.h
@@ -76,6 +76,6 @@ struct fz_compressed_buffer_s
fz_buffer *buffer;
};
-void fz_free_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf);
+void fz_drop_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf);
#endif
diff --git a/include/mupdf/fitz/context.h b/include/mupdf/fitz/context.h
index dc134511..79406942 100644
--- a/include/mupdf/fitz/context.h
+++ b/include/mupdf/fitz/context.h
@@ -131,7 +131,7 @@ enum {
The global state contains an exception stack, resource store,
etc. Most functions in MuPDF take a context argument to be
- able to reference the global state. See fz_free_context for
+ able to reference the global state. See fz_drop_context for
freeing an allocated context.
alloc: Supply a custom memory allocator through a set of
@@ -176,7 +176,7 @@ fz_context *fz_new_context_imp(fz_alloc_context *alloc, fz_locks_context *locks,
fz_context *fz_clone_context(fz_context *ctx);
/*
- fz_free_context: Free a context and its global state.
+ fz_drop_context: Free a context and its global state.
The context and all of its global state is freed, and any
buffered warnings are flushed (see fz_flush_warnings). If NULL
@@ -184,7 +184,7 @@ fz_context *fz_clone_context(fz_context *ctx);
Does not throw exceptions.
*/
-void fz_free_context(fz_context *ctx);
+void fz_drop_context(fz_context *ctx);
/*
fz_aa_level: Get the number of bits of antialiasing we are
@@ -410,7 +410,7 @@ struct fz_warn_context_s
fz_context *fz_clone_context_internal(fz_context *ctx);
void fz_new_aa_context(fz_context *ctx);
-void fz_free_aa_context(fz_context *ctx);
+void fz_drop_aa_context(fz_context *ctx);
void fz_copy_aa_context(fz_context *dst, fz_context *src);
void fz_new_document_handler_context(fz_context *ctx);
diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h
index ef27cd5d..4fdf2e43 100644
--- a/include/mupdf/fitz/device.h
+++ b/include/mupdf/fitz/device.h
@@ -100,7 +100,7 @@ struct fz_device_s
int flags;
void *user;
- void (*free_user)(fz_device *);
+ void (*drop_user)(fz_device *);
fz_context *ctx;
void (*rebind)(fz_device *);
@@ -171,9 +171,9 @@ void fz_end_tile(fz_device *dev);
fz_device *fz_new_device(fz_context *ctx, void *user);
/*
- fz_free_device: Free a devices of any type and its resources.
+ fz_drop_device: Free a devices of any type and its resources.
*/
-void fz_free_device(fz_device *dev);
+void fz_drop_device(fz_device *dev);
/*
fz_enable_device_hints : Enable hints in a device.
@@ -304,7 +304,7 @@ fz_device *fz_new_test_device(fz_context *ctx, int *is_color, float threshold);
for how to obtain a pixmap. The pixmap is not cleared by the
draw device, see fz_clear_pixmap* for how to clear it prior to
calling fz_new_draw_device. Free the device by calling
- fz_free_device.
+ fz_drop_device.
*/
fz_device *fz_new_draw_device(fz_context *ctx, fz_pixmap *dest);
@@ -315,7 +315,7 @@ fz_device *fz_new_draw_device(fz_context *ctx, fz_pixmap *dest);
for how to obtain a pixmap. The pixmap is not cleared by the
draw device, see fz_clear_pixmap* for how to clear it prior to
calling fz_new_draw_device. Free the device by calling
- fz_free_device.
+ fz_drop_device.
clip: Bounding box to restrict any marking operations of the
draw device.
diff --git a/include/mupdf/fitz/display-list.h b/include/mupdf/fitz/display-list.h
index 080ca5b5..269e8f9f 100644
--- a/include/mupdf/fitz/display-list.h
+++ b/include/mupdf/fitz/display-list.h
@@ -40,7 +40,7 @@ fz_display_list *fz_new_display_list(fz_context *ctx);
display list can later be reused to render a page many times
without having to re-interpret the page from the document file
for each rendering. Once the device is no longer needed, free
- it with fz_free_device.
+ it with fz_drop_device.
list: A display list that the list device takes ownership of.
*/
diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h
index cc078044..f1a0a663 100644
--- a/include/mupdf/fitz/document.h
+++ b/include/mupdf/fitz/document.h
@@ -147,7 +147,7 @@ int fz_authenticate_password(fz_document *doc, const char *password);
/*
fz_load_outline: Load the hierarchical document outline.
- Should be freed by fz_free_outline.
+ Should be freed by fz_drop_outline.
*/
fz_outline *fz_load_outline(fz_document *doc);
diff --git a/include/mupdf/fitz/filter.h b/include/mupdf/fitz/filter.h
index d8a6729f..534ed34f 100644
--- a/include/mupdf/fitz/filter.h
+++ b/include/mupdf/fitz/filter.h
@@ -28,6 +28,6 @@ fz_stream *fz_open_predict(fz_stream *chain, int predictor, int columns, int col
fz_stream *fz_open_jbig2d(fz_stream *chain, fz_jbig2_globals *globals);
fz_jbig2_globals *fz_load_jbig2_globals(fz_context *ctx, unsigned char *data, int size);
-void fz_free_jbig2_globals_imp(fz_context *ctx, fz_storable *globals);
+void fz_drop_jbig2_globals_imp(fz_context *ctx, fz_storable *globals);
#endif
diff --git a/include/mupdf/fitz/hash.h b/include/mupdf/fitz/hash.h
index f70e9693..c56c9d13 100644
--- a/include/mupdf/fitz/hash.h
+++ b/include/mupdf/fitz/hash.h
@@ -12,7 +12,7 @@ typedef struct fz_hash_table_s fz_hash_table;
fz_hash_table *fz_new_hash_table(fz_context *ctx, int initialsize, int keylen, int lock);
void fz_empty_hash(fz_context *ctx, fz_hash_table *table);
-void fz_free_hash(fz_context *ctx, fz_hash_table *table);
+void fz_drop_hash(fz_context *ctx, fz_hash_table *table);
void *fz_hash_find(fz_context *ctx, fz_hash_table *table, const void *key);
void *fz_hash_insert(fz_context *ctx, fz_hash_table *table, const void *key, void *val);
diff --git a/include/mupdf/fitz/image.h b/include/mupdf/fitz/image.h
index 22d87988..3d40cb1d 100644
--- a/include/mupdf/fitz/image.h
+++ b/include/mupdf/fitz/image.h
@@ -57,7 +57,7 @@ fz_image *fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image
fz_image *fz_new_image_from_data(fz_context *ctx, unsigned char *data, int len);
fz_image *fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer);
fz_pixmap *fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h);
-void fz_free_image(fz_context *ctx, fz_storable *image);
+void fz_drop_image_imp(fz_context *ctx, fz_storable *image);
fz_pixmap *fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, int indexed, int l2factor, int native_l2factor);
fz_pixmap *fz_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src);
diff --git a/include/mupdf/fitz/link.h b/include/mupdf/fitz/link.h
index 47648a4c..586a5aa2 100644
--- a/include/mupdf/fitz/link.h
+++ b/include/mupdf/fitz/link.h
@@ -173,6 +173,6 @@ fz_link *fz_keep_link(fz_context *ctx, fz_link *link);
*/
void fz_drop_link(fz_context *ctx, fz_link *link);
-void fz_free_link_dest(fz_context *ctx, fz_link_dest *dest);
+void fz_drop_link_dest(fz_context *ctx, fz_link_dest *dest);
#endif
diff --git a/include/mupdf/fitz/outline.h b/include/mupdf/fitz/outline.h
index 48718be7..6a3ca81a 100644
--- a/include/mupdf/fitz/outline.h
+++ b/include/mupdf/fitz/outline.h
@@ -55,12 +55,12 @@ void fz_print_outline_xml(fz_context *ctx, fz_output *out, fz_outline *outline);
void fz_print_outline(fz_context *ctx, fz_output *out, fz_outline *outline);
/*
- fz_free_outline: Free hierarchical outline.
+ fz_drop_outline: Free hierarchical outline.
Free an outline obtained from fz_load_outline.
Does not throw exceptions.
*/
-void fz_free_outline(fz_context *ctx, fz_outline *outline);
+void fz_drop_outline(fz_context *ctx, fz_outline *outline);
#endif
diff --git a/include/mupdf/fitz/output.h b/include/mupdf/fitz/output.h
index 5bbf3d92..8398f83a 100644
--- a/include/mupdf/fitz/output.h
+++ b/include/mupdf/fitz/output.h
@@ -60,13 +60,13 @@ int fz_write(fz_output *out, const void *data, int len);
void fz_putc(fz_output *out, char c);
/*
- fz_close_output: Close a previously opened fz_output stream.
+ fz_drop_output: Close a previously opened fz_output stream.
Note: whether or not this closes the underlying output method is
method dependent. FILE * streams created by fz_new_output_with_file
are NOT closed.
*/
-void fz_close_output(fz_output *);
+void fz_drop_output(fz_output *);
void fz_rebind_output(fz_output *, fz_context *ctx);
diff --git a/include/mupdf/fitz/pixmap.h b/include/mupdf/fitz/pixmap.h
index 800effd0..c8d64dd1 100644
--- a/include/mupdf/fitz/pixmap.h
+++ b/include/mupdf/fitz/pixmap.h
@@ -267,8 +267,7 @@ void fz_convert_pixmap(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src);
free_samples: Is zero when an application has provided its own
buffer for pixel data through fz_new_pixmap_with_bbox_and_data.
- If not zero the buffer will be freed when fz_drop_pixmap is
- called for the pixmap.
+ If non-zero the buffer will be freed along with the the pixmap.
*/
struct fz_pixmap_s
{
@@ -281,7 +280,7 @@ struct fz_pixmap_s
int free_samples;
};
-void fz_free_pixmap_imp(fz_context *ctx, fz_storable *pix);
+void fz_drop_pixmap_imp(fz_context *ctx, fz_storable *pix);
void fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_irect *r);
void fz_premultiply_pixmap(fz_context *ctx, fz_pixmap *pix);
@@ -293,7 +292,7 @@ fz_pixmap *fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, fl
typedef struct fz_scale_cache_s fz_scale_cache;
fz_scale_cache *fz_new_scale_cache(fz_context *ctx);
-void fz_free_scale_cache(fz_context *ctx, fz_scale_cache *cache);
+void fz_drop_scale_cache(fz_context *ctx, fz_scale_cache *cache);
fz_pixmap *fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y);
void fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor);
diff --git a/include/mupdf/fitz/shade.h b/include/mupdf/fitz/shade.h
index 3cd43bd7..aa7061b9 100644
--- a/include/mupdf/fitz/shade.h
+++ b/include/mupdf/fitz/shade.h
@@ -74,7 +74,7 @@ struct fz_shade_s
fz_shade *fz_keep_shade(fz_context *ctx, fz_shade *shade);
void fz_drop_shade(fz_context *ctx, fz_shade *shade);
-void fz_free_shade_imp(fz_context *ctx, fz_storable *shade);
+void fz_drop_shade_imp(fz_context *ctx, fz_storable *shade);
fz_rect *fz_bound_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_rect *r);
void fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox);
diff --git a/include/mupdf/fitz/store.h b/include/mupdf/fitz/store.h
index f954e3b8..b40aa89a 100644
--- a/include/mupdf/fitz/store.h
+++ b/include/mupdf/fitz/store.h
@@ -27,16 +27,16 @@
typedef struct fz_storable_s fz_storable;
-typedef void (fz_store_free_fn)(fz_context *, fz_storable *);
+typedef void (fz_store_drop_fn)(fz_context *, fz_storable *);
struct fz_storable_s {
int refs;
- fz_store_free_fn *free;
+ fz_store_drop_fn *drop;
};
-#define FZ_INIT_STORABLE(S_,RC,FREE) \
+#define FZ_INIT_STORABLE(S_,RC,DROP) \
do { fz_storable *S = &(S_)->storable; S->refs = (RC); \
- S->free = (FREE); \
+ S->drop = (DROP); \
} while (0)
void *fz_keep_storable(fz_context *, fz_storable *);
@@ -62,7 +62,7 @@ typedef struct fz_store_hash_s fz_store_hash;
struct fz_store_hash_s
{
- fz_store_free_fn *free;
+ fz_store_drop_fn *drop;
union
{
struct
@@ -138,7 +138,7 @@ void *fz_store_item(fz_context *ctx, void *key, void *val, unsigned int itemsize
/*
fz_find_item: Find an item within the store.
- free: The function used to free the value (to ensure we get a value
+ drop: The function used to free the value (to ensure we get a value
of the correct type).
key: The key to use to index the item.
@@ -148,21 +148,21 @@ void *fz_store_item(fz_context *ctx, void *key, void *val, unsigned int itemsize
Returns NULL for not found, otherwise returns a pointer to the value
indexed by key to which a reference has been taken.
*/
-void *fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *type);
+void *fz_find_item(fz_context *ctx, fz_store_drop_fn *drop, void *key, fz_store_type *type);
/*
fz_remove_item: Remove an item from the store.
If an item indexed by the given key exists in the store, remove it.
- free: The function used to free the value (to ensure we get a value
+ drop: The function used to free the value (to ensure we get a value
of the correct type).
key: The key to use to find the item to remove.
type: Functions used to manipulate the key.
*/
-void fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *type);
+void fz_remove_item(fz_context *ctx, fz_store_drop_fn *drop, void *key, fz_store_type *type);
/*
fz_empty_store: Evict everything from the store.
diff --git a/include/mupdf/fitz/stream.h b/include/mupdf/fitz/stream.h
index fb3ef932..624060f3 100644
--- a/include/mupdf/fitz/stream.h
+++ b/include/mupdf/fitz/stream.h
@@ -10,7 +10,7 @@
directions.
Streams are reference counted, so references must be dropped
- by a call to fz_close.
+ by a call to fz_drop_stream.
Only the data between rp and wp is valid.
*/
@@ -91,7 +91,7 @@ fz_stream *fz_open_buffer(fz_context *ctx, fz_buffer *buf);
fz_stream *fz_open_leecher(fz_stream *chain, fz_buffer *buf);
/*
- fz_close: Close an open stream.
+ fz_drop_stream: Close an open stream.
Drops a reference for the stream. Once no references remain
the stream will be closed, as will any file descriptor the
@@ -99,7 +99,7 @@ fz_stream *fz_open_leecher(fz_stream *chain, fz_buffer *buf);
Does not throw exceptions.
*/
-void fz_close(fz_stream *stm);
+void fz_drop_stream(fz_stream *stm);
/*
fz_tell: return the current reading position within a stream
diff --git a/include/mupdf/fitz/structured-text.h b/include/mupdf/fitz/structured-text.h
index f325bf21..da67a864 100644
--- a/include/mupdf/fitz/structured-text.h
+++ b/include/mupdf/fitz/structured-text.h
@@ -202,7 +202,7 @@ fz_rect *fz_text_char_bbox(fz_rect *bbox, fz_text_span *span, int idx);
is used.
*/
fz_text_sheet *fz_new_text_sheet(fz_context *ctx);
-void fz_free_text_sheet(fz_context *ctx, fz_text_sheet *sheet);
+void fz_drop_text_sheet(fz_context *ctx, fz_text_sheet *sheet);
/*
fz_new_text_page: Create an empty text page.
@@ -211,7 +211,7 @@ void fz_free_text_sheet(fz_context *ctx, fz_text_sheet *sheet);
lines and spans of text on the page.
*/
fz_text_page *fz_new_text_page(fz_context *ctx);
-void fz_free_text_page(fz_context *ctx, fz_text_page *page);
+void fz_drop_text_page(fz_context *ctx, fz_text_page *page);
void fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page);
diff --git a/include/mupdf/fitz/tree.h b/include/mupdf/fitz/tree.h
index f2cc4848..0b299e27 100644
--- a/include/mupdf/fitz/tree.h
+++ b/include/mupdf/fitz/tree.h
@@ -17,7 +17,7 @@ void *fz_tree_lookup(fz_context *ctx, fz_tree *node, const char *key);
*/
fz_tree *fz_tree_insert(fz_context *ctx, fz_tree *root, const char *key, void *value);
-void fz_free_tree(fz_context *ctx, fz_tree *node, void (*freefunc)(fz_context *ctx, void *value));
+void fz_drop_tree(fz_context *ctx, fz_tree *node, void (*dropfunc)(fz_context *ctx, void *value));
void fz_debug_tree(fz_context *ctx, fz_tree *root);
diff --git a/include/mupdf/fitz/unzip.h b/include/mupdf/fitz/unzip.h
index dd9fb856..290cc16b 100644
--- a/include/mupdf/fitz/unzip.h
+++ b/include/mupdf/fitz/unzip.h
@@ -14,7 +14,7 @@ fz_archive *fz_open_archive_with_stream(fz_context *ctx, fz_stream *file);
int fz_has_archive_entry(fz_context *ctx, fz_archive *zip, const char *name);
fz_stream *fz_open_archive_entry(fz_context *ctx, fz_archive *zip, const char *entry);
fz_buffer *fz_read_archive_entry(fz_context *ctx, fz_archive *zip, const char *entry);
-void fz_close_archive(fz_context *ctx, fz_archive *ar);
+void fz_drop_archive(fz_context *ctx, fz_archive *ar);
void fz_rebind_archive(fz_archive *zip, fz_context *ctx);
diff --git a/include/mupdf/fitz/xml.h b/include/mupdf/fitz/xml.h
index 8006fa07..7e226f71 100644
--- a/include/mupdf/fitz/xml.h
+++ b/include/mupdf/fitz/xml.h
@@ -60,9 +60,9 @@ char *fz_xml_att(fz_xml *item, const char *att);
char *fz_xml_text(fz_xml *item);
/*
- fz_free_xml: Free the XML node and all its children and siblings.
+ fz_drop_xml: Free the XML node and all its children and siblings.
*/
-void fz_free_xml(fz_context *doc, fz_xml *item);
+void fz_drop_xml(fz_context *doc, fz_xml *item);
/*
fz_detach_xml: Detach a node from the tree, unlinking it from its parent.
diff --git a/include/mupdf/img.h b/include/mupdf/img.h
index 4c10b0d3..d7612cca 100644
--- a/include/mupdf/img.h
+++ b/include/mupdf/img.h
@@ -28,7 +28,7 @@ image_document *image_open_document(fz_context *ctx, const char *filename);
filename to locate the document to open. Increments the
reference count of the stream. See fz_open_file,
fz_open_file_w or fz_open_fd for opening a stream, and
- fz_close for closing an open stream.
+ fz_drop_stream for closing an open stream.
*/
image_document *image_open_document_with_stream(fz_context *ctx, fz_stream *file);
diff --git a/include/mupdf/pdf/annot.h b/include/mupdf/pdf/annot.h
index e3243186..6586eb3e 100644
--- a/include/mupdf/pdf/annot.h
+++ b/include/mupdf/pdf/annot.h
@@ -81,7 +81,7 @@ fz_link *pdf_load_link_annots(pdf_document *, pdf_obj *annots, const fz_matrix *
void pdf_transform_annot(pdf_annot *annot);
void pdf_load_annots(pdf_document *, pdf_page *page, pdf_obj *annots);
void pdf_update_annot(pdf_document *, pdf_annot *annot);
-void pdf_free_annot(fz_context *ctx, pdf_annot *link);
+void pdf_drop_annot(fz_context *ctx, pdf_annot *link);
/*
pdf_create_annot: create a new annotation of the specified type on the
diff --git a/include/mupdf/pdf/cmap.h b/include/mupdf/pdf/cmap.h
index b4080b8e..a8079b67 100644
--- a/include/mupdf/pdf/cmap.h
+++ b/include/mupdf/pdf/cmap.h
@@ -58,7 +58,7 @@ struct pdf_cmap_s
pdf_cmap *pdf_new_cmap(fz_context *ctx);
pdf_cmap *pdf_keep_cmap(fz_context *ctx, pdf_cmap *cmap);
void pdf_drop_cmap(fz_context *ctx, pdf_cmap *cmap);
-void pdf_free_cmap_imp(fz_context *ctx, fz_storable *cmap);
+void pdf_drop_cmap_imp(fz_context *ctx, fz_storable *cmap);
unsigned int pdf_cmap_size(fz_context *ctx, pdf_cmap *cmap);
int pdf_cmap_wmode(fz_context *ctx, pdf_cmap *cmap);
diff --git a/include/mupdf/pdf/crypt.h b/include/mupdf/pdf/crypt.h
index 9e3c4c94..c3d6dd8d 100644
--- a/include/mupdf/pdf/crypt.h
+++ b/include/mupdf/pdf/crypt.h
@@ -6,7 +6,7 @@
*/
pdf_crypt *pdf_new_crypt(fz_context *ctx, pdf_obj *enc, pdf_obj *id);
-void pdf_free_crypt(fz_context *ctx, pdf_crypt *crypt);
+void pdf_drop_crypt(fz_context *ctx, pdf_crypt *crypt);
void pdf_crypt_obj(fz_context *ctx, pdf_crypt *crypt, pdf_obj *obj, int num, int gen);
void pdf_crypt_buffer(fz_context *ctx, pdf_crypt *crypt, fz_buffer *buf, int num, int gen);
@@ -33,7 +33,7 @@ typedef struct pdf_designated_name_s
}
pdf_designated_name;
-void pdf_free_designated_name(pdf_designated_name *dn);
+void pdf_drop_designated_name(pdf_designated_name *dn);
pdf_signer *pdf_read_pfx(fz_context *ctx, const char *sigfile, const char *password);
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h
index f3d67d7e..ef060776 100644
--- a/include/mupdf/pdf/document.h
+++ b/include/mupdf/pdf/document.h
@@ -82,7 +82,7 @@ pdf_document *pdf_open_document(fz_context *ctx, const char *filename);
filename to locate the PDF document to open. Increments the
reference count of the stream. See fz_open_file,
fz_open_file_w or fz_open_fd for opening a stream, and
- fz_close for closing an open stream.
+ fz_drop_stream for closing an open stream.
*/
pdf_document *pdf_open_document_with_stream(fz_context *ctx, fz_stream *file);
diff --git a/include/mupdf/pdf/page.h b/include/mupdf/pdf/page.h
index c1b690b6..a265828b 100644
--- a/include/mupdf/pdf/page.h
+++ b/include/mupdf/pdf/page.h
@@ -32,11 +32,11 @@ fz_link *pdf_load_links(pdf_document *doc, pdf_page *page);
fz_rect *pdf_bound_page(pdf_document *doc, pdf_page *page, fz_rect *);
/*
- pdf_free_page: Frees a page and its resources.
+ pdf_drop_page: Frees a page and its resources.
Does not throw exceptions.
*/
-void pdf_free_page(pdf_document *doc, pdf_page *page);
+void pdf_drop_page(pdf_document *doc, pdf_page *page);
/*
pdf_run_page: Interpret a loaded page and render it on a device.
diff --git a/include/mupdf/pdf/resource.h b/include/mupdf/pdf/resource.h
index 0b090705..3828f5a1 100644
--- a/include/mupdf/pdf/resource.h
+++ b/include/mupdf/pdf/resource.h
@@ -5,8 +5,8 @@
* PDF interface to store
*/
void 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);
-void pdf_remove_item(fz_context *ctx, fz_store_free_fn *free, pdf_obj *key);
+void *pdf_find_item(fz_context *ctx, fz_store_drop_fn *drop, pdf_obj *key);
+void pdf_remove_item(fz_context *ctx, fz_store_drop_fn *drop, pdf_obj *key);
/*
* Functions, Colorspaces, Shadings and Images
diff --git a/include/mupdf/tiff.h b/include/mupdf/tiff.h
index 1304e4b2..99942a55 100644
--- a/include/mupdf/tiff.h
+++ b/include/mupdf/tiff.h
@@ -28,7 +28,7 @@ tiff_document *tiff_open_document(fz_context *ctx, const char *filename);
filename to locate the document to open. Increments the
reference count of the stream. See fz_open_file,
fz_open_file_w or fz_open_fd for opening a stream, and
- fz_close for closing an open stream.
+ fz_drop_stream for closing an open stream.
*/
tiff_document *tiff_open_document_with_stream(fz_context *ctx, fz_stream *file);
diff --git a/include/mupdf/xps.h b/include/mupdf/xps.h
index 48574931..76b1028b 100644
--- a/include/mupdf/xps.h
+++ b/include/mupdf/xps.h
@@ -28,7 +28,7 @@ xps_document *xps_open_document(fz_context *ctx, const char *filename);
filename to locate the document to open. Increments the
reference count of the stream. See fz_open_file,
fz_open_file_w or fz_open_fd for opening a stream, and
- fz_close for closing an open stream.
+ fz_drop_stream for closing an open stream.
*/
xps_document *xps_open_document_with_stream(fz_context *ctx, fz_stream *file);
@@ -47,7 +47,7 @@ xps_page *xps_load_page(xps_document *doc, int number);
fz_rect *xps_bound_page(xps_document *doc, xps_page *page, fz_rect *rect);
void xps_run_page(xps_document *doc, xps_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie);
fz_link *xps_load_links(xps_document *doc, xps_page *page);
-void xps_free_page(xps_document *doc, xps_page *page);
+void xps_drop_page(xps_document *doc, xps_page *page);
fz_outline *xps_load_outline(xps_document *doc);
@@ -77,7 +77,7 @@ struct xps_part_s
int xps_has_part(xps_document *doc, char *partname);
xps_part *xps_read_part(xps_document *doc, char *partname);
-void xps_free_part(xps_document *doc, xps_part *part);
+void xps_drop_part(xps_document *doc, xps_part *part);
/*
* Document structure.
@@ -114,7 +114,7 @@ struct xps_target_s
void xps_read_page_list(xps_document *doc);
void xps_print_page_list(xps_document *doc);
-void xps_free_page_list(xps_document *doc);
+void xps_drop_page_list(xps_document *doc);
int xps_lookup_link_target(xps_document *doc, char *target_uri);
void xps_add_link(xps_document *doc, const fz_rect *area, char *base_uri, char *target_uri);
@@ -168,7 +168,7 @@ struct xps_resource_s
};
xps_resource * xps_parse_resource_dictionary(xps_document *doc, char *base_uri, fz_xml *root);
-void xps_free_resource_dictionary(xps_document *doc, xps_resource *dict);
+void xps_drop_resource_dictionary(xps_document *doc, xps_resource *dict);
void xps_resolve_resource_reference(xps_document *doc, xps_resource *dict, char **attp, fz_xml **tagp, char **urip);
void xps_print_resource_dictionary(xps_resource *dict);
diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c
index 1b2b6e2f..1486e75a 100644
--- a/platform/android/jni/mupdf.c
+++ b/platform/android/jni/mupdf.c
@@ -332,7 +332,7 @@ JNI_FN(MuPDFCore_openFile)(JNIEnv * env, jobject thiz, jstring jfilename)
LOGE("Failed: %s", ctx->error->message);
fz_drop_document(glo->doc);
glo->doc = NULL;
- fz_free_context(ctx);
+ fz_drop_context(ctx);
glo->ctx = NULL;
free(glo);
glo = NULL;
@@ -479,14 +479,14 @@ JNI_FN(MuPDFCore_openBuffer)(JNIEnv * env, jobject thiz, jstring jmagic)
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
LOGE("Failed: %s", ctx->error->message);
fz_drop_document(glo->doc);
glo->doc = NULL;
- fz_free_context(ctx);
+ fz_drop_context(ctx);
glo->ctx = NULL;
free(glo);
glo = NULL;
@@ -730,7 +730,7 @@ JNI_FN(MuPDFCore_drawPage)(JNIEnv *env, jobject thiz, jobject bitmap,
pc->page_list = fz_new_display_list(ctx);
dev = fz_new_list_device(ctx, pc->page_list);
fz_run_page_contents(doc, pc->page, dev, &fz_identity, cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
if (cookie != NULL && cookie->abort)
{
@@ -746,7 +746,7 @@ JNI_FN(MuPDFCore_drawPage)(JNIEnv *env, jobject thiz, jobject bitmap,
dev = fz_new_list_device(ctx, pc->annot_list);
for (annot = fz_first_annot(doc, pc->page); annot; annot = fz_next_annot(doc, annot))
fz_run_annot(doc, pc->page, annot, dev, &fz_identity, cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
if (cookie != NULL && cookie->abort)
{
@@ -808,14 +808,14 @@ JNI_FN(MuPDFCore_drawPage)(JNIEnv *env, jobject thiz, jobject bitmap,
LOGI("100 renders in %d (%d per sec)", time, CLOCKS_PER_SEC);
}
#endif
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
fz_drop_pixmap(ctx, pix);
LOGI("Rendered");
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_catch(ctx)
@@ -928,7 +928,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
pc->page_list = fz_new_display_list(ctx);
dev = fz_new_list_device(ctx, pc->page_list);
fz_run_page_contents(doc, pc->page, dev, &fz_identity, cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
if (cookie != NULL && cookie->abort)
{
@@ -943,7 +943,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
dev = fz_new_list_device(ctx, pc->annot_list);
for (annot = fz_first_annot(doc, pc->page); annot; annot = fz_next_annot(doc, annot))
fz_run_annot(doc, pc->page, annot, dev, &fz_identity, cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
if (cookie != NULL && cookie->abort)
{
@@ -999,7 +999,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
if (cookie != NULL && cookie->abort)
fz_throw(ctx, FZ_ERROR_GENERIC, "Render aborted");
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
}
@@ -1012,7 +1012,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_catch(ctx)
@@ -1146,7 +1146,7 @@ JNI_FN(MuPDFCore_hasOutlineInternal)(JNIEnv * env, jobject thiz)
globals *glo = get_globals(env, thiz);
fz_outline *outline = fz_load_outline(glo->doc);
- fz_free_outline(glo->ctx, outline);
+ fz_drop_outline(glo->ctx, outline);
return (outline == NULL) ? JNI_FALSE : JNI_TRUE;
}
@@ -1179,7 +1179,7 @@ JNI_FN(MuPDFCore_getOutlineInternal)(JNIEnv * env, jobject thiz)
ret = fillInOutlineItems(env, olClass, ctor, arr, 0, outline, 0) > 0
? arr
:NULL;
- fz_free_outline(glo->ctx, outline);
+ fz_drop_outline(glo->ctx, outline);
return ret;
}
@@ -1227,16 +1227,16 @@ JNI_FN(MuPDFCore_searchPage)(JNIEnv * env, jobject thiz, jstring jtext)
text = fz_new_text_page(ctx);
dev = fz_new_text_device(ctx, sheet, text);
fz_run_page(doc, pc->page, dev, &ctm, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
hit_count = fz_search_text_page(ctx, text, str, glo->hit_bbox, MAX_SEARCH_HITS);
}
fz_always(ctx)
{
- fz_free_text_page(ctx, text);
- fz_free_text_sheet(ctx, sheet);
- fz_free_device(dev);
+ fz_drop_text_page(ctx, text);
+ fz_drop_text_sheet(ctx, sheet);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -1317,7 +1317,7 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
text = fz_new_text_page(ctx);
dev = fz_new_text_device(ctx, sheet, text);
fz_run_page(doc, pc->page, dev, &ctm, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
barr = (*env)->NewObjectArray(env, text->len, textBlockClass, NULL);
@@ -1378,9 +1378,9 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
}
fz_always(ctx)
{
- fz_free_text_page(ctx, text);
- fz_free_text_sheet(ctx, sheet);
- fz_free_device(dev);
+ fz_drop_text_page(ctx, text);
+ fz_drop_text_sheet(ctx, sheet);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -1425,7 +1425,7 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
text = fz_new_text_page(ctx);
dev = fz_new_text_device(ctx, sheet, text);
fz_run_page(doc, pc->page, dev, &ctm, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
fz_analyze_text(ctx, sheet, text);
@@ -1448,7 +1448,7 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
fz_printf(out, "<style>\n");
fz_print_text_sheet(ctx, out, sheet);
fz_printf(out, "</style>\n</html>\n");
- fz_close_output(out);
+ fz_drop_output(out);
out = NULL;
bArray = (*env)->NewByteArray(env, buf->len);
@@ -1459,10 +1459,10 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
}
fz_always(ctx)
{
- fz_free_text_page(ctx, text);
- fz_free_text_sheet(ctx, sheet);
- fz_free_device(dev);
- fz_close_output(out);
+ fz_drop_text_page(ctx, text);
+ fz_drop_text_sheet(ctx, sheet);
+ fz_drop_device(dev);
+ fz_drop_output(out);
fz_drop_buffer(ctx, buf);
}
fz_catch(ctx)
@@ -1733,7 +1733,7 @@ JNI_FN(MuPDFCore_destroying)(JNIEnv * env, jobject thiz)
fz_free(glo->ctx, glo->current_path);
glo->current_path = NULL;
close_doc(glo);
- fz_free_context(glo->ctx);
+ fz_drop_context(glo->ctx);
glo->ctx = NULL;
free(glo);
#ifdef MEMENTO
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m
index 3c0391a8..01d8221c 100644
--- a/platform/ios/Classes/MuDocumentController.m
+++ b/platform/ios/Classes/MuDocumentController.m
@@ -183,7 +183,7 @@ static void saveDoc(char *current_path, fz_document *doc)
outline = [[MuOutlineController alloc] initWithTarget: self titles: titles pages: pages];
[titles release];
[pages release];
- fz_free_outline(ctx, root);
+ fz_drop_outline(ctx, root);
}
return self;
diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m
index 3c461a00..5e115ea0 100644
--- a/platform/ios/Classes/MuPageViewNormal.m
+++ b/platform/ios/Classes/MuPageViewNormal.m
@@ -78,7 +78,7 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page)
text = fz_new_text_page(ctx);
dev = fz_new_text_device(ctx, sheet, text);
fz_run_page(doc, page, dev, &fz_identity, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
for (b = 0; b < text->len; b++)
@@ -138,9 +138,9 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page)
}
fz_always(ctx);
{
- fz_free_text_page(ctx, text);
- fz_free_text_sheet(ctx, sheet);
- fz_free_device(dev);
+ fz_drop_text_page(ctx, text);
+ fz_drop_text_sheet(ctx, sheet);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -383,7 +383,7 @@ static fz_display_list *create_page_list(fz_document *doc, fz_page *page)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -413,7 +413,7 @@ static fz_display_list *create_annot_list(fz_document *doc, fz_page *page)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -461,7 +461,7 @@ static fz_pixmap *renderPixmap(fz_document *doc, fz_display_list *page_list, fz_
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -563,7 +563,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
dev = fz_new_draw_device_with_bbox(ctx, pixmap, &abox);
fz_run_display_list(page_list, dev, &ctm, &arect, NULL);
fz_run_display_list(annot_list, dev, &ctm, &arect, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
rlist = rlist->next;
@@ -571,7 +571,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
diff --git a/platform/ios/Classes/MuPageViewReflow.m b/platform/ios/Classes/MuPageViewReflow.m
index bc0e2c79..a9716df5 100644
--- a/platform/ios/Classes/MuPageViewReflow.m
+++ b/platform/ios/Classes/MuPageViewReflow.m
@@ -27,7 +27,7 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
dev = fz_new_text_device(ctx, sheet, text);
page = fz_load_page(doc, pageNum);
fz_run_page(doc, page, dev, &ctm, NULL);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
fz_analyze_text(ctx, sheet, text);
@@ -57,9 +57,9 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
}
fz_always(ctx)
{
- fz_free_text_page(ctx, text);
- fz_free_text_sheet(ctx, sheet);
- fz_free_device(dev);
+ fz_drop_text_page(ctx, text);
+ fz_drop_text_sheet(ctx, sheet);
+ fz_drop_device(dev);
fz_close_output(out);
fz_drop_buffer(ctx, buf);
fz_free_page(doc, page);
diff --git a/platform/ios/Classes/MuPrintPageRenderer.m b/platform/ios/Classes/MuPrintPageRenderer.m
index 36f66ee9..9408a6e3 100644
--- a/platform/ios/Classes/MuPrintPageRenderer.m
+++ b/platform/ios/Classes/MuPrintPageRenderer.m
@@ -114,7 +114,7 @@ static void renderPage(fz_document *doc, fz_page *page, fz_pixmap *pix, fz_matri
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
diff --git a/platform/ios/common.m b/platform/ios/common.m
index f4a1676d..6ca320e9 100644
--- a/platform/ios/common.m
+++ b/platform/ios/common.m
@@ -25,12 +25,12 @@ int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie)
fz_text_page *text = fz_new_text_page(ctx);
fz_device *dev = fz_new_text_device(ctx, sheet, text);
fz_run_page(doc, page, dev, &fz_identity, cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
hit_count = fz_search_text_page(ctx, text, needle, hit_bbox, nelem(hit_bbox));
- fz_free_text_page(ctx, text);
- fz_free_text_sheet(ctx, sheet);
+ fz_drop_text_page(ctx, text);
+ fz_drop_text_sheet(ctx, sheet);
fz_free_page(doc, page);
return hit_count;
diff --git a/platform/x11/jstest_main.c b/platform/x11/jstest_main.c
index 2188855d..98fec194 100644
--- a/platform/x11/jstest_main.c
+++ b/platform/x11/jstest_main.c
@@ -426,7 +426,7 @@ main(int argc, char *argv[])
if (file_open)
pdfapp_close(&gapp);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 7ce52e9e..b950fec5 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -371,10 +371,10 @@ void pdfapp_close(pdfapp_t *app)
fz_drop_display_list(app->ctx, app->annotations_list);
app->annotations_list = NULL;
- fz_free_text_page(app->ctx, app->page_text);
+ fz_drop_text_page(app->ctx, app->page_text);
app->page_text = NULL;
- fz_free_text_sheet(app->ctx, app->page_sheet);
+ fz_drop_text_sheet(app->ctx, app->page_sheet);
app->page_sheet = NULL;
fz_drop_link(app->ctx, app->page_links);
@@ -395,7 +395,7 @@ void pdfapp_close(pdfapp_t *app)
fz_drop_pixmap(app->ctx, app->old_image);
app->old_image = NULL;
- fz_free_outline(app->ctx, app->outline);
+ fz_drop_outline(app->ctx, app->outline);
app->outline = NULL;
fz_free_page(app->doc, app->page);
@@ -405,7 +405,7 @@ void pdfapp_close(pdfapp_t *app)
app->doc = NULL;
#ifdef HAVE_CURL
- fz_close(app->stream);
+ fz_drop_stream(app->stream);
#endif
fz_flush_warnings(app->ctx);
@@ -552,8 +552,8 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
fz_drop_display_list(app->ctx, app->page_list);
fz_drop_display_list(app->ctx, app->annotations_list);
- fz_free_text_page(app->ctx, app->page_text);
- fz_free_text_sheet(app->ctx, app->page_sheet);
+ fz_drop_text_page(app->ctx, app->page_text);
+ fz_drop_text_sheet(app->ctx, app->page_sheet);
fz_drop_link(app->ctx, app->page_links);
fz_free_page(app->doc, app->page);
@@ -595,7 +595,7 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
fz_enable_device_hints(mdev, FZ_NO_CACHE);
cookie.incomplete_ok = 1;
fz_run_page_contents(app->doc, app->page, mdev, &fz_identity, &cookie);
- fz_free_device(mdev);
+ fz_drop_device(mdev);
mdev = NULL;
app->annotations_list = fz_new_display_list(app->ctx);
mdev = fz_new_list_device(app->ctx, app->annotations_list);
@@ -614,7 +614,7 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
}
fz_always(app->ctx)
{
- fz_free_device(mdev);
+ fz_drop_device(mdev);
}
fz_catch(app->ctx)
{
@@ -674,7 +674,7 @@ static void pdfapp_recreate_annotationslist(pdfapp_t *app)
}
fz_always(app->ctx)
{
- fz_free_device(mdev);
+ fz_drop_device(mdev);
}
fz_catch(app->ctx)
{
@@ -717,7 +717,7 @@ static void pdfapp_updatepage(pdfapp_t *app)
fz_clear_pixmap_rect_with_value(app->ctx, app->image, 255, &ibounds);
idev = fz_new_draw_device_with_bbox(app->ctx, app->image, &ibounds);
pdfapp_runpage(app, idev, &ctm, &bounds, NULL);
- fz_free_device(idev);
+ fz_drop_device(idev);
}
pdfapp_showpage(app, 0, 0, 1, 0, 0);
@@ -778,7 +778,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
{
tdev = fz_new_text_device(app->ctx, app->page_sheet, app->page_text);
pdfapp_runpage(app, tdev, &fz_identity, &fz_infinite_rect, &cookie);
- fz_free_device(tdev);
+ fz_drop_device(tdev);
}
}
@@ -819,7 +819,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
{
idev = fz_new_draw_device(app->ctx, app->image);
pdfapp_runpage(app, idev, &ctm, &bounds, &cookie);
- fz_free_device(idev);
+ fz_drop_device(idev);
}
if (app->invert)
fz_invert_pixmap(app->ctx, app->image);
diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c
index 50cc7285..3017be3b 100644
--- a/platform/x11/win_main.c
+++ b/platform/x11/win_main.c
@@ -1220,7 +1220,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow
}
do_close(&gapp);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c
index b2413777..cb067ecc 100644
--- a/platform/x11/x11_main.c
+++ b/platform/x11/x11_main.c
@@ -344,7 +344,7 @@ void cleanup(pdfapp_t *app)
XCloseDisplay(xdpy);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
}
static int winresolution()
diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c
index 3251c701..e85d2041 100644
--- a/scripts/cmapdump.c
+++ b/scripts/cmapdump.c
@@ -98,7 +98,7 @@ main(int argc, char **argv)
fi = fz_open_file(ctx, argv[i]);
cmap = pdf_load_cmap(ctx, fi);
- fz_close(fi);
+ fz_drop_stream(fi);
fprintf(fo, "\n/* %s */\n\n", cmap->cmap_name);
@@ -140,7 +140,7 @@ main(int argc, char **argv)
}
fprintf(fo, "static pdf_cmap cmap_%s = {\n", name);
- fprintf(fo, "\t{-1, pdf_free_cmap_imp}, ");
+ fprintf(fo, "\t{-1, pdf_drop_cmap_imp}, ");
fprintf(fo, "\"%s\", ", cmap->cmap_name);
fprintf(fo, "\"%s\", 0, ", cmap->usecmap_name);
fprintf(fo, "%u, ", cmap->wmode);
@@ -180,7 +180,7 @@ main(int argc, char **argv)
return 1;
}
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
@@ -214,7 +214,7 @@ void fz_new_aa_context(fz_context *ctx)
{
}
-void fz_free_aa_context(fz_context *ctx)
+void fz_drop_aa_context(fz_context *ctx)
{
}
diff --git a/source/cbz/mucbz.c b/source/cbz/mucbz.c
index 6951e798..72b6a185 100644
--- a/source/cbz/mucbz.c
+++ b/source/cbz/mucbz.c
@@ -145,7 +145,7 @@ cbz_open_document(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -158,7 +158,7 @@ cbz_open_document(fz_context *ctx, const char *filename)
void
cbz_close_document(cbz_document *doc)
{
- fz_close_archive(doc->ctx, doc->zip);
+ fz_drop_archive(doc->ctx, doc->zip);
fz_free(doc->ctx, (char **)doc->page);
fz_free(doc->ctx, doc);
}
diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c
index 8a298fe1..b8e63b56 100644
--- a/source/fitz/bbox-device.c
+++ b/source/fitz/bbox-device.c
@@ -180,7 +180,7 @@ fz_bbox_end_tile(fz_device *dev)
}
static void
-fz_bbox_free_user(fz_device *dev)
+fz_bbox_drop_user(fz_device *dev)
{
fz_bbox_data *data = dev->user;
if (data->top > 0)
@@ -198,7 +198,7 @@ fz_new_bbox_device(fz_context *ctx, fz_rect *result)
user->top = 0;
user->ignore = 0;
dev = fz_new_device(ctx, user);
- dev->free_user = fz_bbox_free_user;
+ dev->drop_user = fz_bbox_drop_user;
dev->fill_path = fz_bbox_fill_path;
dev->stroke_path = fz_bbox_stroke_path;
diff --git a/source/fitz/buffer.c b/source/fitz/buffer.c
index acfdc20a..12de453a 100644
--- a/source/fitz/buffer.c
+++ b/source/fitz/buffer.c
@@ -370,7 +370,7 @@ fz_test_buffer_write(fz_context *ctx)
fprintf(stderr, "Copied buffer is different!\n");
fz_seek(stm, 0, 0);
}
- fz_close(stm);
+ fz_drop_stream(stm);
fz_drop_buffer(ctx, master);
fz_drop_buffer(ctx, copy);
}
diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c
index 87b49413..f1dff20c 100644
--- a/source/fitz/colorspace.c
+++ b/source/fitz/colorspace.c
@@ -3,7 +3,7 @@
#define SLOWCMYK
void
-fz_free_colorspace_imp(fz_context *ctx, fz_storable *cs_)
+fz_drop_colorspace_imp(fz_context *ctx, fz_storable *cs_)
{
fz_colorspace *cs = (fz_colorspace *)cs_;
@@ -15,8 +15,8 @@ fz_free_colorspace_imp(fz_context *ctx, fz_storable *cs_)
fz_colorspace *
fz_new_colorspace(fz_context *ctx, char *name, int n)
{
- fz_colorspace *cs = Memento_label(fz_malloc(ctx, sizeof(fz_colorspace)), "fz_colorspace");
- FZ_INIT_STORABLE(cs, 1, fz_free_colorspace_imp);
+ fz_colorspace *cs = fz_malloc_struct(ctx, fz_colorspace);
+ FZ_INIT_STORABLE(cs, 1, fz_drop_colorspace_imp);
cs->size = sizeof(fz_colorspace);
fz_strlcpy(cs->name, name, sizeof cs->name);
cs->n = n;
@@ -169,10 +169,10 @@ static void rgb_to_cmyk(fz_context *ctx, fz_colorspace *cs, const float *rgb, fl
cmyk[3] = k;
}
-static fz_colorspace k_default_gray = { {-1, fz_free_colorspace_imp}, 0, "DeviceGray", 1, gray_to_rgb, rgb_to_gray };
-static fz_colorspace k_default_rgb = { {-1, fz_free_colorspace_imp}, 0, "DeviceRGB", 3, rgb_to_rgb, rgb_to_rgb };
-static fz_colorspace k_default_bgr = { {-1, fz_free_colorspace_imp}, 0, "DeviceBGR", 3, bgr_to_rgb, rgb_to_bgr };
-static fz_colorspace k_default_cmyk = { {-1, fz_free_colorspace_imp}, 0, "DeviceCMYK", 4, cmyk_to_rgb, rgb_to_cmyk };
+static fz_colorspace k_default_gray = { {-1, fz_drop_colorspace_imp}, 0, "DeviceGray", 1, gray_to_rgb, rgb_to_gray };
+static fz_colorspace k_default_rgb = { {-1, fz_drop_colorspace_imp}, 0, "DeviceRGB", 3, rgb_to_rgb, rgb_to_rgb };
+static fz_colorspace k_default_bgr = { {-1, fz_drop_colorspace_imp}, 0, "DeviceBGR", 3, bgr_to_rgb, rgb_to_bgr };
+static fz_colorspace k_default_cmyk = { {-1, fz_drop_colorspace_imp}, 0, "DeviceCMYK", 4, cmyk_to_rgb, rgb_to_cmyk };
static fz_colorspace *fz_default_gray = &k_default_gray;
static fz_colorspace *fz_default_rgb = &k_default_rgb;
@@ -948,7 +948,7 @@ fz_std_conv_pixmap(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src)
}
}
- fz_free_hash(ctx, lookup);
+ fz_drop_hash(ctx, lookup);
}
}
@@ -1337,7 +1337,7 @@ void fz_init_cached_color_converter(fz_context *ctx, fz_color_converter *cc, fz_
}
fz_catch(ctx)
{
- fz_free_hash(ctx, cached->hash);
+ fz_drop_hash(ctx, cached->hash);
fz_rethrow(ctx);
}
}
@@ -1363,6 +1363,6 @@ void fz_fin_cached_color_converter(fz_color_converter *cc_)
if (v)
fz_free(ctx, v);
}
- fz_free_hash(ctx, cc->hash);
+ fz_drop_hash(ctx, cc->hash);
fz_free(ctx, cc);
}
diff --git a/source/fitz/compressed-buffer.c b/source/fitz/compressed-buffer.c
index 1a863309..48f88eff 100644
--- a/source/fitz/compressed-buffer.c
+++ b/source/fitz/compressed-buffer.c
@@ -4,7 +4,7 @@
* pulled into cmapdump.c */
void
-fz_free_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf)
+fz_drop_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf)
{
if (!buf)
return;
diff --git a/source/fitz/context.c b/source/fitz/context.c
index 36ad879f..b3ca9b5b 100644
--- a/source/fitz/context.c
+++ b/source/fitz/context.c
@@ -43,7 +43,7 @@ fz_keep_id_context(fz_context *ctx)
}
void
-fz_free_context(fz_context *ctx)
+fz_drop_context(fz_context *ctx)
{
if (!ctx)
return;
@@ -52,7 +52,7 @@ fz_free_context(fz_context *ctx)
fz_drop_document_handler_context(ctx);
fz_drop_glyph_cache_context(ctx);
fz_drop_store_context(ctx);
- fz_free_aa_context(ctx);
+ fz_drop_aa_context(ctx);
fz_drop_colorspace_context(ctx);
fz_drop_font_context(ctx);
fz_drop_id_context(ctx);
@@ -117,7 +117,7 @@ new_context_phase1(fz_alloc_context *alloc, fz_locks_context *locks)
cleanup:
fprintf(stderr, "cannot create context (phase 1)\n");
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return NULL;
}
@@ -155,7 +155,7 @@ fz_new_context_imp(fz_alloc_context *alloc, fz_locks_context *locks, unsigned in
fz_catch(ctx)
{
fprintf(stderr, "cannot create context (phase 2)\n");
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return NULL;
}
return ctx;
diff --git a/source/fitz/device.c b/source/fitz/device.c
index a13cd470..cb57256e 100644
--- a/source/fitz/device.c
+++ b/source/fitz/device.c
@@ -13,12 +13,12 @@ fz_new_device(fz_context *ctx, void *user)
}
void
-fz_free_device(fz_device *dev)
+fz_drop_device(fz_device *dev)
{
if (dev == NULL)
return;
- if (dev->free_user)
- dev->free_user(dev);
+ if (dev->drop_user)
+ dev->drop_user(dev);
fz_free(dev->ctx, dev->container);
fz_free(dev->ctx, dev);
}
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index a8d745af..8701cd31 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -1753,7 +1753,7 @@ static fz_store_type fz_tile_store_type =
};
static void
-fz_free_tile_record_imp(fz_context *ctx, fz_storable *storable)
+fz_drop_tile_record_imp(fz_context *ctx, fz_storable *storable)
{
tile_record *tr = (tile_record *)(void *)storable;
@@ -1774,7 +1774,7 @@ static tile_record *
fz_new_tile_record(fz_context *ctx, fz_pixmap *dest, fz_pixmap *shape)
{
tile_record *tile = fz_malloc_struct(ctx, tile_record);
- FZ_INIT_STORABLE(tile, 1, fz_free_tile_record_imp);
+ FZ_INIT_STORABLE(tile, 1, fz_drop_tile_record_imp);
tile->dest = fz_keep_pixmap(ctx, dest);
tile->shape = fz_keep_pixmap(ctx, shape);
return tile;
@@ -1828,7 +1828,7 @@ fz_draw_begin_tile(fz_device *devp, const fz_rect *area, const fz_rect *view, fl
tk.ctm[3] = ctm->d;
tk.id = id;
- tile = fz_find_item(ctx, fz_free_tile_record_imp, &tk, &fz_tile_store_type);
+ tile = fz_find_item(ctx, fz_drop_tile_record_imp, &tk, &fz_tile_store_type);
if (tile)
{
state[1].dest = fz_keep_pixmap(ctx, tile->dest);
@@ -2038,7 +2038,7 @@ fz_draw_end_tile(fz_device *devp)
}
static void
-fz_draw_free_user(fz_device *devp)
+fz_draw_drop_user(fz_device *devp)
{
fz_draw_device *dev = devp->user;
fz_context *ctx = dev->ctx;
@@ -2062,9 +2062,9 @@ fz_draw_free_user(fz_device *devp)
*/
if (dev->stack != &dev->init_stack[0])
fz_free(ctx, dev->stack);
- fz_free_scale_cache(ctx, dev->cache_x);
- fz_free_scale_cache(ctx, dev->cache_y);
- fz_free_gel(dev->gel);
+ fz_drop_scale_cache(ctx, dev->cache_x);
+ fz_drop_scale_cache(ctx, dev->cache_y);
+ fz_drop_gel(dev->gel);
fz_free(ctx, dev);
}
@@ -2098,13 +2098,13 @@ fz_new_draw_device(fz_context *ctx, fz_pixmap *dest)
}
fz_catch(ctx)
{
- fz_free_scale_cache(ctx, ddev->cache_x);
- fz_free_scale_cache(ctx, ddev->cache_y);
- fz_free_gel(ddev->gel);
+ fz_drop_scale_cache(ctx, ddev->cache_x);
+ fz_drop_scale_cache(ctx, ddev->cache_y);
+ fz_drop_gel(ddev->gel);
fz_free(ctx, ddev);
fz_rethrow(ctx);
}
- dev->free_user = fz_draw_free_user;
+ dev->drop_user = fz_draw_drop_user;
dev->fill_path = fz_draw_fill_path;
dev->stroke_path = fz_draw_stroke_path;
@@ -2177,7 +2177,7 @@ fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor,
else
fz_flatten_fill_path(gel, path, ctm, flatness);
fz_bound_gel(gel, bbox);
- fz_free_gel(gel);
+ fz_drop_gel(gel);
return bbox;
}
diff --git a/source/fitz/draw-edge.c b/source/fitz/draw-edge.c
index c8d94155..e1fd5f37 100644
--- a/source/fitz/draw-edge.c
+++ b/source/fitz/draw-edge.c
@@ -48,7 +48,7 @@ void fz_copy_aa_context(fz_context *dst, fz_context *src)
memcpy(dst->aa, src->aa, sizeof(*src->aa));
}
-void fz_free_aa_context(fz_context *ctx)
+void fz_drop_aa_context(fz_context *ctx)
{
#ifndef AA_BITS
fz_free(ctx, ctx->aa);
@@ -228,7 +228,7 @@ fz_reset_gel(fz_gel *gel, const fz_irect *clip)
}
void
-fz_free_gel(fz_gel *gel)
+fz_drop_gel(fz_gel *gel)
{
if (gel == NULL)
return;
diff --git a/source/fitz/draw-imp.h b/source/fitz/draw-imp.h
index 9b9e50c0..b5f4690d 100644
--- a/source/fitz/draw-imp.h
+++ b/source/fitz/draw-imp.h
@@ -12,7 +12,7 @@ void fz_insert_gel(fz_gel *gel, float x0, float y0, float x1, float y1);
void fz_reset_gel(fz_gel *gel, const fz_irect *clip);
void fz_sort_gel(fz_gel *gel);
fz_irect *fz_bound_gel(const fz_gel *gel, fz_irect *bbox);
-void fz_free_gel(fz_gel *gel);
+void fz_drop_gel(fz_gel *gel);
int fz_is_rect_gel(fz_gel *gel);
fz_rect *fz_gel_scissor(const fz_gel *gel, fz_rect *rect);
diff --git a/source/fitz/draw-scale-simple.c b/source/fitz/draw-scale-simple.c
index 939464a1..5651e1f4 100644
--- a/source/fitz/draw-scale-simple.c
+++ b/source/fitz/draw-scale-simple.c
@@ -1498,7 +1498,7 @@ cleanup:
}
void
-fz_free_scale_cache(fz_context *ctx, fz_scale_cache *sc)
+fz_drop_scale_cache(fz_context *ctx, fz_scale_cache *sc)
{
if (!sc)
return;
diff --git a/source/fitz/filter-basic.c b/source/fitz/filter-basic.c
index 807364bc..1b4eaefb 100644
--- a/source/fitz/filter-basic.c
+++ b/source/fitz/filter-basic.c
@@ -50,7 +50,7 @@ close_null(fz_context *ctx, void *state_)
struct null_filter *state = (struct null_filter *)state_;
fz_stream *chain = state->chain;
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
}
static fz_stream *
@@ -77,7 +77,7 @@ fz_open_null(fz_stream *chain, int len, int offset)
}
fz_catch(ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
@@ -123,7 +123,7 @@ next_concat(fz_stream *stm, int max)
break;
}
state->current++;
- fz_close(state->chain[state->current-1]);
+ fz_drop_stream(state->chain[state->current-1]);
if (state->pad)
{
stm->rp = (&state->ws_buf)+1;
@@ -147,7 +147,7 @@ close_concat(fz_context *ctx, void *state_)
for (i = state->current; i < state->count; i++)
{
- fz_close(state->chain[i]);
+ fz_drop_stream(state->chain[i]);
}
fz_free(ctx, state);
}
@@ -293,7 +293,7 @@ close_ahxd(fz_context *ctx, void *state_)
fz_ahxd *state = (fz_ahxd *)state_;
fz_stream *chain = state->chain;
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
}
static fz_stream *
@@ -317,7 +317,7 @@ fz_open_ahxd(fz_stream *chain)
}
fz_catch(ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
@@ -445,7 +445,7 @@ close_a85d(fz_context *ctx, void *state_)
fz_stream *chain = state->chain;
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
}
static fz_stream *
@@ -469,7 +469,7 @@ fz_open_a85d(fz_stream *chain)
}
fz_catch(ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
@@ -564,7 +564,7 @@ close_rld(fz_context *ctx, void *state_)
fz_stream *chain = state->chain;
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
}
static fz_stream *
@@ -590,7 +590,7 @@ fz_open_rld(fz_stream *chain)
}
fz_catch(ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
@@ -635,7 +635,7 @@ close_arc4(fz_context *ctx, void *state_)
fz_stream *chain = state->chain;
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
}
static fz_stream *
@@ -659,7 +659,7 @@ fz_open_arc4(fz_stream *chain, unsigned char *key, unsigned keylen)
}
fz_catch(ctx)
{
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
@@ -745,7 +745,7 @@ close_aesd(fz_context *ctx, void *state_)
fz_stream *chain = state->chain;
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
}
static fz_stream *
@@ -776,7 +776,7 @@ fz_open_aesd(fz_stream *chain, unsigned char *key, unsigned keylen)
fz_catch(ctx)
{
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
diff --git a/source/fitz/filter-dct.c b/source/fitz/filter-dct.c
index 344dbdbf..9495b899 100644
--- a/source/fitz/filter-dct.c
+++ b/source/fitz/filter-dct.c
@@ -308,8 +308,8 @@ skip:
fz_dct_mem_term(state);
fz_free(ctx, state->scanline);
- fz_close(state->chain);
- fz_close(state->jpegtables);
+ fz_drop_stream(state->chain);
+ fz_drop_stream(state->jpegtables);
fz_free(ctx, state);
}
@@ -344,8 +344,8 @@ fz_open_dctd(fz_stream *chain, int color_transform, int l2factor, fz_stream *jpe
fz_catch(ctx)
{
fz_free(ctx, state);
- fz_close(chain);
- fz_close(jpegtables);
+ fz_drop_stream(chain);
+ fz_drop_stream(jpegtables);
fz_rethrow(ctx);
}
diff --git a/source/fitz/filter-fax.c b/source/fitz/filter-fax.c
index 70692338..134c2ae5 100644
--- a/source/fitz/filter-fax.c
+++ b/source/fitz/filter-fax.c
@@ -778,7 +778,7 @@ close_faxd(fz_context *ctx, void *state_)
while (i--)
fz_unread_byte(fax->chain);
- fz_close(fax->chain);
+ fz_drop_stream(fax->chain);
fz_free(ctx, fax->ref);
fz_free(ctx, fax->dst);
fz_free(ctx, fax);
@@ -848,7 +848,7 @@ fz_open_faxd(fz_stream *chain,
fz_free(ctx, fax->ref);
}
fz_free(ctx, fax);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
diff --git a/source/fitz/filter-flate.c b/source/fitz/filter-flate.c
index b66661cc..764e819a 100644
--- a/source/fitz/filter-flate.c
+++ b/source/fitz/filter-flate.c
@@ -93,7 +93,7 @@ close_flated(fz_context *ctx, void *state_)
if (code != Z_OK)
fz_warn(ctx, "zlib error: inflateEnd: %s", state->z.msg);
- fz_close(state->chain);
+ fz_drop_stream(state->chain);
fz_free(ctx, state);
}
@@ -134,7 +134,7 @@ fz_open_flated(fz_stream *chain, int window_bits)
if (state && code == Z_OK)
inflateEnd(&state->z);
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
return fz_new_stream(ctx, state, next_flated, close_flated, rebind_flated);
diff --git a/source/fitz/filter-jbig2.c b/source/fitz/filter-jbig2.c
index 98919dcb..0e624da6 100644
--- a/source/fitz/filter-jbig2.c
+++ b/source/fitz/filter-jbig2.c
@@ -35,7 +35,7 @@ close_jbig2d(fz_context *ctx, void *state_)
if (state->gctx)
fz_drop_jbig2_globals(ctx, state->gctx);
jbig2_ctx_free(state->ctx);
- fz_close(state->chain);
+ fz_drop_stream(state->chain);
fz_free(ctx, state);
}
@@ -112,14 +112,14 @@ fz_load_jbig2_globals(fz_context *ctx, unsigned char *data, int size)
Jbig2Ctx *jctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED, NULL, error_callback, ctx);
jbig2_data_in(jctx, data, size);
- FZ_INIT_STORABLE(globals, 1, fz_free_jbig2_globals_imp);
+ FZ_INIT_STORABLE(globals, 1, fz_drop_jbig2_globals_imp);
globals->gctx = jbig2_make_global_ctx(jctx);
return globals;
}
void
-fz_free_jbig2_globals_imp(fz_context *ctx, fz_storable *globals_)
+fz_drop_jbig2_globals_imp(fz_context *ctx, fz_storable *globals_)
{
fz_jbig2_globals *globals = (fz_jbig2_globals *)globals_;
jbig2_global_ctx_free(globals->gctx);
@@ -153,7 +153,7 @@ fz_open_jbig2d(fz_stream *chain, fz_jbig2_globals *globals)
jbig2_ctx_free(state->ctx);
}
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
diff --git a/source/fitz/filter-leech.c b/source/fitz/filter-leech.c
index 321e31d7..67a43a29 100644
--- a/source/fitz/filter-leech.c
+++ b/source/fitz/filter-leech.c
@@ -40,7 +40,7 @@ close_leech(fz_context *ctx, void *state_)
{
fz_leech *state = (fz_leech *)state_;
- fz_close(state->chain);
+ fz_drop_stream(state->chain);
fz_free(ctx, state);
}
@@ -68,7 +68,7 @@ fz_open_leecher(fz_stream *chain, fz_buffer *buffer)
fz_catch(ctx)
{
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
return fz_new_stream(ctx, state, next_leech, close_leech, rebind_leech);
diff --git a/source/fitz/filter-lzw.c b/source/fitz/filter-lzw.c
index 16b5253a..4f8fdd31 100644
--- a/source/fitz/filter-lzw.c
+++ b/source/fitz/filter-lzw.c
@@ -189,7 +189,7 @@ close_lzwd(fz_context *ctx, void *state_)
{
fz_lzwd *lzw = (fz_lzwd *)state_;
fz_sync_bits(lzw->chain);
- fz_close(lzw->chain);
+ fz_drop_stream(lzw->chain);
fz_free(ctx, lzw);
}
@@ -243,7 +243,7 @@ fz_open_lzwd(fz_stream *chain, int early_change)
fz_catch(ctx)
{
fz_free(ctx, lzw);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
diff --git a/source/fitz/filter-predict.c b/source/fitz/filter-predict.c
index 3aaa6ee9..a5c93bfd 100644
--- a/source/fitz/filter-predict.c
+++ b/source/fitz/filter-predict.c
@@ -209,7 +209,7 @@ static void
close_predict(fz_context *ctx, void *state_)
{
fz_predict *state = (fz_predict *)state_;
- fz_close(state->chain);
+ fz_drop_stream(state->chain);
fz_free(ctx, state->in);
fz_free(ctx, state->out);
fz_free(ctx, state->ref);
@@ -288,7 +288,7 @@ fz_open_predict(fz_stream *chain, int predictor, int columns, int colors, int bp
fz_free(ctx, state->out);
}
fz_free(ctx, state);
- fz_close(chain);
+ fz_drop_stream(chain);
fz_rethrow(ctx);
}
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 598931e8..08379b0f 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -1065,7 +1065,7 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nested_depth)
FZ_DEVFLAG_LINEWIDTH_UNDEFINED;
font->t3run(font->t3doc, font->t3resources, contents, dev, &fz_identity, NULL, 0);
font->t3flags[gid] = dev->flags;
- fz_free_device(dev);
+ fz_drop_device(dev);
}
static fz_rect *
@@ -1091,7 +1091,7 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm,
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
@@ -1168,7 +1168,7 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
}
fz_catch(ctx)
{
diff --git a/source/fitz/glyph.c b/source/fitz/glyph.c
index 0bf4c7fd..8e514751 100644
--- a/source/fitz/glyph.c
+++ b/source/fitz/glyph.c
@@ -15,7 +15,7 @@ fz_drop_glyph(fz_context *ctx, fz_glyph *glyph)
}
static void
-fz_free_glyph_imp(fz_context *ctx, fz_storable *glyph_)
+fz_drop_glyph_imp(fz_context *ctx, fz_storable *glyph_)
{
fz_glyph *glyph = (fz_glyph *)glyph_;
@@ -136,7 +136,7 @@ fz_new_glyph_from_pixmap(fz_context *ctx, fz_pixmap *pix)
if (pix->n != 1 || pix->w * pix->h < RLE_THRESHOLD)
{
glyph = fz_malloc_struct(ctx, fz_glyph);
- FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp);
+ FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp);
glyph->x = pix->x;
glyph->y = pix->y;
glyph->w = pix->w;
@@ -181,7 +181,7 @@ fz_new_glyph_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne
size = h * w;
fill = h * sizeof(int);
glyph = fz_malloc(ctx, sizeof(fz_glyph) + size);
- FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp);
+ FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp);
glyph->x = x;
glyph->y = y;
glyph->w = w;
@@ -288,7 +288,7 @@ fz_new_glyph_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne
* critical. */
try_pixmap:
glyph = fz_resize_array(ctx, glyph, 1, sizeof(fz_glyph));
- FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp);
+ FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp);
pix = fz_new_pixmap_from_8bpp_data(ctx, x, y, w, h, orig_sp, span);
glyph->x = pix->x;
glyph->y = pix->y;
@@ -329,7 +329,7 @@ fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne
size = h * w;
fill = h * sizeof(int);
glyph = fz_malloc(ctx, sizeof(fz_glyph) + size);
- FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp);
+ FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp);
glyph->x = x;
glyph->y = y;
glyph->w = w;
@@ -420,7 +420,7 @@ fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne
* critical. */
try_pixmap:
glyph = fz_resize_array(ctx, glyph, 1, sizeof(fz_glyph));
- FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp);
+ FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp);
pix = fz_new_pixmap_from_1bpp_data(ctx, x, y, w, h, orig_sp, span);
glyph->x = pix->x;
glyph->y = pix->y;
diff --git a/source/fitz/hash.c b/source/fitz/hash.c
index 708d72f2..acd22334 100644
--- a/source/fitz/hash.c
+++ b/source/fitz/hash.c
@@ -94,7 +94,7 @@ fz_hash_get_val(fz_context *ctx, fz_hash_table *table, int idx)
}
void
-fz_free_hash(fz_context *ctx, fz_hash_table *table)
+fz_drop_hash(fz_context *ctx, fz_hash_table *table)
{
fz_free(ctx, table->ents);
fz_free(ctx, table);
diff --git a/source/fitz/image.c b/source/fitz/image.c
index 09d39043..e7096ab4 100644
--- a/source/fitz/image.c
+++ b/source/fitz/image.c
@@ -216,7 +216,7 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, in
}
fz_always(ctx)
{
- fz_close(stm);
+ fz_drop_stream(stm);
}
fz_catch(ctx)
{
@@ -239,14 +239,14 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, in
}
void
-fz_free_image(fz_context *ctx, fz_storable *image_)
+fz_drop_image_imp(fz_context *ctx, fz_storable *image_)
{
fz_image *image = (fz_image *)image_;
if (image == NULL)
return;
fz_drop_pixmap(ctx, image->tile);
- fz_free_compressed_buffer(ctx, image->buffer);
+ fz_drop_compressed_buffer(ctx, image->buffer);
fz_drop_colorspace(ctx, image->colorspace);
fz_drop_image(ctx, image->mask);
fz_free(ctx, image);
@@ -293,7 +293,7 @@ fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h)
key.l2factor = l2factor;
do
{
- tile = fz_find_item(ctx, fz_free_pixmap_imp, &key, &fz_image_store_type);
+ tile = fz_find_item(ctx, fz_drop_pixmap_imp, &key, &fz_image_store_type);
if (tile)
return tile;
key.l2factor--;
@@ -393,7 +393,7 @@ fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask)
fz_try(ctx)
{
image = fz_malloc_struct(ctx, fz_image);
- FZ_INIT_STORABLE(image, 1, fz_free_image);
+ FZ_INIT_STORABLE(image, 1, fz_drop_image_imp);
image->w = pixmap->w;
image->h = pixmap->h;
image->n = pixmap->n;
@@ -427,7 +427,7 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace,
fz_try(ctx)
{
image = fz_malloc_struct(ctx, fz_image);
- FZ_INIT_STORABLE(image, 1, fz_free_image);
+ FZ_INIT_STORABLE(image, 1, fz_drop_image_imp);
image->get_pixmap = fz_image_get_pixmap;
image->w = w;
image->h = h;
@@ -458,7 +458,7 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace,
}
fz_catch(ctx)
{
- fz_free_compressed_buffer(ctx, buffer);
+ fz_drop_compressed_buffer(ctx, buffer);
fz_rethrow(ctx);
}
@@ -538,7 +538,7 @@ fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer)
}
fz_catch(ctx)
{
- fz_free_compressed_buffer(ctx, bc);
+ fz_drop_compressed_buffer(ctx, bc);
fz_rethrow(ctx);
}
diff --git a/source/fitz/link.c b/source/fitz/link.c
index 30dca222..152d48ea 100644
--- a/source/fitz/link.c
+++ b/source/fitz/link.c
@@ -1,7 +1,7 @@
#include "mupdf/fitz.h"
void
-fz_free_link_dest(fz_context *ctx, fz_link_dest *dest)
+fz_drop_link_dest(fz_context *ctx, fz_link_dest *dest)
{
switch (dest->kind)
{
@@ -35,7 +35,7 @@ fz_new_link(fz_context *ctx, const fz_rect *bbox, fz_link_dest dest)
}
fz_catch(ctx)
{
- fz_free_link_dest(ctx, &dest);
+ fz_drop_link_dest(ctx, &dest);
fz_rethrow(ctx);
}
link->dest = dest;
@@ -58,7 +58,7 @@ fz_drop_link(fz_context *ctx, fz_link *link)
while (link && --link->refs == 0)
{
fz_link *next = link->next;
- fz_free_link_dest(ctx, &link->dest);
+ fz_drop_link_dest(ctx, &link->dest);
fz_free(ctx, link);
link = next;
}
diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c
index 42590bab..c6e8011f 100644
--- a/source/fitz/list-device.c
+++ b/source/fitz/list-device.c
@@ -592,7 +592,7 @@ fz_new_list_device(fz_context *ctx, fz_display_list *list)
}
static void
-fz_free_display_list(fz_context *ctx, fz_storable *list_)
+fz_drop_display_list_imp(fz_context *ctx, fz_storable *list_)
{
fz_display_list *list = (fz_display_list *)list_;
fz_display_node *node;
@@ -613,7 +613,7 @@ fz_display_list *
fz_new_display_list(fz_context *ctx)
{
fz_display_list *list = fz_malloc_struct(ctx, fz_display_list);
- FZ_INIT_STORABLE(list, 1, fz_free_display_list);
+ FZ_INIT_STORABLE(list, 1, fz_drop_display_list_imp);
list->first = NULL;
list->last = NULL;
list->len = 0;
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 671e5146..77fb816d 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -145,7 +145,7 @@ static void
fz_decode_tiff_uncompressed(struct tiff *tiff, fz_stream *stm, unsigned char *wp, int wlen)
{
fz_read(stm, wp, wlen);
- fz_close(stm);
+ fz_drop_stream(stm);
}
static void
@@ -153,7 +153,7 @@ fz_decode_tiff_packbits(struct tiff *tiff, fz_stream *chain, unsigned char *wp,
{
fz_stream *stm = fz_open_rld(chain);
fz_read(stm, wp, wlen);
- fz_close(stm);
+ fz_drop_stream(stm);
}
static void
@@ -161,7 +161,7 @@ fz_decode_tiff_lzw(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int w
{
fz_stream *stm = fz_open_lzwd(chain, 1);
fz_read(stm, wp, wlen);
- fz_close(stm);
+ fz_drop_stream(stm);
}
static void
@@ -169,7 +169,7 @@ fz_decode_tiff_flate(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int
{
fz_stream *stm = fz_open_flated(chain, 15);
fz_read(stm, wp, wlen);
- fz_close(stm);
+ fz_drop_stream(stm);
}
static void
@@ -183,7 +183,7 @@ fz_decode_tiff_fax(struct tiff *tiff, int comp, fz_stream *chain, unsigned char
k, 0, encoded_byte_align,
tiff->imagewidth, tiff->imagelength, 0, black_is_1);
fz_read(stm, wp, wlen);
- fz_close(stm);
+ fz_drop_stream(stm);
}
static void
@@ -198,7 +198,7 @@ fz_decode_tiff_jpeg(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int
color_transform = 0;
stm = fz_open_dctd(chain, color_transform, 0, jpegtables);
fz_read(stm, wp, wlen);
- fz_close(stm);
+ fz_drop_stream(stm);
}
static inline int getcomp(unsigned char *line, int x, int bpc)
diff --git a/source/fitz/outline.c b/source/fitz/outline.c
index e26fd378..7a019883 100644
--- a/source/fitz/outline.c
+++ b/source/fitz/outline.c
@@ -1,14 +1,14 @@
#include "mupdf/fitz.h"
void
-fz_free_outline(fz_context *ctx, fz_outline *outline)
+fz_drop_outline(fz_context *ctx, fz_outline *outline)
{
while (outline)
{
fz_outline *next = outline->next;
- fz_free_outline(ctx, outline->down);
+ fz_drop_outline(ctx, outline->down);
fz_free(ctx, outline->title);
- fz_free_link_dest(ctx, &outline->dest);
+ fz_drop_link_dest(ctx, &outline->dest);
fz_free(ctx, outline);
outline = next;
}
diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c
index 0eeab8d3..90695eb7 100644
--- a/source/fitz/output-pcl.c
+++ b/source/fitz/output-pcl.c
@@ -816,7 +816,7 @@ fz_write_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_
}
fz_always(ctx)
{
- fz_close_output(out);
+ fz_drop_output(out);
fclose(fp);
}
fz_catch(ctx)
@@ -846,7 +846,7 @@ fz_write_pcl_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int appe
}
fz_always(ctx)
{
- fz_close_output(out);
+ fz_drop_output(out);
fclose(fp);
}
fz_catch(ctx)
diff --git a/source/fitz/output-pwg.c b/source/fitz/output-pwg.c
index c6d1a0b5..a2107db6 100644
--- a/source/fitz/output-pwg.c
+++ b/source/fitz/output-pwg.c
@@ -283,7 +283,7 @@ fz_write_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, con
}
fz_always(ctx)
{
- fz_close_output(out);
+ fz_drop_output(out);
fclose(fp);
}
fz_catch(ctx)
@@ -315,7 +315,7 @@ fz_write_pwg_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int appe
}
fz_always(ctx)
{
- fz_close_output(out);
+ fz_drop_output(out);
fclose(fp);
}
fz_catch(ctx)
diff --git a/source/fitz/output.c b/source/fitz/output.c
index fe63de92..8f5a4a0f 100644
--- a/source/fitz/output.c
+++ b/source/fitz/output.c
@@ -71,7 +71,7 @@ fz_new_output_to_filename(fz_context *ctx, const char *filename)
}
void
-fz_close_output(fz_output *out)
+fz_drop_output(fz_output *out)
{
if (!out)
return;
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index 9ce8ffba..d6a74ea1 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -13,7 +13,7 @@ fz_drop_pixmap(fz_context *ctx, fz_pixmap *pix)
}
void
-fz_free_pixmap_imp(fz_context *ctx, fz_storable *pix_)
+fz_drop_pixmap_imp(fz_context *ctx, fz_storable *pix_)
{
fz_pixmap *pix = (fz_pixmap *)pix_;
@@ -33,7 +33,7 @@ fz_new_pixmap_with_data(fz_context *ctx, fz_colorspace *colorspace, int w, int h
fz_throw(ctx, FZ_ERROR_GENERIC, "Illegal dimensions for pixmap %d %d", w, h);
pix = fz_malloc_struct(ctx, fz_pixmap);
- FZ_INIT_STORABLE(pix, 1, fz_free_pixmap_imp);
+ FZ_INIT_STORABLE(pix, 1, fz_drop_pixmap_imp);
pix->x = 0;
pix->y = 0;
pix->w = w;
@@ -583,7 +583,7 @@ fz_write_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename)
fz_output *out = fz_new_output_to_filename(ctx, filename);
fz_output_pnm_header(out, pixmap->w, pixmap->h, pixmap->n);
fz_output_pnm_band(out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples);
- fz_close_output(out);
+ fz_drop_output(out);
}
/*
@@ -645,7 +645,7 @@ fz_write_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
fz_output *out = fz_new_output_to_filename(ctx, filename);
fz_output_pam_header(out, pixmap->w, pixmap->h, pixmap->n, savealpha);
fz_output_pam_band(out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples, savealpha);
- fz_close_output(out);
+ fz_drop_output(out);
}
/*
@@ -690,7 +690,7 @@ fz_write_png(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
fz_always(ctx)
{
fz_output_png_trailer(out, poc);
- fz_close_output(out);
+ fz_drop_output(out);
}
fz_catch(ctx)
{
@@ -929,7 +929,7 @@ png_from_pixmap(fz_context *ctx, fz_pixmap *pix, int drop)
fz_always(ctx)
{
fz_drop_pixmap(ctx, drop ? pix : pix2);
- fz_close_output(out);
+ fz_drop_output(out);
}
fz_catch(ctx)
{
@@ -1029,7 +1029,7 @@ fz_write_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savea
}
fz_write(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.\0", 26);
- fz_close_output(out);
+ fz_drop_output(out);
}
unsigned int
diff --git a/source/fitz/shade.c b/source/fitz/shade.c
index 4c6b1472..01ada9a4 100644
--- a/source/fitz/shade.c
+++ b/source/fitz/shade.c
@@ -362,7 +362,7 @@ fz_process_mesh_type4(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
@@ -422,7 +422,7 @@ fz_process_mesh_type5(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz
{
fz_free(ctx, ref);
fz_free(ctx, buf);
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
@@ -790,7 +790,7 @@ fz_process_mesh_type6(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
@@ -903,7 +903,7 @@ fz_process_mesh_type7(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz
}
fz_always(ctx)
{
- fz_close(stream);
+ fz_drop_stream(stream);
}
fz_catch(ctx)
{
@@ -1043,7 +1043,7 @@ fz_keep_shade(fz_context *ctx, fz_shade *shade)
}
void
-fz_free_shade_imp(fz_context *ctx, fz_storable *shade_)
+fz_drop_shade_imp(fz_context *ctx, fz_storable *shade_)
{
fz_shade *shade = (fz_shade *)shade_;
@@ -1051,7 +1051,7 @@ fz_free_shade_imp(fz_context *ctx, fz_storable *shade_)
fz_drop_colorspace(ctx, shade->colorspace);
if (shade->type == FZ_FUNCTION_BASED)
fz_free(ctx, shade->u.f.fn_vals);
- fz_free_compressed_buffer(ctx, shade->buffer);
+ fz_drop_compressed_buffer(ctx, shade->buffer);
fz_free(ctx, shade);
}
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index 20e5e525..f963eb19 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -368,7 +368,7 @@ fz_new_text_sheet(fz_context *ctx)
}
void
-fz_free_text_sheet(fz_context *ctx, fz_text_sheet *sheet)
+fz_drop_text_sheet(fz_context *ctx, fz_text_sheet *sheet)
{
fz_text_style *style;
@@ -447,7 +447,7 @@ fz_new_text_page(fz_context *ctx)
}
static void
-fz_free_text_line_contents(fz_context *ctx, fz_text_line *line)
+fz_drop_text_line_contents(fz_context *ctx, fz_text_line *line)
{
fz_text_span *span, *next;
for (span = line->first_span; span; span=next)
@@ -459,19 +459,19 @@ fz_free_text_line_contents(fz_context *ctx, fz_text_line *line)
}
static void
-fz_free_text_block(fz_context *ctx, fz_text_block *block)
+fz_drop_text_block(fz_context *ctx, fz_text_block *block)
{
fz_text_line *line;
if (block == NULL)
return;
for (line = block->lines; line < block->lines + block->len; line++)
- fz_free_text_line_contents(ctx, line);
+ fz_drop_text_line_contents(ctx, line);
fz_free(ctx, block->lines);
fz_free(ctx, block);
}
static void
-fz_free_image_block(fz_context *ctx, fz_image_block *block)
+fz_drop_image_block(fz_context *ctx, fz_image_block *block)
{
if (block == NULL)
return;
@@ -481,7 +481,7 @@ fz_free_image_block(fz_context *ctx, fz_image_block *block)
}
void
-fz_free_text_page(fz_context *ctx, fz_text_page *page)
+fz_drop_text_page(fz_context *ctx, fz_text_page *page)
{
fz_page_block *block;
if (page == NULL)
@@ -491,10 +491,10 @@ fz_free_text_page(fz_context *ctx, fz_text_page *page)
switch (block->type)
{
case FZ_PAGE_BLOCK_TEXT:
- fz_free_text_block(ctx, block->u.text);
+ fz_drop_text_block(ctx, block->u.text);
break;
case FZ_PAGE_BLOCK_IMAGE:
- fz_free_image_block(ctx, block->u.image);
+ fz_drop_image_block(ctx, block->u.image);
break;
}
}
@@ -994,7 +994,7 @@ fz_text_end_page(fz_device *dev)
}
static void
-fz_text_free_user(fz_device *dev)
+fz_text_drop_user(fz_device *dev)
{
fz_text_device *tdev = dev->user;
free_span_soup(tdev->spans);
@@ -1017,7 +1017,7 @@ fz_new_text_device(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
dev->hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;
dev->begin_page = fz_text_begin_page;
dev->end_page = fz_text_end_page;
- dev->free_user = fz_text_free_user;
+ dev->drop_user = fz_text_drop_user;
dev->fill_text = fz_text_fill_text;
dev->stroke_text = fz_text_stroke_text;
dev->clip_text = fz_text_clip_text;
diff --git a/source/fitz/store.c b/source/fitz/store.c
index cf0e3536..315f8e81 100644
--- a/source/fitz/store.c
+++ b/source/fitz/store.c
@@ -88,7 +88,7 @@ fz_drop_storable(fz_context *ctx, fz_storable *s)
}
fz_unlock(ctx, FZ_LOCK_ALLOC);
if (do_free)
- s->free(ctx, s);
+ s->drop(ctx, s);
}
static void
@@ -113,14 +113,14 @@ evict(fz_context *ctx, fz_item *item)
if (item->type->make_hash_key)
{
fz_store_hash hash = { NULL };
- hash.free = item->val->free;
+ hash.drop = item->val->drop;
if (item->type->make_hash_key(&hash, item->key))
fz_hash_remove(ctx, store->hash, &hash);
}
fz_unlock(ctx, FZ_LOCK_ALLOC);
if (drop)
- item->val->free(ctx, item->val);
- /* Always drops the key and free the item */
+ item->val->drop(ctx, item->val);
+ /* Always drops the key and drop the item */
item->type->drop_key(ctx, item->key);
fz_free(ctx, item);
fz_lock(ctx, FZ_LOCK_ALLOC);
@@ -250,7 +250,7 @@ fz_store_item(fz_context *ctx, void *key, void *val_, unsigned int itemsize, fz_
if (type->make_hash_key)
{
- hash.free = val->free;
+ hash.drop = val->drop;
use_hash = type->make_hash_key(&hash, key);
}
@@ -347,7 +347,7 @@ fz_store_item(fz_context *ctx, void *key, void *val_, unsigned int itemsize, fz_
}
void *
-fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *type)
+fz_find_item(fz_context *ctx, fz_store_drop_fn *drop, void *key, fz_store_type *type)
{
fz_item *item;
fz_store *store = ctx->store;
@@ -362,7 +362,7 @@ fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *
if (type->make_hash_key)
{
- hash.free = free;
+ hash.drop = drop;
use_hash = type->make_hash_key(&hash, key);
}
@@ -377,7 +377,7 @@ fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *
/* Others we have to hunt for slowly */
for (item = store->head; item; item = item->next)
{
- if (item->val->free == free && !type->cmp_key(item->key, key))
+ if (item->val->drop == drop && !type->cmp_key(item->key, key))
break;
}
}
@@ -400,17 +400,17 @@ fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *
}
void
-fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *type)
+fz_remove_item(fz_context *ctx, fz_store_drop_fn *drop, void *key, fz_store_type *type)
{
fz_item *item;
fz_store *store = ctx->store;
- int drop;
+ int dodrop;
fz_store_hash hash = { NULL };
int use_hash = 0;
if (type->make_hash_key)
{
- hash.free = free;
+ hash.drop = drop;
use_hash = type->make_hash_key(&hash, key);
}
@@ -426,7 +426,7 @@ fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type
{
/* Others we have to hunt for slowly */
for (item = store->head; item; item = item->next)
- if (item->val->free == free && !type->cmp_key(item->key, key))
+ if (item->val->drop == drop && !type->cmp_key(item->key, key))
break;
}
if (item)
@@ -445,10 +445,10 @@ fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type
else
store->head = item->next;
}
- drop = (item->val->refs > 0 && --item->val->refs == 0);
+ dodrop = (item->val->refs > 0 && --item->val->refs == 0);
fz_unlock(ctx, FZ_LOCK_ALLOC);
- if (drop)
- item->val->free(ctx, item->val);
+ if (dodrop)
+ item->val->drop(ctx, item->val);
type->drop_key(ctx, item->key);
fz_free(ctx, item);
}
@@ -497,7 +497,7 @@ fz_drop_store_context(fz_context *ctx)
return;
fz_empty_store(ctx);
- fz_free_hash(ctx, ctx->store->hash);
+ fz_drop_hash(ctx, ctx->store->hash);
fz_free(ctx, ctx->store);
ctx->store = NULL;
}
diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c
index 3e51e733..c5808a73 100644
--- a/source/fitz/stream-open.c
+++ b/source/fitz/stream-open.c
@@ -58,7 +58,7 @@ fz_keep_stream(fz_stream *stm)
}
void
-fz_close(fz_stream *stm)
+fz_drop_stream(fz_stream *stm)
{
if (!stm)
return;
diff --git a/source/fitz/stream-read.c b/source/fitz/stream-read.c
index 3144974e..49e1c1a3 100644
--- a/source/fitz/stream-read.c
+++ b/source/fitz/stream-read.c
@@ -177,7 +177,7 @@ fz_read_file(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(stm);
+ fz_drop_stream(stm);
}
fz_catch(ctx)
{
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c
index f90557b5..b4e10fe4 100644
--- a/source/fitz/svg-device.c
+++ b/source/fitz/svg-device.c
@@ -1027,7 +1027,7 @@ svg_dev_end_tile(fz_device *dev)
}
static void
-svg_dev_free_user(fz_device *dev)
+svg_dev_drop_user(fz_device *dev)
{
svg_device *sdev = dev->user;
fz_context *ctx = sdev->ctx;
@@ -1035,7 +1035,7 @@ svg_dev_free_user(fz_device *dev)
fz_free(ctx, sdev->tiles);
fz_drop_buffer(ctx, sdev->defs_buffer);
- fz_close_output(sdev->defs);
+ fz_drop_output(sdev->defs);
fz_printf(out, "</svg>\n");
@@ -1072,7 +1072,7 @@ fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width,
}
dev->rebind = svg_rebind;
- dev->free_user = svg_dev_free_user;
+ dev->drop_user = svg_dev_drop_user;
dev->fill_path = svg_dev_fill_path;
dev->stroke_path = svg_dev_stroke_path;
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index 9c778ce1..919bda98 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -152,7 +152,7 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float
{
*t->is_color = 1;
dev->hints |= FZ_IGNORE_IMAGE;
- fz_close(stream);
+ fz_drop_stream(stream);
fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
break;
}
@@ -183,7 +183,7 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float
}
fz_fin_cached_color_converter(&cc);
}
- fz_close(stream);
+ fz_drop_stream(stream);
return;
}
@@ -287,7 +287,7 @@ fz_new_test_device(fz_context *ctx, int *is_color, float threshold)
dev->fill_shade = fz_test_fill_shade;
dev->fill_image = fz_test_fill_image;
dev->fill_image_mask = fz_test_fill_image_mask;
- dev->free_user = fz_test_free;
+ dev->drop_user = fz_test_free;
*t->is_color = 0;
diff --git a/source/fitz/tree.c b/source/fitz/tree.c
index ca94a45b..18fb6548 100644
--- a/source/fitz/tree.c
+++ b/source/fitz/tree.c
@@ -89,17 +89,17 @@ fz_tree *fz_tree_insert(fz_context *ctx, fz_tree *node, const char *key, void *v
}
}
-void fz_free_tree(fz_context *ctx, fz_tree *node, void (*freefunc)(fz_context *ctx, void *value))
+void fz_drop_tree(fz_context *ctx, fz_tree *node, void (*dropfunc)(fz_context *ctx, void *value))
{
if (node)
{
if (node->left != &sentinel)
- fz_free_tree(ctx, node->left, freefunc);
+ fz_drop_tree(ctx, node->left, dropfunc);
if (node->right != &sentinel)
- fz_free_tree(ctx, node->right, freefunc);
+ fz_drop_tree(ctx, node->right, dropfunc);
fz_free(ctx, node->key);
- if (freefunc)
- freefunc(ctx, node->value);
+ if (dropfunc)
+ dropfunc(ctx, node->value);
}
}
diff --git a/source/fitz/unzip.c b/source/fitz/unzip.c
index f13a9ace..bafc4146 100644
--- a/source/fitz/unzip.c
+++ b/source/fitz/unzip.c
@@ -452,13 +452,13 @@ fz_list_archive_entry(fz_context *ctx, fz_archive *zip, int idx)
}
void
-fz_close_archive(fz_context *ctx, fz_archive *zip)
+fz_drop_archive(fz_context *ctx, fz_archive *zip)
{
int i;
if (zip)
{
fz_free(ctx, zip->directory);
- fz_close(zip->file);
+ fz_drop_stream(zip->file);
for (i = 0; i < zip->count; ++i)
fz_free(ctx, zip->table[i].name);
fz_free(ctx, zip->table);
@@ -497,7 +497,7 @@ fz_open_archive_with_stream(fz_context *ctx, fz_stream *file)
}
fz_catch(ctx)
{
- fz_close_archive(ctx, zip);
+ fz_drop_archive(ctx, zip);
fz_rethrow(ctx);
}
@@ -517,7 +517,7 @@ fz_open_archive(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
diff --git a/source/fitz/xml.c b/source/fitz/xml.c
index 0d370331..424a6bdf 100644
--- a/source/fitz/xml.c
+++ b/source/fitz/xml.c
@@ -205,7 +205,7 @@ static void xml_free_attribute(fz_context *ctx, struct attribute *att)
}
}
-void fz_free_xml(fz_context *ctx, fz_xml *item)
+void fz_drop_xml(fz_context *ctx, fz_xml *item)
{
while (item)
{
@@ -215,7 +215,7 @@ void fz_free_xml(fz_context *ctx, fz_xml *item)
if (item->atts)
xml_free_attribute(ctx, item->atts);
if (item->down)
- fz_free_xml(ctx, item->down);
+ fz_drop_xml(ctx, item->down);
fz_free(ctx, item);
item = next;
}
@@ -618,7 +618,7 @@ fz_parse_xml(fz_context *ctx, unsigned char *s, int n, int preserve_white)
}
fz_catch(ctx)
{
- fz_free_xml(ctx, root.down);
+ fz_drop_xml(ctx, root.down);
fz_rethrow(ctx);
}
diff --git a/source/img/muimage.c b/source/img/muimage.c
index 21fd6261..30f9b043 100644
--- a/source/img/muimage.c
+++ b/source/img/muimage.c
@@ -62,7 +62,7 @@ image_open_document(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -77,7 +77,7 @@ image_close_document(image_document *doc)
{
fz_context *ctx = doc->ctx;
fz_drop_image(ctx, doc->image);
- fz_close(doc->file);
+ fz_drop_stream(doc->file);
fz_free(ctx, doc);
}
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)
{
diff --git a/source/tiff/mutiff.c b/source/tiff/mutiff.c
index ae9a7a72..20086621 100644
--- a/source/tiff/mutiff.c
+++ b/source/tiff/mutiff.c
@@ -65,7 +65,7 @@ tiff_open_document(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -80,7 +80,7 @@ tiff_close_document(tiff_document *doc)
{
fz_context *ctx = doc->ctx;
fz_drop_buffer(ctx, doc->buffer);
- fz_close(doc->file);
+ fz_drop_stream(doc->file);
fz_free(ctx, doc);
}
diff --git a/source/tools/mjsgen.c b/source/tools/mjsgen.c
index 1987e76d..cb4c1f1c 100644
--- a/source/tools/mjsgen.c
+++ b/source/tools/mjsgen.c
@@ -287,7 +287,7 @@ int main(int argc, char **argv)
}
fclose(mujstest_file);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 734429da..7f93d492 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -229,7 +229,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_catch(ctx)
@@ -252,7 +252,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_catch(ctx)
@@ -279,7 +279,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_run_display_list(list, dev, &fz_identity, &fz_infinite_rect, &cookie);
else
fz_run_page(doc, page, dev, &fz_identity, &cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
if (showtext == TEXT_XML)
{
@@ -298,9 +298,9 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
- fz_free_text_page(ctx, text);
+ fz_drop_text_page(ctx, text);
}
fz_catch(ctx)
{
@@ -326,7 +326,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_catch(ctx)
@@ -356,12 +356,12 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_run_display_list(list, dev, &ctm, &tbounds, &cookie);
else
fz_run_page(doc, page, dev, &ctm, &cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_catch(ctx)
@@ -371,7 +371,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_rethrow(ctx);
}
pdf_insert_page(pdfout, newpage, INT_MAX);
- pdf_free_page(pdfout, newpage);
+ pdf_drop_page(pdfout, newpage);
}
if (output && output_format == OUT_SVG)
@@ -408,14 +408,14 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_run_display_list(list, dev, &ctm, &tbounds, &cookie);
else
fz_run_page(doc, page, dev, &ctm, &cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
}
fz_always(ctx)
{
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
- fz_close_output(out);
+ fz_drop_output(out);
if (file != stdout)
fclose(file);
}
@@ -556,7 +556,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_run_display_list(list, dev, &ctm, &tbounds, &cookie);
else
fz_run_page(doc, page, dev, &ctm, &cookie);
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
if (invert)
@@ -639,11 +639,11 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_output_png_trailer(output_file, poc);
}
- fz_free_device(dev);
+ fz_drop_device(dev);
dev = NULL;
fz_drop_pixmap(ctx, pix);
if (output_file)
- fz_close_output(output_file);
+ fz_drop_output(output_file);
}
fz_catch(ctx)
{
@@ -749,8 +749,8 @@ static void drawoutline(fz_context *ctx, fz_document *doc)
}
fz_always(ctx)
{
- fz_close_output(out);
- fz_free_outline(ctx, outline);
+ fz_drop_output(out);
+ fz_drop_outline(ctx, outline);
}
fz_catch(ctx)
{
@@ -1105,11 +1105,11 @@ int main(int argc, char **argv)
}
if (showtext)
- fz_free_text_sheet(ctx, sheet);
+ fz_drop_text_sheet(ctx, sheet);
if (showxml || showtext)
{
- fz_close_output(out);
+ fz_drop_output(out);
out = NULL;
}
@@ -1131,7 +1131,7 @@ int main(int argc, char **argv)
}
}
- fz_free_context(ctx);
+ fz_drop_context(ctx);
if (showmemory)
{
diff --git a/source/tools/pdfclean.c b/source/tools/pdfclean.c
index d7d5ac97..bfeca0e4 100644
--- a/source/tools/pdfclean.c
+++ b/source/tools/pdfclean.c
@@ -310,7 +310,7 @@ int pdfclean_main(int argc, char **argv)
{
errors++;
}
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return errors == 0;
}
diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c
index b9697985..0c7463f7 100644
--- a/source/tools/pdfextract.c
+++ b/source/tools/pdfextract.c
@@ -233,6 +233,6 @@ int pdfextract_main(int argc, char **argv)
pdf_close_document(doc);
fz_flush_warnings(ctx);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
diff --git a/source/tools/pdfinfo.c b/source/tools/pdfinfo.c
index ff05012f..453f271a 100644
--- a/source/tools/pdfinfo.c
+++ b/source/tools/pdfinfo.c
@@ -1071,7 +1071,7 @@ int pdfinfo_main(int argc, char **argv)
{
ret = 1;
}
- fz_close_output(out);
- fz_free_context(ctx);
+ fz_drop_output(out);
+ fz_drop_context(ctx);
return ret;
}
diff --git a/source/tools/pdfposter.c b/source/tools/pdfposter.c
index aedeccb4..e4b631a6 100644
--- a/source/tools/pdfposter.c
+++ b/source/tools/pdfposter.c
@@ -169,6 +169,6 @@ int pdfposter_main(int argc, char **argv)
pdf_write_document(doc, outfile, &opts);
pdf_close_document(doc);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
diff --git a/source/tools/pdfshow.c b/source/tools/pdfshow.c
index c5d021ad..344f4c40 100644
--- a/source/tools/pdfshow.c
+++ b/source/tools/pdfshow.c
@@ -118,7 +118,7 @@ static void showstream(int num, int gen)
showsafe(buf, n);
}
- fz_close(stm);
+ fz_drop_stream(stm);
}
static void showobject(int num, int gen)
@@ -265,6 +265,6 @@ int pdfshow_main(int argc, char **argv)
fclose(out);
pdf_close_document(doc);
- fz_free_context(ctx);
+ fz_drop_context(ctx);
return 0;
}
diff --git a/source/xps/xps-doc.c b/source/xps/xps-doc.c
index 4bcf92cb..2b8cee8e 100644
--- a/source/xps/xps-doc.c
+++ b/source/xps/xps-doc.c
@@ -218,7 +218,7 @@ xps_lookup_link_target(xps_document *doc, char *target_uri)
}
static void
-xps_free_link_targets(xps_document *doc)
+xps_drop_link_targets(xps_document *doc)
{
xps_target *target = doc->target, *next;
while (target)
@@ -231,13 +231,13 @@ xps_free_link_targets(xps_document *doc)
}
static void
-xps_free_fixed_pages(xps_document *doc)
+xps_drop_fixed_pages(xps_document *doc)
{
xps_page *page = doc->first_page;
while (page)
{
xps_page *next = page->next;
- xps_free_page(doc, page);
+ xps_drop_page(doc, page);
fz_drop_link(doc->ctx, page->links);
fz_free(doc->ctx, page->name);
fz_free(doc->ctx, page);
@@ -248,7 +248,7 @@ xps_free_fixed_pages(xps_document *doc)
}
static void
-xps_free_fixed_documents(xps_document *doc)
+xps_drop_fixed_documents(xps_document *doc)
{
xps_fixdoc *fixdoc = doc->first_fixdoc;
while (fixdoc)
@@ -264,11 +264,11 @@ xps_free_fixed_documents(xps_document *doc)
}
void
-xps_free_page_list(xps_document *doc)
+xps_drop_page_list(xps_document *doc)
{
- xps_free_fixed_documents(doc);
- xps_free_fixed_pages(doc);
- xps_free_link_targets(doc);
+ xps_drop_fixed_documents(doc);
+ xps_drop_fixed_pages(doc);
+ xps_drop_link_targets(doc);
}
/*
@@ -362,7 +362,7 @@ xps_parse_metadata(xps_document *doc, xps_part *part, xps_fixdoc *fixdoc)
root = fz_parse_xml(doc->ctx, part->data, part->size, 0);
xps_parse_metadata_imp(doc, root, fixdoc);
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
doc->base_uri = NULL;
doc->part_uri = NULL;
@@ -384,7 +384,7 @@ xps_read_and_process_metadata_part(xps_document *doc, char *name, xps_fixdoc *fi
}
fz_always(ctx)
{
- xps_free_part(doc, part);
+ xps_drop_part(doc, part);
}
fz_catch(ctx)
{
@@ -443,7 +443,7 @@ xps_load_fixed_page(xps_document *doc, xps_page *page)
}
fz_always(ctx)
{
- xps_free_part(doc, part);
+ xps_drop_part(doc, part);
}
fz_catch(ctx)
{
@@ -458,31 +458,31 @@ xps_load_fixed_page(xps_document *doc, xps_page *page)
fz_xml *node = xps_lookup_alternate_content(root);
if (!node)
{
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "FixedPage missing alternate root element");
}
fz_detach_xml(node);
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
root = node;
}
if (strcmp(fz_xml_tag(root), "FixedPage"))
{
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "expected FixedPage element");
}
width_att = fz_xml_att(root, "Width");
if (!width_att)
{
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "FixedPage missing required attribute: Width");
}
height_att = fz_xml_att(root, "Height");
if (!height_att)
{
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "FixedPage missing required attribute: Height");
}
@@ -522,13 +522,13 @@ xps_bound_page(xps_document *doc, xps_page *page, fz_rect *bounds)
}
void
-xps_free_page(xps_document *doc, xps_page *page)
+xps_drop_page(xps_document *doc, xps_page *page)
{
if (page == NULL)
return;
/* only free the XML contents */
if (page->root)
- fz_free_xml(doc->ctx, page->root);
+ fz_drop_xml(doc->ctx, page->root);
page->root = NULL;
}
diff --git a/source/xps/xps-glyphs.c b/source/xps/xps-glyphs.c
index d2a786fe..4f030be0 100644
--- a/source/xps/xps-glyphs.c
+++ b/source/xps/xps-glyphs.c
@@ -539,7 +539,7 @@ xps_parse_glyphs(xps_document *doc, const fz_matrix *ctm,
fz_always(doc->ctx)
{
fz_drop_buffer(doc->ctx, buf);
- xps_free_part(doc, part);
+ xps_drop_part(doc, part);
}
fz_catch(doc->ctx)
{
diff --git a/source/xps/xps-gradient.c b/source/xps/xps-gradient.c
index 4c1d0851..d156a406 100644
--- a/source/xps/xps-gradient.c
+++ b/source/xps/xps-gradient.c
@@ -214,7 +214,7 @@ xps_draw_one_radial_gradient(xps_document *doc, const fz_matrix *ctm,
/* TODO: this (and the stuff in pdf_shade) should move to res_shade.c */
shade = fz_malloc_struct(doc->ctx, fz_shade);
- FZ_INIT_STORABLE(shade, 1, fz_free_shade_imp);
+ FZ_INIT_STORABLE(shade, 1, fz_drop_shade_imp);
shade->colorspace = fz_device_rgb(doc->ctx);
shade->bbox = fz_infinite_rect;
shade->matrix = fz_identity;
@@ -252,7 +252,7 @@ xps_draw_one_linear_gradient(xps_document *doc, const fz_matrix *ctm,
/* TODO: this (and the stuff in pdf_shade) should move to res_shade.c */
shade = fz_malloc_struct(doc->ctx, fz_shade);
- FZ_INIT_STORABLE(shade, 1, fz_free_shade_imp);
+ FZ_INIT_STORABLE(shade, 1, fz_drop_shade_imp);
shade->colorspace = fz_device_rgb(doc->ctx);
shade->bbox = fz_infinite_rect;
shade->matrix = fz_identity;
diff --git a/source/xps/xps-image.c b/source/xps/xps-image.c
index 9b2aefcb..d9b2ad11 100644
--- a/source/xps/xps-image.c
+++ b/source/xps/xps-image.c
@@ -114,7 +114,7 @@ xps_parse_image_brush(xps_document *doc, const fz_matrix *ctm, const fz_rect *ar
}
fz_always(doc->ctx)
{
- xps_free_part(doc, part);
+ xps_drop_part(doc, part);
}
fz_catch(doc->ctx)
{
diff --git a/source/xps/xps-outline.c b/source/xps/xps-outline.c
index e314e83e..3b088d78 100644
--- a/source/xps/xps-outline.c
+++ b/source/xps/xps-outline.c
@@ -90,7 +90,7 @@ xps_load_document_structure(xps_document *doc, xps_fixdoc *fixdoc)
}
fz_always(doc->ctx)
{
- xps_free_part(doc, part);
+ xps_drop_part(doc, part);
}
fz_catch(doc->ctx)
{
@@ -105,7 +105,7 @@ xps_load_document_structure(xps_document *doc, xps_fixdoc *fixdoc)
}
fz_always(doc->ctx)
{
- fz_free_xml(doc->ctx, root);
+ fz_drop_xml(doc->ctx, root);
}
fz_catch(doc->ctx)
{
diff --git a/source/xps/xps-resource.c b/source/xps/xps-resource.c
index 85fd7c49..6600f7c6 100644
--- a/source/xps/xps-resource.c
+++ b/source/xps/xps-resource.c
@@ -71,7 +71,7 @@ xps_parse_remote_resource_dictionary(xps_document *doc, char *base_uri, char *so
}
fz_always(ctx)
{
- xps_free_part(doc, part);
+ xps_drop_part(doc, part);
}
fz_catch(ctx)
{
@@ -84,7 +84,7 @@ xps_parse_remote_resource_dictionary(xps_document *doc, char *base_uri, char *so
if (strcmp(fz_xml_tag(xml), "ResourceDictionary"))
{
- fz_free_xml(doc->ctx, xml);
+ fz_drop_xml(doc->ctx, xml);
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "expected ResourceDictionary element");
}
@@ -138,14 +138,14 @@ xps_parse_resource_dictionary(xps_document *doc, char *base_uri, fz_xml *root)
}
void
-xps_free_resource_dictionary(xps_document *doc, xps_resource *dict)
+xps_drop_resource_dictionary(xps_document *doc, xps_resource *dict)
{
xps_resource *next;
while (dict)
{
next = dict->next;
if (dict->base_xml)
- fz_free_xml(doc->ctx, dict->base_xml);
+ fz_drop_xml(doc->ctx, dict->base_xml);
if (dict->base_uri)
fz_free(doc->ctx, dict->base_uri);
fz_free(doc->ctx, dict);
diff --git a/source/xps/xps-tile.c b/source/xps/xps-tile.c
index 5f966619..b7e0ec19 100644
--- a/source/xps/xps-tile.c
+++ b/source/xps/xps-tile.c
@@ -329,7 +329,7 @@ xps_parse_canvas(xps_document *doc, const fz_matrix *ctm, const fz_rect *area, c
fz_pop_clip(doc->dev);
if (new_dict)
- xps_free_resource_dictionary(doc, new_dict);
+ xps_drop_resource_dictionary(doc, new_dict);
}
void
@@ -371,7 +371,7 @@ xps_parse_fixed_page(xps_document *doc, const fz_matrix *ctm, xps_page *page)
}
if (dict)
- xps_free_resource_dictionary(doc, dict);
+ xps_drop_resource_dictionary(doc, dict);
}
void
diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c
index 1dbd103c..a8f25114 100644
--- a/source/xps/xps-zip.c
+++ b/source/xps/xps-zip.c
@@ -26,7 +26,7 @@ xps_new_part(xps_document *doc, char *name, unsigned char *data, int size)
}
void
-xps_free_part(xps_document *doc, xps_part *part)
+xps_drop_part(xps_document *doc, xps_part *part)
{
fz_free(doc->ctx, part->name);
fz_free(doc->ctx, part->data);
@@ -194,7 +194,7 @@ xps_open_document(fz_context *ctx, const char *filename)
}
fz_always(ctx)
{
- fz_close(file);
+ fz_drop_stream(file);
}
fz_catch(ctx)
{
@@ -212,7 +212,7 @@ xps_close_document(xps_document *doc)
return;
if (doc->zip)
- fz_close_archive(doc->ctx, doc->zip);
+ fz_drop_archive(doc->ctx, doc->zip);
font = doc->font_table;
while (font)
@@ -224,7 +224,7 @@ xps_close_document(xps_document *doc)
font = next;
}
- xps_free_page_list(doc);
+ xps_drop_page_list(doc);
fz_free(doc->ctx, doc->start_part);
fz_free(doc->ctx, doc);
@@ -262,7 +262,7 @@ xps_init_document(xps_document *doc)
doc->super.load_links = (fz_document_load_links_fn *)xps_load_links;
doc->super.bound_page = (fz_document_bound_page_fn *)xps_bound_page;
doc->super.run_page_contents = (fz_document_run_page_contents_fn *)xps_run_page;
- doc->super.free_page = (fz_document_free_page_fn *)xps_free_page;
+ doc->super.free_page = (fz_document_free_page_fn *)xps_drop_page;
doc->super.meta = (fz_document_meta_fn *)xps_meta;
doc->super.rebind = (fz_document_rebind_fn *)xps_rebind;
}