From 7099f3ec854cdaa5f5f63759703d307fadcfd1a1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 30 Mar 2011 15:17:02 +0200 Subject: xps: remove _t wart --- xps/muxps.h | 192 +++++++++++++++++++++++++++--------------------------- xps/xpsanalyze.c | 32 ++++----- xps/xpscolor.c | 10 +-- xps/xpscommon.c | 10 +-- xps/xpsdoc.c | 44 ++++++------- xps/xpsfont.c | 2 +- xps/xpsglyphs.c | 22 +++---- xps/xpsgradient.c | 46 ++++++------- xps/xpshash.c | 42 ++++++------ xps/xpsimage.c | 30 ++++----- xps/xpsjpeg.c | 2 +- xps/xpsjxr.c | 26 ++++---- xps/xpsmem.c | 16 ++--- xps/xpsopacity.c | 10 +-- xps/xpspage.c | 24 +++---- xps/xpspath.c | 50 +++++++------- xps/xpspng.c | 6 +- xps/xpsresource.c | 40 ++++++------ xps/xpstiff.c | 48 +++++++------- xps/xpstile.c | 20 +++--- xps/xpstop.c | 10 +-- xps/xpsvisual.c | 12 ++-- xps/xpsxml.c | 62 +++++++++--------- xps/xpszip.c | 74 ++++++++++----------- 24 files changed, 415 insertions(+), 415 deletions(-) diff --git a/xps/muxps.h b/xps/muxps.h index 256ea702..37dd03c6 100644 --- a/xps/muxps.h +++ b/xps/muxps.h @@ -11,7 +11,7 @@ typedef unsigned char byte; * XPS and ZIP constants. */ -typedef struct xps_context_s xps_context_t; +typedef struct xps_context_s xps_context; #define REL_START_PART \ "http://schemas.microsoft.com/xps/2005/06/fixedrepresentation" @@ -34,10 +34,10 @@ typedef struct xps_context_s xps_context_t; #define xps_strdup(ctx, str) fz_strdup(str) #define xps_free(ctx, ptr) fz_free(ptr) -size_t xps_strlcpy(char *destination, const char *source, size_t size); -size_t xps_strlcat(char *destination, const char *source, size_t size); +int xps_strlcpy(char *destination, const char *source, int size); +int xps_strlcat(char *destination, const char *source, int size); int xps_strcasecmp(char *a, char *b); -char *xps_strdup_imp(xps_context_t *ctx, const char *str, const char *function); +char *xps_strdup_imp(xps_context *ctx, const char *str, const char *function); void xps_absolute_path(char *output, char *base_uri, char *path, int output_size); int xps_utf8_to_ucs(int *p, const char *s, int n); @@ -46,21 +46,21 @@ int xps_utf8_to_ucs(int *p, const char *s, int n); * Generic hashtable. */ -typedef struct xps_hash_table_s xps_hash_table_t; +typedef struct xps_hash_table_s xps_hash_table; -xps_hash_table_t *xps_hash_new(xps_context_t *ctx); -void *xps_hash_lookup(xps_hash_table_t *table, char *key); -int xps_hash_insert(xps_context_t *ctx, xps_hash_table_t *table, char *key, void *value); -void xps_hash_free(xps_context_t *ctx, xps_hash_table_t *table, - void (*free_key)(xps_context_t *ctx, void *), - void (*free_value)(xps_context_t *ctx, void *)); -void xps_hash_debug(xps_hash_table_t *table); +xps_hash_table *xps_hash_new(xps_context *ctx); +void *xps_hash_lookup(xps_hash_table *table, char *key); +int xps_hash_insert(xps_context *ctx, xps_hash_table *table, char *key, void *value); +void xps_hash_free(xps_context *ctx, xps_hash_table *table, + void (*free_key)(xps_context *ctx, void *), + void (*free_value)(xps_context *ctx, void *)); +void xps_hash_debug(xps_hash_table *table); /* * Container parts. */ -typedef struct xps_part_s xps_part_t; +typedef struct xps_part_s xps_part; struct xps_part_s { @@ -70,21 +70,21 @@ struct xps_part_s byte *data; }; -xps_part_t *xps_new_part(xps_context_t *ctx, char *name, int size); -xps_part_t *xps_read_part(xps_context_t *ctx, char *partname); -void xps_free_part(xps_context_t *ctx, xps_part_t *part); +xps_part *xps_new_part(xps_context *ctx, char *name, int size); +xps_part *xps_read_part(xps_context *ctx, char *partname); +void xps_free_part(xps_context *ctx, xps_part *part); /* * Document structure. */ -typedef struct xps_document_s xps_document_t; -typedef struct xps_page_s xps_page_t; +typedef struct xps_document_s xps_document; +typedef struct xps_page_s xps_page; struct xps_document_s { char *name; - xps_document_t *next; + xps_document *next; }; struct xps_page_s @@ -93,19 +93,19 @@ struct xps_page_s int width; int height; struct xps_item_s *root; - xps_page_t *next; + xps_page *next; }; -int xps_parse_metadata(xps_context_t *ctx, xps_part_t *part); -void xps_free_fixed_pages(xps_context_t *ctx); -void xps_free_fixed_documents(xps_context_t *ctx); -void xps_debug_fixdocseq(xps_context_t *ctx); +int xps_parse_metadata(xps_context *ctx, xps_part *part); +void xps_free_fixed_pages(xps_context *ctx); +void xps_free_fixed_documents(xps_context *ctx); +void xps_debug_fixdocseq(xps_context *ctx); /* * Images. */ -typedef struct xps_image_s xps_image_t; +typedef struct xps_image_s xps_image; /* type for the information derived directly from the raster file format */ @@ -125,22 +125,22 @@ struct xps_image_s int profilesize; }; -int xps_decode_jpeg(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image); -int xps_decode_png(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image); -int xps_decode_tiff(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image); -int xps_decode_jpegxr(xps_context_t *ctx, byte *buf, int len, xps_image_t *image); +int xps_decode_jpeg(xps_context *ctx, byte *rbuf, int rlen, xps_image *image); +int xps_decode_png(xps_context *ctx, byte *rbuf, int rlen, xps_image *image); +int xps_decode_tiff(xps_context *ctx, byte *rbuf, int rlen, xps_image *image); +int xps_decode_jpegxr(xps_context *ctx, byte *buf, int len, xps_image *image); -int xps_png_has_alpha(xps_context_t *ctx, byte *rbuf, int rlen); -int xps_tiff_has_alpha(xps_context_t *ctx, byte *rbuf, int rlen); -int xps_jpegxr_has_alpha(xps_context_t *ctx, byte *buf, int len); +int xps_png_has_alpha(xps_context *ctx, byte *rbuf, int rlen); +int xps_tiff_has_alpha(xps_context *ctx, byte *rbuf, int rlen); +int xps_jpegxr_has_alpha(xps_context *ctx, byte *buf, int len); -void xps_free_image(xps_context_t *ctx, xps_image_t *image); +void xps_free_image(xps_context *ctx, xps_image *image); /* * Fonts. */ -typedef struct xps_glyph_metrics_s xps_glyph_metrics_t; +typedef struct xps_glyph_metrics_s xps_glyph_metrics; struct xps_glyph_metrics_s { @@ -152,96 +152,96 @@ void xps_identify_font_encoding(fz_font *font, int idx, int *pid, int *eid); void xps_select_font_encoding(fz_font *font, int idx); int xps_encode_font_char(fz_font *font, int key); -void xps_measure_font_glyph(xps_context_t *ctx, fz_font *font, int gid, xps_glyph_metrics_t *mtx); +void xps_measure_font_glyph(xps_context *ctx, fz_font *font, int gid, xps_glyph_metrics *mtx); -void xps_debug_path(xps_context_t *ctx); +void xps_debug_path(xps_context *ctx); /* * Colorspaces and colors. */ -fz_colorspace *xps_read_icc_colorspace(xps_context_t *ctx, char *base_uri, char *profile); -void xps_parse_color(xps_context_t *ctx, char *base_uri, char *hexstring, fz_colorspace **csp, float *samples); -void xps_set_color(xps_context_t *ctx, fz_colorspace *colorspace, float *samples); +fz_colorspace *xps_read_icc_colorspace(xps_context *ctx, char *base_uri, char *profile); +void xps_parse_color(xps_context *ctx, char *base_uri, char *hexstring, fz_colorspace **csp, float *samples); +void xps_set_color(xps_context *ctx, fz_colorspace *colorspace, float *samples); /* * XML document model */ -typedef struct xps_item_s xps_item_t; +typedef struct xps_item_s xps_item; -xps_item_t * xps_parse_xml(xps_context_t *ctx, byte *buf, int len); -xps_item_t * xps_next(xps_item_t *item); -xps_item_t * xps_down(xps_item_t *item); -char * xps_tag(xps_item_t *item); -char * xps_att(xps_item_t *item, const char *att); -void xps_free_item(xps_context_t *ctx, xps_item_t *item); -void xps_debug_item(xps_item_t *item, int level); +xps_item * xps_parse_xml(xps_context *ctx, byte *buf, int len); +xps_item * xps_next(xps_item *item); +xps_item * xps_down(xps_item *item); +char * xps_tag(xps_item *item); +char * xps_att(xps_item *item, const char *att); +void xps_free_item(xps_context *ctx, xps_item *item); +void xps_debug_item(xps_item *item, int level); /* * Resource dictionaries. */ -typedef struct xps_resource_s xps_resource_t; +typedef struct xps_resource_s xps_resource; struct xps_resource_s { char *name; char *base_uri; /* only used in the head nodes */ - xps_item_t *base_xml; /* only used in the head nodes, to free the xml document */ - xps_item_t *data; - xps_resource_t *next; - xps_resource_t *parent; /* up to the previous dict in the stack */ + xps_item *base_xml; /* only used in the head nodes, to free the xml document */ + xps_item *data; + xps_resource *next; + xps_resource *parent; /* up to the previous dict in the stack */ }; -int xps_parse_resource_dictionary(xps_context_t *ctx, xps_resource_t **dictp, char *base_uri, xps_item_t *root); -void xps_free_resource_dictionary(xps_context_t *ctx, xps_resource_t *dict); -void xps_resolve_resource_reference(xps_context_t *ctx, xps_resource_t *dict, char **attp, xps_item_t **tagp, char **urip); +int xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base_uri, xps_item *root); +void xps_free_resource_dictionary(xps_context *ctx, xps_resource *dict); +void xps_resolve_resource_reference(xps_context *ctx, xps_resource *dict, char **attp, xps_item **tagp, char **urip); -void xps_debug_resource_dictionary(xps_resource_t *dict); +void xps_debug_resource_dictionary(xps_resource *dict); /* * Fixed page/graphics parsing. */ -int xps_load_fixed_page(xps_context_t *ctx, xps_page_t *page); -void xps_parse_fixed_page(xps_context_t *ctx, fz_matrix ctm, xps_page_t *page); -void xps_parse_canvas(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_path(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_glyphs(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_solid_color_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_visual_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_linear_gradient_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_radial_gradient_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); +int xps_load_fixed_page(xps_context *ctx, xps_page *page); +void xps_parse_fixed_page(xps_context *ctx, fz_matrix ctm, xps_page *page); +void xps_parse_canvas(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_glyphs(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_solid_color_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_image_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_visual_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_linear_gradient_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_radial_gradient_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); -void xps_parse_tiling_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *root, void(*func)(xps_context_t*, fz_matrix, char*, xps_resource_t*, xps_item_t*, void*), void *user); +void xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *root, void(*func)(xps_context*, fz_matrix, char*, xps_resource*, xps_item*, void*), void *user); -void xps_parse_matrix_transform(xps_context_t *ctx, xps_item_t *root, fz_matrix *matrix); -void xps_parse_render_transform(xps_context_t *ctx, char *text, fz_matrix *matrix); -void xps_parse_rectangle(xps_context_t *ctx, char *text, fz_rect *rect); -void xps_parse_abbreviated_geometry(xps_context_t *ctx, char *geom); -void xps_parse_path_geometry(xps_context_t *ctx, xps_resource_t *dict, xps_item_t *root, int stroking); +void xps_parse_matrix_transform(xps_context *ctx, xps_item *root, fz_matrix *matrix); +void xps_parse_render_transform(xps_context *ctx, char *text, fz_matrix *matrix); +void xps_parse_rectangle(xps_context *ctx, char *text, fz_rect *rect); +void xps_parse_abbreviated_geometry(xps_context *ctx, char *geom); +void xps_parse_path_geometry(xps_context *ctx, xps_resource *dict, xps_item *root, int stroking); -void xps_begin_opacity(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, char *opacity_att, xps_item_t *opacity_mask_tag); -void xps_end_opacity(xps_context_t *ctx, char *base_uri, xps_resource_t *dict, char *opacity_att, xps_item_t *opacity_mask_tag); +void xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, char *opacity_att, xps_item *opacity_mask_tag); +void xps_end_opacity(xps_context *ctx, char *base_uri, xps_resource *dict, char *opacity_att, xps_item *opacity_mask_tag); -void xps_parse_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); -void xps_parse_element(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node); +void xps_parse_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); +void xps_parse_element(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node); -void xps_fill(xps_context_t *ctx, fz_matrix ctm); -void xps_clip(xps_context_t *ctx, fz_matrix ctm); -void xps_bounds_in_user_space(xps_context_t *ctx, fz_rect *user); +void xps_fill(xps_context *ctx, fz_matrix ctm); +void xps_clip(xps_context *ctx, fz_matrix ctm); +void xps_bounds_in_user_space(xps_context *ctx, fz_rect *user); -int xps_element_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *node); -int xps_resource_dictionary_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *node); -int xps_image_brush_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root); +int xps_element_has_transparency(xps_context *ctx, char *base_uri, xps_item *node); +int xps_resource_dictionary_has_transparency(xps_context *ctx, char *base_uri, xps_item *node); +int xps_image_brush_has_transparency(xps_context *ctx, char *base_uri, xps_item *root); /* * The interpreter context. */ -typedef struct xps_entry_s xps_entry_t; +typedef struct xps_entry_s xps_entry; struct xps_entry_s { @@ -256,20 +256,20 @@ struct xps_context_s char *directory; FILE *file; int zip_count; - xps_entry_t *zip_table; + xps_entry *zip_table; char *start_part; /* fixed document sequence */ - xps_document_t *first_fixdoc; /* first fixed document */ - xps_document_t *last_fixdoc; /* last fixed document */ - xps_page_t *first_page; /* first page of document */ - xps_page_t *last_page; /* last page of document */ + xps_document *first_fixdoc; /* first fixed document */ + xps_document *last_fixdoc; /* last fixed document */ + xps_page *first_page; /* first page of document */ + xps_page *last_page; /* last page of document */ char *base_uri; /* base uri for parsing XML and resolving relative paths */ char *part_uri; /* part uri for parsing metadata relations */ /* We cache font and colorspace resources */ - xps_hash_table_t *font_table; - xps_hash_table_t *colorspace_table; + xps_hash_table *font_table; + xps_hash_table *colorspace_table; /* Global toggle for transparency */ int use_transparency; @@ -300,11 +300,11 @@ struct xps_context_s fz_device *dev; }; -int xps_read_and_process_page_part(xps_context_t *ctx, fz_matrix ctm, char *name); -int xps_open_file(xps_context_t *ctx, char *filename); -int xps_count_pages(xps_context_t *ctx); -xps_page_t *xps_load_page(xps_context_t *ctx, int number); -xps_context_t *xps_new_context(void); -int xps_free_context(xps_context_t *ctx); +int xps_read_and_process_page_part(xps_context *ctx, fz_matrix ctm, char *name); +int xps_open_file(xps_context *ctx, char *filename); +int xps_count_pages(xps_context *ctx); +xps_page *xps_load_page(xps_context *ctx, int number); +xps_context *xps_new_context(void); +int xps_free_context(xps_context *ctx); #endif diff --git a/xps/xpsanalyze.c b/xps/xpsanalyze.c index 41dc28c6..9cd29840 100644 --- a/xps/xpsanalyze.c +++ b/xps/xpsanalyze.c @@ -7,17 +7,17 @@ #include "muxps.h" static int -xps_remote_resource_dictionary_has_transparency(xps_context_t *ctx, char *base_uri, char *source_att) +xps_remote_resource_dictionary_has_transparency(xps_context *ctx, char *base_uri, char *source_att) { //dputs("page has transparency: uses a remote resource; not parsed; being conservative\n"); return 1; } int -xps_resource_dictionary_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_resource_dictionary_has_transparency(xps_context *ctx, char *base_uri, xps_item *root) { char *source; - xps_item_t *node; + xps_item *node; source = xps_att(root, "Source"); if (source) @@ -32,9 +32,9 @@ xps_resource_dictionary_has_transparency(xps_context_t *ctx, char *base_uri, xps } static int -xps_gradient_stops_have_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_gradient_stops_have_transparency(xps_context *ctx, char *base_uri, xps_item *root) { - xps_item_t *node; + xps_item *node; fz_colorspace *colorspace; char *color_att; float samples[32]; @@ -60,9 +60,9 @@ xps_gradient_stops_have_transparency(xps_context_t *ctx, char *base_uri, xps_ite } static int -xps_gradient_brush_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_gradient_brush_has_transparency(xps_context *ctx, char *base_uri, xps_item *root) { - xps_item_t *node; + xps_item *node; char *opacity_att; opacity_att = xps_att(root, "Opacity"); @@ -93,11 +93,11 @@ xps_gradient_brush_has_transparency(xps_context_t *ctx, char *base_uri, xps_item } static int -xps_brush_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_brush_has_transparency(xps_context *ctx, char *base_uri, xps_item *root) { char *opacity_att; char *color_att; - xps_item_t *node; + xps_item *node; fz_colorspace *colorspace; float samples[32]; @@ -170,9 +170,9 @@ xps_brush_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) } static int -xps_path_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_path_has_transparency(xps_context *ctx, char *base_uri, xps_item *root) { - xps_item_t *node; + xps_item *node; for (node = xps_down(root); node; node = xps_next(node)) { @@ -199,9 +199,9 @@ xps_path_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) } static int -xps_glyphs_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_glyphs_has_transparency(xps_context *ctx, char *base_uri, xps_item *root) { - xps_item_t *node; + xps_item *node; for (node = xps_down(root); node; node = xps_next(node)) { @@ -222,9 +222,9 @@ xps_glyphs_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root } static int -xps_canvas_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root) +xps_canvas_has_transparency(xps_context *ctx, char *base_uri, xps_item *root) { - xps_item_t *node; + xps_item *node; for (node = xps_down(root); node; node = xps_next(node)) { @@ -248,7 +248,7 @@ xps_canvas_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *root } int -xps_element_has_transparency(xps_context_t *ctx, char *base_uri, xps_item_t *node) +xps_element_has_transparency(xps_context *ctx, char *base_uri, xps_item *node) { char *opacity_att; char *stroke_att; diff --git a/xps/xpscolor.c b/xps/xpscolor.c index 558bde7c..513e7aab 100644 --- a/xps/xpscolor.c +++ b/xps/xpscolor.c @@ -4,7 +4,7 @@ #include /* for toupper() */ void -xps_set_color(xps_context_t *ctx, fz_colorspace *colorspace, float *samples) +xps_set_color(xps_context *ctx, fz_colorspace *colorspace, float *samples) { int i; @@ -42,7 +42,7 @@ static int count_commas(char *s) } void -xps_parse_color(xps_context_t *ctx, char *base_uri, char *string, +xps_parse_color(xps_context *ctx, char *base_uri, char *string, fz_colorspace **csp, float *samples) { char *p; @@ -142,11 +142,11 @@ xps_parse_color(xps_context_t *ctx, char *base_uri, char *string, } fz_colorspace * -xps_read_icc_colorspace(xps_context_t *ctx, char *base_uri, char *profilename) +xps_read_icc_colorspace(xps_context *ctx, char *base_uri, char *profilename) { #if 0 fz_colorspace *space; - xps_part_t *part; + xps_part *part; char partname[1024]; /* Find ICC colorspace part */ @@ -201,7 +201,7 @@ xps_read_icc_colorspace(xps_context_t *ctx, char *base_uri, char *profilename) } void -xps_parse_solid_color_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node) +xps_parse_solid_color_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node) { char *opacity_att; char *color_att; diff --git a/xps/xpscommon.c b/xps/xpscommon.c index dd8762e8..2d46caa4 100644 --- a/xps/xpscommon.c +++ b/xps/xpscommon.c @@ -2,7 +2,7 @@ #include "muxps.h" void -xps_parse_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node) +xps_parse_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node) { if (!strcmp(xps_tag(node), "SolidColorBrush")) xps_parse_solid_color_brush(ctx, ctm, base_uri, dict, node); @@ -19,7 +19,7 @@ xps_parse_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_ } void -xps_parse_element(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *node) +xps_parse_element(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *node) { if (!strcmp(xps_tag(node), "Path")) xps_parse_path(ctx, ctm, base_uri, dict, node); @@ -31,7 +31,7 @@ xps_parse_element(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resourc } void -xps_parse_render_transform(xps_context_t *ctx, char *transform, fz_matrix *matrix) +xps_parse_render_transform(xps_context *ctx, char *transform, fz_matrix *matrix) { float args[6]; char *s = transform; @@ -56,7 +56,7 @@ xps_parse_render_transform(xps_context_t *ctx, char *transform, fz_matrix *matri } void -xps_parse_matrix_transform(xps_context_t *ctx, xps_item_t *root, fz_matrix *matrix) +xps_parse_matrix_transform(xps_context *ctx, xps_item *root, fz_matrix *matrix) { char *transform; @@ -71,7 +71,7 @@ xps_parse_matrix_transform(xps_context_t *ctx, xps_item_t *root, fz_matrix *matr } void -xps_parse_rectangle(xps_context_t *ctx, char *text, fz_rect *rect) +xps_parse_rectangle(xps_context *ctx, char *text, fz_rect *rect) { float args[4]; char *s = text; diff --git a/xps/xpsdoc.c b/xps/xpsdoc.c index c0e83e4a..312cac8d 100644 --- a/xps/xpsdoc.c +++ b/xps/xpsdoc.c @@ -3,12 +3,12 @@ #include -xps_part_t * -xps_new_part(xps_context_t *ctx, char *name, int size) +xps_part * +xps_new_part(xps_context *ctx, char *name, int size) { - xps_part_t *part; + xps_part *part; - part = xps_alloc(ctx, sizeof(xps_part_t)); + part = xps_alloc(ctx, sizeof(xps_part)); part->name = xps_strdup(ctx, name); part->size = size; part->data = xps_alloc(ctx, size); @@ -17,7 +17,7 @@ xps_new_part(xps_context_t *ctx, char *name, int size) } void -xps_free_part(xps_context_t *ctx, xps_part_t *part) +xps_free_part(xps_context *ctx, xps_part *part) { xps_free(ctx, part->name); xps_free(ctx, part->data); @@ -30,10 +30,10 @@ xps_free_part(xps_context_t *ctx, xps_part_t *part) */ void -xps_debug_fixdocseq(xps_context_t *ctx) +xps_debug_fixdocseq(xps_context *ctx) { - xps_document_t *fixdoc = ctx->first_fixdoc; - xps_page_t *page = ctx->first_page; + xps_document *fixdoc = ctx->first_fixdoc; + xps_page *page = ctx->first_page; if (ctx->start_part) printf("start part %s\n", ctx->start_part); @@ -52,16 +52,16 @@ xps_debug_fixdocseq(xps_context_t *ctx) } static void -xps_add_fixed_document(xps_context_t *ctx, char *name) +xps_add_fixed_document(xps_context *ctx, char *name) { - xps_document_t *fixdoc; + xps_document *fixdoc; /* Check for duplicates first */ for (fixdoc = ctx->first_fixdoc; fixdoc; fixdoc = fixdoc->next) if (!strcmp(fixdoc->name, name)) return; - fixdoc = xps_alloc(ctx, sizeof(xps_document_t)); + fixdoc = xps_alloc(ctx, sizeof(xps_document)); fixdoc->name = xps_strdup(ctx, name); fixdoc->next = NULL; @@ -78,12 +78,12 @@ xps_add_fixed_document(xps_context_t *ctx, char *name) } void -xps_free_fixed_documents(xps_context_t *ctx) +xps_free_fixed_documents(xps_context *ctx) { - xps_document_t *node = ctx->first_fixdoc; + xps_document *node = ctx->first_fixdoc; while (node) { - xps_document_t *next = node->next; + xps_document *next = node->next; xps_free(ctx, node->name); xps_free(ctx, node); node = next; @@ -93,16 +93,16 @@ xps_free_fixed_documents(xps_context_t *ctx) } static void -xps_add_fixed_page(xps_context_t *ctx, char *name, int width, int height) +xps_add_fixed_page(xps_context *ctx, char *name, int width, int height) { - xps_page_t *page; + xps_page *page; /* Check for duplicates first */ for (page = ctx->first_page; page; page = page->next) if (!strcmp(page->name, name)) return; - page = xps_alloc(ctx, sizeof(xps_page_t)); + page = xps_alloc(ctx, sizeof(xps_page)); page->name = xps_strdup(ctx, name); page->width = width; page->height = height; @@ -122,12 +122,12 @@ xps_add_fixed_page(xps_context_t *ctx, char *name, int width, int height) } void -xps_free_fixed_pages(xps_context_t *ctx) +xps_free_fixed_pages(xps_context *ctx) { - xps_page_t *node = ctx->first_page; + xps_page *node = ctx->first_page; while (node) { - xps_page_t *next = node->next; + xps_page *next = node->next; xps_free(ctx, node->name); xps_free(ctx, node); node = next; @@ -145,7 +145,7 @@ xps_free_fixed_pages(xps_context_t *ctx) static void xps_parse_metadata_imp(void *zp, char *name, char **atts) { - xps_context_t *ctx = zp; + xps_context *ctx = zp; int i; if (!strcmp(name, "Relationship")) @@ -214,7 +214,7 @@ xps_parse_metadata_imp(void *zp, char *name, char **atts) } int -xps_parse_metadata(xps_context_t *ctx, xps_part_t *part) +xps_parse_metadata(xps_context *ctx, xps_part *part) { XML_Parser xp; int code; diff --git a/xps/xpsfont.c b/xps/xpsfont.c index 561cc7ec..a76cc10e 100644 --- a/xps/xpsfont.c +++ b/xps/xpsfont.c @@ -38,7 +38,7 @@ xps_encode_font_char(fz_font *font, int code) } void -xps_measure_font_glyph(xps_context_t *ctx, fz_font *font, int gid, xps_glyph_metrics_t *mtx) +xps_measure_font_glyph(xps_context *ctx, fz_font *font, int gid, xps_glyph_metrics *mtx) { int mask = FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM; FT_Face face = font->ftface; diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c index 74d80f56..c53e3a25 100644 --- a/xps/xpsglyphs.c +++ b/xps/xpsglyphs.c @@ -15,7 +15,7 @@ static inline int unhex(int i) * data with the GUID in the fontname. */ static void -xps_deobfuscate_font_resource(xps_context_t *ctx, xps_part_t *part) +xps_deobfuscate_font_resource(xps_context *ctx, xps_part *part) { byte buf[33]; byte key[16]; @@ -172,11 +172,11 @@ xps_parse_glyph_metrics(char *s, float *advance, float *uofs, float *vofs) * Calculate metrics for positioning. */ static void -xps_parse_glyphs_imp(xps_context_t *ctx, fz_matrix ctm, fz_font *font, float size, +xps_parse_glyphs_imp(xps_context *ctx, fz_matrix ctm, fz_font *font, float size, float originx, float originy, int is_sideways, int bidi_level, char *indices, char *unicode, int is_charpath) { - xps_glyph_metrics_t mtx; + xps_glyph_metrics mtx; fz_matrix tm; float e, f; float x = originx; @@ -285,10 +285,10 @@ xps_parse_glyphs_imp(xps_context_t *ctx, fz_matrix ctm, fz_font *font, float siz } void -xps_parse_glyphs(xps_context_t *ctx, fz_matrix ctm, - char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_glyphs(xps_context *ctx, fz_matrix ctm, + char *base_uri, xps_resource *dict, xps_item *root) { - xps_item_t *node; + xps_item *node; int code; char *fill_uri; @@ -310,14 +310,14 @@ xps_parse_glyphs(xps_context_t *ctx, fz_matrix ctm, char *opacity_att; char *opacity_mask_att; - xps_item_t *transform_tag = NULL; - xps_item_t *clip_tag = NULL; - xps_item_t *fill_tag = NULL; - xps_item_t *opacity_mask_tag = NULL; + xps_item *transform_tag = NULL; + xps_item *clip_tag = NULL; + xps_item *fill_tag = NULL; + xps_item *opacity_mask_tag = NULL; char *fill_opacity_att = NULL; - xps_part_t *part; + xps_part *part; fz_font *font; char partname[1024]; diff --git a/xps/xpsgradient.c b/xps/xpsgradient.c index 0c06ff15..17881d6c 100644 --- a/xps/xpsgradient.c +++ b/xps/xpsgradient.c @@ -35,7 +35,7 @@ static inline float lerp(float a, float b, float x) } static int -xps_parse_gradient_stops(xps_context_t *ctx, char *base_uri, xps_item_t *node, +xps_parse_gradient_stops(xps_context *ctx, char *base_uri, xps_item *node, struct stop *stops, int maxcount) { fz_colorspace *colorspace; @@ -187,15 +187,15 @@ xps_gradient_has_transparent_colors(struct stop *stops, int count) */ static void -xps_draw_one_radial_gradient(xps_context_t *ctx, +xps_draw_one_radial_gradient(xps_context *ctx, int extend, float x0, float y0, float r0, float x1, float y1, float r1) { #if 0 - gs_memory_t *mem = ctx->memory; - gs_shading_t *shading; - gs_shading_R_params_t params; + gs_memory *mem = ctx->memory; + gs_shading *shading; + gs_shading_R_params params; int code; gs_shading_R_params_init(¶ms); @@ -237,14 +237,14 @@ xps_draw_one_radial_gradient(xps_context_t *ctx, */ static void -xps_draw_one_linear_gradient(xps_context_t *ctx, +xps_draw_one_linear_gradient(xps_context *ctx, int extend, float x0, float y0, float x1, float y1) { #if 0 - gs_memory_t *mem = ctx->memory; - gs_shading_t *shading; - gs_shading_A_params_t params; + gs_memory *mem = ctx->memory; + gs_shading *shading; + gs_shading_A_params params; int code; gs_shading_A_params_init(¶ms); @@ -295,7 +295,7 @@ static inline float point_inside_circle(float px, float py, float x, float y, fl } static void -xps_draw_radial_gradient(xps_context_t *ctx, xps_item_t *root, int spread) +xps_draw_radial_gradient(xps_context *ctx, xps_item *root, int spread) { fz_rect bbox; float x0, y0, r0; @@ -428,7 +428,7 @@ xps_draw_radial_gradient(xps_context_t *ctx, xps_item_t *root, int spread) */ static void -xps_draw_linear_gradient(xps_context_t *ctx, xps_item_t *root, int spread) +xps_draw_linear_gradient(xps_context *ctx, xps_item *root, int spread) { fz_rect bbox; float x0, y0, x1, y1; @@ -505,11 +505,11 @@ xps_draw_linear_gradient(xps_context_t *ctx, xps_item_t *root, int spread) */ static void -xps_parse_gradient_brush(xps_context_t *ctx, fz_matrix ctm, - char *base_uri, xps_resource_t *dict, xps_item_t *root, - void (*draw)(xps_context_t *, xps_item_t *, int)) +xps_parse_gradient_brush(xps_context *ctx, fz_matrix ctm, + char *base_uri, xps_resource *dict, xps_item *root, + void (*draw)(xps_context *, xps_item *, int)) { - xps_item_t *node; + xps_item *node; char *opacity_att; char *interpolation_att; @@ -517,8 +517,8 @@ xps_parse_gradient_brush(xps_context_t *ctx, fz_matrix ctm, char *mapping_att; char *transform_att; - xps_item_t *transform_tag = NULL; - xps_item_t *stop_tag = NULL; + xps_item *transform_tag = NULL; + xps_item *stop_tag = NULL; struct stop stop_list[MAX_STOPS]; int stop_count; @@ -615,8 +615,8 @@ xps_parse_gradient_brush(xps_context_t *ctx, fz_matrix ctm, { if (has_opacity) { - gs_transparency_mask_params_t params; - gs_transparency_group_params_t tgp; + gs_transparency_mask_params params; + gs_transparency_group_params tgp; gs_trans_mask_params_init(¶ms, TRANSPARENCY_MASK_Luminosity); gs_begin_transparency_mask(ctx->pgs, ¶ms, &bbox, 0); @@ -661,15 +661,15 @@ xps_parse_gradient_brush(xps_context_t *ctx, fz_matrix ctm, } void -xps_parse_linear_gradient_brush(xps_context_t *ctx, fz_matrix ctm, - char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_linear_gradient_brush(xps_context *ctx, fz_matrix ctm, + char *base_uri, xps_resource *dict, xps_item *root) { xps_parse_gradient_brush(ctx, ctm, base_uri, dict, root, xps_draw_linear_gradient); } void -xps_parse_radial_gradient_brush(xps_context_t *ctx, fz_matrix ctm, - char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_radial_gradient_brush(xps_context *ctx, fz_matrix ctm, + char *base_uri, xps_resource *dict, xps_item *root) { xps_parse_gradient_brush(ctx, ctm, base_uri, dict, root, xps_draw_radial_gradient); } diff --git a/xps/xpshash.c b/xps/xpshash.c index 1e562ff3..24d05074 100644 --- a/xps/xpshash.c +++ b/xps/xpshash.c @@ -14,7 +14,7 @@ static const unsigned primes[] = 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 0 }; -typedef struct xps_hash_entry_s xps_hash_entry_t; +typedef struct xps_hash_entry_s xps_hash_entry; struct xps_hash_entry_s { @@ -27,7 +27,7 @@ struct xps_hash_table_s void *ctx; unsigned int size; unsigned int load; - xps_hash_entry_t *entries; + xps_hash_entry *entries; }; static inline int @@ -47,12 +47,12 @@ xps_hash(char *s) return h; } -xps_hash_table_t * -xps_hash_new(xps_context_t *ctx) +xps_hash_table * +xps_hash_new(xps_context *ctx) { - xps_hash_table_t *table; + xps_hash_table *table; - table = xps_alloc(ctx, sizeof(xps_hash_table_t)); + table = xps_alloc(ctx, sizeof(xps_hash_table)); if (!table) { fz_throw("out of memory: hash table struct"); @@ -62,7 +62,7 @@ xps_hash_new(xps_context_t *ctx) table->size = primes[0]; table->load = 0; - table->entries = xps_alloc(ctx, sizeof(xps_hash_entry_t) * table->size); + table->entries = xps_alloc(ctx, sizeof(xps_hash_entry) * table->size); if (!table->entries) { xps_free(ctx, table); @@ -70,16 +70,16 @@ xps_hash_new(xps_context_t *ctx) return NULL; } - memset(table->entries, 0, sizeof(xps_hash_entry_t) * table->size); + memset(table->entries, 0, sizeof(xps_hash_entry) * table->size); return table; } static int -xps_hash_double(xps_context_t *ctx, xps_hash_table_t *table) +xps_hash_double(xps_context *ctx, xps_hash_table *table) { - xps_hash_entry_t *old_entries; - xps_hash_entry_t *new_entries; + xps_hash_entry *old_entries; + xps_hash_entry *new_entries; unsigned int old_size = table->size; unsigned int new_size = table->size * 2; int i; @@ -94,7 +94,7 @@ xps_hash_double(xps_context_t *ctx, xps_hash_table_t *table) } old_entries = table->entries; - new_entries = xps_alloc(ctx, sizeof(xps_hash_entry_t) * new_size); + new_entries = xps_alloc(ctx, sizeof(xps_hash_entry) * new_size); if (!new_entries) return fz_throw("out of memory: hash table entries array"); @@ -102,7 +102,7 @@ xps_hash_double(xps_context_t *ctx, xps_hash_table_t *table) table->entries = new_entries; table->load = 0; - memset(table->entries, 0, sizeof(xps_hash_entry_t) * table->size); + memset(table->entries, 0, sizeof(xps_hash_entry) * table->size); for (i = 0; i < old_size; i++) if (old_entries[i].value) @@ -114,9 +114,9 @@ xps_hash_double(xps_context_t *ctx, xps_hash_table_t *table) } void -xps_hash_free(xps_context_t *ctx, xps_hash_table_t *table, - void (*free_key)(xps_context_t *ctx, void *), - void (*free_value)(xps_context_t *ctx, void *)) +xps_hash_free(xps_context *ctx, xps_hash_table *table, + void (*free_key)(xps_context *ctx, void *), + void (*free_value)(xps_context *ctx, void *)) { int i; @@ -133,9 +133,9 @@ xps_hash_free(xps_context_t *ctx, xps_hash_table_t *table, } void * -xps_hash_lookup(xps_hash_table_t *table, char *key) +xps_hash_lookup(xps_hash_table *table, char *key) { - xps_hash_entry_t *entries = table->entries; + xps_hash_entry *entries = table->entries; unsigned int size = table->size; unsigned int pos = xps_hash(key) % size; @@ -152,9 +152,9 @@ xps_hash_lookup(xps_hash_table_t *table, char *key) } int -xps_hash_insert(xps_context_t *ctx, xps_hash_table_t *table, char *key, void *value) +xps_hash_insert(xps_context *ctx, xps_hash_table *table, char *key, void *value) { - xps_hash_entry_t *entries; + xps_hash_entry *entries; unsigned int size, pos; /* Grow the table at 80% load */ @@ -188,7 +188,7 @@ xps_hash_insert(xps_context_t *ctx, xps_hash_table_t *table, char *key, void *va } void -xps_hash_debug(xps_hash_table_t *table) +xps_hash_debug(xps_hash_table *table) { int i; diff --git a/xps/xpsimage.c b/xps/xpsimage.c index 5cd03418..6866518f 100644 --- a/xps/xpsimage.c +++ b/xps/xpsimage.c @@ -2,7 +2,7 @@ #include "muxps.h" static int -xps_decode_image(xps_context_t *ctx, xps_part_t *part, xps_image_t *image) +xps_decode_image(xps_context *ctx, xps_part *part, xps_image *image) { byte *buf = part->data; int len = part->size; @@ -11,7 +11,7 @@ xps_decode_image(xps_context_t *ctx, xps_part_t *part, xps_image_t *image) if (len < 8) return fz_throw("unknown image file format"); - memset(image, 0, sizeof(xps_image_t)); + memset(image, 0, sizeof(xps_image)); if (buf[0] == 0xff && buf[1] == 0xd8) { @@ -44,7 +44,7 @@ xps_decode_image(xps_context_t *ctx, xps_part_t *part, xps_image_t *image) } static void -xps_paint_image_brush_imp(xps_context_t *ctx, fz_matrix ctm, xps_image_t *image) +xps_paint_image_brush_imp(xps_context *ctx, fz_matrix ctm, xps_image *image) { fz_colorspace *colorspace; unsigned int count; @@ -58,10 +58,10 @@ printf("xps_paint_image_brush_imp!\n"); } static void -xps_paint_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *root, void *vimage) +xps_paint_image_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *root, void *vimage) { #if 0 - xps_image_t *image = vimage; + xps_image *image = vimage; int code; if (ctx->opacity_only) @@ -77,8 +77,8 @@ xps_paint_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_res if (image->alpha) { - gs_transparency_mask_params_t params; - gs_transparency_group_params_t tgp; + gs_transparency_mask_params params; + gs_transparency_group_params tgp; fz_rect bbox; xps_bounds_in_user_space(ctx, &bbox); @@ -125,10 +125,10 @@ xps_paint_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_res } static int -xps_find_image_brush_source_part(xps_context_t *ctx, char *base_uri, xps_item_t *root, - xps_part_t **partp, char **profilep) +xps_find_image_brush_source_part(xps_context *ctx, char *base_uri, xps_item *root, + xps_part **partp, char **profilep) { - xps_part_t *part; + xps_part *part; char *image_source_att; char buf[1024]; char partname[1024]; @@ -184,10 +184,10 @@ xps_find_image_brush_source_part(xps_context_t *ctx, char *base_uri, xps_item_t } void -xps_parse_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_image_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *root) { - xps_part_t *part; - xps_image_t *image; + xps_part *part; + xps_image *image; fz_colorspace *colorspace; char *profilename; int code; @@ -200,7 +200,7 @@ xps_parse_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_res return; } - image = xps_alloc(ctx, sizeof(xps_image_t)); + image = xps_alloc(ctx, sizeof(xps_image)); code = xps_decode_image(ctx, part, image); if (code < 0) { @@ -229,7 +229,7 @@ xps_parse_image_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_res } void -xps_free_image(xps_context_t *ctx, xps_image_t *image) +xps_free_image(xps_context *ctx, xps_image *image) { // TODO: refcount image->colorspace if (image->samples) diff --git a/xps/xpsjpeg.c b/xps/xpsjpeg.c index 937ac4f0..f89c2207 100644 --- a/xps/xpsjpeg.c +++ b/xps/xpsjpeg.c @@ -5,7 +5,7 @@ #include int -xps_decode_jpeg(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image) +xps_decode_jpeg(xps_context *ctx, byte *rbuf, int rlen, xps_image *image) { return fz_throw("jpeg not available"); } diff --git a/xps/xpsjxr.c b/xps/xpsjxr.c index f2f78ce0..db0792ae 100644 --- a/xps/xpsjxr.c +++ b/xps/xpsjxr.c @@ -11,7 +11,7 @@ #include "jpegxr.h" -struct state { xps_context_t *ctx; xps_image_t *output; }; +struct state { xps_context *ctx; xps_image *output; }; static const char * jxr_error_string(int code) @@ -67,11 +67,11 @@ scale_bits(int depth, int value) } static void -xps_decode_jpegxr_block(jxr_image_t image, int mx, int my, int *data) +xps_decode_jpegxr_block(jxr_image image, int mx, int my, int *data) { struct state *state = jxr_get_user_data(image); - xps_context_t *ctx = state->ctx; - xps_image_t *output = state->output; + xps_context *ctx = state->ctx; + xps_image *output = state->output; int depth; unsigned char *p; int x, y, k; @@ -117,11 +117,11 @@ xps_decode_jpegxr_block(jxr_image_t image, int mx, int my, int *data) } static void -xps_decode_jpegxr_alpha_block(jxr_image_t image, int mx, int my, int *data) +xps_decode_jpegxr_alpha_block(jxr_image image, int mx, int my, int *data) { struct state *state = jxr_get_user_data(image); - xps_context_t *ctx = state->ctx; - xps_image_t *output = state->output; + xps_context *ctx = state->ctx; + xps_image *output = state->output; int depth; unsigned char *p; int x, y, k; @@ -152,13 +152,13 @@ xps_decode_jpegxr_alpha_block(jxr_image_t image, int mx, int my, int *data) } int -xps_decode_jpegxr(xps_context_t *ctx, byte *buf, int len, xps_image_t *output) +xps_decode_jpegxr(xps_context *ctx, byte *buf, int len, xps_image *output) { FILE *file; char name[gp_file_name_sizeof]; struct state state; - jxr_container_t container; - jxr_image_t image; + jxr_container container; + jxr_image image; int offset, alpha_offset; int rc; @@ -243,7 +243,7 @@ xps_decode_jpegxr(xps_context_t *ctx, byte *buf, int len, xps_image_t *output) } int -xps_jpegxr_has_alpha(xps_context_t *ctx, byte *buf, int len) +xps_jpegxr_has_alpha(xps_context *ctx, byte *buf, int len) { return 1; } @@ -251,13 +251,13 @@ xps_jpegxr_has_alpha(xps_context_t *ctx, byte *buf, int len) #else int -xps_decode_jpegxr(xps_context_t *ctx, byte *buf, int len, xps_image_t *image) +xps_decode_jpegxr(xps_context *ctx, byte *buf, int len, xps_image *image) { return fz_throw("JPEG-XR codec is not available"); } int -xps_jpegxr_has_alpha(xps_context_t *ctx, byte *buf, int len) +xps_jpegxr_has_alpha(xps_context *ctx, byte *buf, int len) { return 0; } diff --git a/xps/xpsmem.c b/xps/xpsmem.c index 3af3b3f6..baae4e80 100644 --- a/xps/xpsmem.c +++ b/xps/xpsmem.c @@ -21,12 +21,12 @@ xps_strcasecmp(char *a, char *b) return xps_tolower(*a) - xps_tolower(*b); } -size_t -xps_strlcpy(char *dst, const char *src, size_t siz) +int +xps_strlcpy(char *dst, const char *src, int size) { register char *d = dst; register const char *s = src; - register int n = siz; + register int n = size; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { @@ -38,7 +38,7 @@ xps_strlcpy(char *dst, const char *src, size_t siz) /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { - if (siz != 0) + if (size != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; @@ -47,19 +47,19 @@ xps_strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } -size_t -xps_strlcat(char *dst, const char *src, size_t siz) +int +xps_strlcat(char *dst, const char *src, int size) { register char *d = dst; register const char *s = src; - register int n = siz; + register int n = size; int dlen; /* Find the end of dst and adjust bytes left but don't go past end */ while (*d != '\0' && n-- != 0) d++; dlen = d - dst; - n = siz - dlen; + n = size - dlen; if (n == 0) return dlen + strlen(s); diff --git a/xps/xpsopacity.c b/xps/xpsopacity.c index 8bab138e..19cb4ce3 100644 --- a/xps/xpsopacity.c +++ b/xps/xpsopacity.c @@ -2,7 +2,7 @@ #include "muxps.h" void -xps_bounds_in_user_space(xps_context_t *ctx, fz_rect *ubox) +xps_bounds_in_user_space(xps_context *ctx, fz_rect *ubox) { #if 0 gx_clip_path *clip_path; @@ -22,8 +22,8 @@ xps_bounds_in_user_space(xps_context_t *ctx, fz_rect *ubox) } void -xps_begin_opacity(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, - char *opacity_att, xps_item_t *opacity_mask_tag) +xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, + char *opacity_att, xps_item *opacity_mask_tag) { fz_rect bbox; float opacity; @@ -57,8 +57,8 @@ return; } void -xps_end_opacity(xps_context_t *ctx, char *base_uri, xps_resource_t *dict, - char *opacity_att, xps_item_t *opacity_mask_tag) +xps_end_opacity(xps_context *ctx, char *base_uri, xps_resource *dict, + char *opacity_att, xps_item *opacity_mask_tag) { if (!opacity_att && !opacity_mask_tag) return; diff --git a/xps/xpspage.c b/xps/xpspage.c index 12547784..aa5a96b4 100644 --- a/xps/xpspage.c +++ b/xps/xpspage.c @@ -2,10 +2,10 @@ #include "muxps.h" void -xps_parse_canvas(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_canvas(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *root) { - xps_resource_t *new_dict = NULL; - xps_item_t *node; + xps_resource *new_dict = NULL; + xps_item *node; char *opacity_mask_uri; int code; @@ -14,9 +14,9 @@ xps_parse_canvas(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource char *opacity_att; char *opacity_mask_att; - xps_item_t *transform_tag = NULL; - xps_item_t *clip_tag = NULL; - xps_item_t *opacity_mask_tag = NULL; + xps_item *transform_tag = NULL; + xps_item *clip_tag = NULL; + xps_item *opacity_mask_tag = NULL; fz_matrix transform; @@ -86,10 +86,10 @@ xps_parse_canvas(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource } void -xps_parse_fixed_page(xps_context_t *ctx, fz_matrix ctm, xps_page_t *page) +xps_parse_fixed_page(xps_context *ctx, fz_matrix ctm, xps_page *page) { - xps_item_t *node; - xps_resource_t *dict; + xps_item *node; + xps_resource *dict; char base_uri[1024]; char *s; int code; @@ -119,10 +119,10 @@ xps_parse_fixed_page(xps_context_t *ctx, fz_matrix ctm, xps_page_t *page) } int -xps_load_fixed_page(xps_context_t *ctx, xps_page_t *page) +xps_load_fixed_page(xps_context *ctx, xps_page *page) { - xps_part_t *part; - xps_item_t *root; + xps_part *part; + xps_item *root; char *width_att; char *height_att; diff --git a/xps/xpspath.c b/xps/xpspath.c index f99db248..c0f45527 100644 --- a/xps/xpspath.c +++ b/xps/xpspath.c @@ -36,7 +36,7 @@ fz_currentpoint(fz_path *path) } void -xps_clip(xps_context_t *ctx, fz_matrix ctm) +xps_clip(xps_context *ctx, fz_matrix ctm) { if (ctx->path) { @@ -57,7 +57,7 @@ xps_clip(xps_context_t *ctx, fz_matrix ctm) } void -xps_fill(xps_context_t *ctx, fz_matrix ctm) +xps_fill(xps_context *ctx, fz_matrix ctm) { ctx->dev->fillpath(ctx->dev->user, ctx->path, ctx->fill_rule == 0, ctm, ctx->colorspace, ctx->color, ctx->alpha); @@ -66,7 +66,7 @@ xps_fill(xps_context_t *ctx, fz_matrix ctm) } static void -xps_stroke(xps_context_t *ctx, fz_matrix ctm, fz_strokestate *stroke) +xps_stroke(xps_context *ctx, fz_matrix ctm, fz_strokestate *stroke) { ctx->dev->strokepath(ctx->dev->user, ctx->path, stroke, ctm, ctx->colorspace, ctx->color, ctx->alpha); @@ -75,7 +75,7 @@ xps_stroke(xps_context_t *ctx, fz_matrix ctm, fz_strokestate *stroke) } static void -xps_clipstroke(xps_context_t *ctx, fz_matrix ctm, fz_strokestate *stroke) +xps_clipstroke(xps_context *ctx, fz_matrix ctm, fz_strokestate *stroke) { ctx->dev->clipstrokepath(ctx->dev->user, ctx->path, stroke, ctm); fz_freepath(ctx->path); @@ -88,7 +88,7 @@ xps_clipstroke(xps_context_t *ctx, fz_matrix ctm, fz_strokestate *stroke) * without transforming the line width. */ static inline void -xps_draw_arc_segment(xps_context_t *ctx, fz_matrix mtx, float th0, float th1, int iscw) +xps_draw_arc_segment(xps_context *ctx, fz_matrix mtx, float th0, float th1, int iscw) { float t, d; fz_point p; @@ -154,7 +154,7 @@ angle_between(const fz_point u, const fz_point v) } static void -xps_draw_arc(xps_context_t *ctx, +xps_draw_arc(xps_context *ctx, float size_x, float size_y, float rotation_angle, int is_large_arc, int is_clockwise, float point_x, float point_y) @@ -266,7 +266,7 @@ xps_draw_arc(xps_context_t *ctx, */ void -xps_parse_abbreviated_geometry(xps_context_t *ctx, char *geom) +xps_parse_abbreviated_geometry(xps_context *ctx, char *geom) { char **args; char **pargs; @@ -489,7 +489,7 @@ xps_parse_abbreviated_geometry(xps_context_t *ctx, char *geom) } static void -xps_parse_arc_segment(xps_context_t *ctx, xps_item_t *root, int stroking, int *skipped_stroke) +xps_parse_arc_segment(xps_context *ctx, xps_item *root, int stroking, int *skipped_stroke) { /* ArcSegment pretty much follows the SVG algorithm for converting an * arc in endpoint representation to an arc in centerpoint @@ -537,7 +537,7 @@ xps_parse_arc_segment(xps_context_t *ctx, xps_item_t *root, int stroking, int *s } static void -xps_parse_poly_quadratic_bezier_segment(xps_context_t *ctx, xps_item_t *root, int stroking, int *skipped_stroke) +xps_parse_poly_quadratic_bezier_segment(xps_context *ctx, xps_item *root, int stroking, int *skipped_stroke) { char *points_att = xps_att(root, "Points"); char *is_stroked_att = xps_att(root, "IsStroked"); @@ -587,7 +587,7 @@ xps_parse_poly_quadratic_bezier_segment(xps_context_t *ctx, xps_item_t *root, in } static void -xps_parse_poly_bezier_segment(xps_context_t *ctx, xps_item_t *root, int stroking, int *skipped_stroke) +xps_parse_poly_bezier_segment(xps_context *ctx, xps_item *root, int stroking, int *skipped_stroke) { char *points_att = xps_att(root, "Points"); char *is_stroked_att = xps_att(root, "IsStroked"); @@ -628,7 +628,7 @@ xps_parse_poly_bezier_segment(xps_context_t *ctx, xps_item_t *root, int stroking } static void -xps_parse_poly_line_segment(xps_context_t *ctx, xps_item_t *root, int stroking, int *skipped_stroke) +xps_parse_poly_line_segment(xps_context *ctx, xps_item *root, int stroking, int *skipped_stroke) { char *points_att = xps_att(root, "Points"); char *is_stroked_att = xps_att(root, "IsStroked"); @@ -662,9 +662,9 @@ xps_parse_poly_line_segment(xps_context_t *ctx, xps_item_t *root, int stroking, } static void -xps_parse_path_figure(xps_context_t *ctx, xps_item_t *root, int stroking) +xps_parse_path_figure(xps_context *ctx, xps_item *root, int stroking) { - xps_item_t *node; + xps_item *node; char *is_closed_att; char *start_point_att; @@ -715,16 +715,16 @@ xps_parse_path_figure(xps_context_t *ctx, xps_item_t *root, int stroking) } void -xps_parse_path_geometry(xps_context_t *ctx, xps_resource_t *dict, xps_item_t *root, int stroking) +xps_parse_path_geometry(xps_context *ctx, xps_resource *dict, xps_item *root, int stroking) { - xps_item_t *node; + xps_item *node; char *figures_att; char *fill_rule_att; char *transform_att; - xps_item_t *transform_tag = NULL; - xps_item_t *figures_tag = NULL; /* only used by resource */ + xps_item *transform_tag = NULL; + xps_item *figures_tag = NULL; /* only used by resource */ fz_matrix transform; @@ -794,9 +794,9 @@ xps_parse_line_cap(char *attr) */ void -xps_parse_path(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *root) { - xps_item_t *node; + xps_item *node; char *fill_uri; char *stroke_uri; @@ -810,12 +810,12 @@ xps_parse_path(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t char *opacity_att; char *opacity_mask_att; - xps_item_t *transform_tag = NULL; - xps_item_t *clip_tag = NULL; - xps_item_t *data_tag = NULL; - xps_item_t *fill_tag = NULL; - xps_item_t *stroke_tag = NULL; - xps_item_t *opacity_mask_tag = NULL; + xps_item *transform_tag = NULL; + xps_item *clip_tag = NULL; + xps_item *data_tag = NULL; + xps_item *fill_tag = NULL; + xps_item *stroke_tag = NULL; + xps_item *opacity_mask_tag = NULL; char *fill_opacity_att = NULL; char *stroke_opacity_att = NULL; diff --git a/xps/xpspng.c b/xps/xpspng.c index c7ed90bc..bfe6f85a 100644 --- a/xps/xpspng.c +++ b/xps/xpspng.c @@ -1,7 +1,7 @@ #include "fitz.h" #include "muxps.h" -#include "png.h" +#include /* * PNG using libpng directly (no gs wrappers) @@ -37,7 +37,7 @@ xps_png_free(png_structp png, png_voidp ptr) /* This only determines if we have an alpha value */ int -xps_png_has_alpha(xps_context_t *ctx, byte *rbuf, int rlen) +xps_png_has_alpha(xps_context *ctx, byte *rbuf, int rlen) { png_structp png; png_infop info; @@ -114,7 +114,7 @@ xps_png_has_alpha(xps_context_t *ctx, byte *rbuf, int rlen) } int -xps_decode_png(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image) +xps_decode_png(xps_context *ctx, byte *rbuf, int rlen, xps_image *image) { png_structp png; png_infop info; diff --git a/xps/xpsresource.c b/xps/xpsresource.c index 399c067a..631b6cb7 100644 --- a/xps/xpsresource.c +++ b/xps/xpsresource.c @@ -1,10 +1,10 @@ #include "fitz.h" #include "muxps.h" -static xps_item_t * -xps_find_resource(xps_context_t *ctx, xps_resource_t *dict, char *name, char **urip) +static xps_item * +xps_find_resource(xps_context *ctx, xps_resource *dict, char *name, char **urip) { - xps_resource_t *head, *node; + xps_resource *head, *node; for (head = dict; head; head = head->parent) { for (node = head; node; node = node->next) @@ -20,8 +20,8 @@ xps_find_resource(xps_context_t *ctx, xps_resource_t *dict, char *name, char **u return NULL; } -static xps_item_t * -xps_parse_resource_reference(xps_context_t *ctx, xps_resource_t *dict, char *att, char **urip) +static xps_item * +xps_parse_resource_reference(xps_context *ctx, xps_resource *dict, char *att, char **urip) { char name[1024]; char *s; @@ -38,12 +38,12 @@ xps_parse_resource_reference(xps_context_t *ctx, xps_resource_t *dict, char *att } void -xps_resolve_resource_reference(xps_context_t *ctx, xps_resource_t *dict, - char **attp, xps_item_t **tagp, char **urip) +xps_resolve_resource_reference(xps_context *ctx, xps_resource *dict, + char **attp, xps_item **tagp, char **urip) { if (*attp) { - xps_item_t *rsrc = xps_parse_resource_reference(ctx, dict, *attp, urip); + xps_item *rsrc = xps_parse_resource_reference(ctx, dict, *attp, urip); if (rsrc) { *attp = NULL; @@ -53,13 +53,13 @@ xps_resolve_resource_reference(xps_context_t *ctx, xps_resource_t *dict, } static int -xps_parse_remote_resource_dictionary(xps_context_t *ctx, xps_resource_t **dictp, char *base_uri, char *source_att) +xps_parse_remote_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base_uri, char *source_att) { char part_name[1024]; char part_uri[1024]; - xps_resource_t *dict; - xps_part_t *part; - xps_item_t *xml; + xps_resource *dict; + xps_part *part; + xps_item *xml; char *s; int code; @@ -107,11 +107,11 @@ xps_parse_remote_resource_dictionary(xps_context_t *ctx, xps_resource_t **dictp, } int -xps_parse_resource_dictionary(xps_context_t *ctx, xps_resource_t **dictp, char *base_uri, xps_item_t *root) +xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base_uri, xps_item *root) { - xps_resource_t *head; - xps_resource_t *entry; - xps_item_t *node; + xps_resource *head; + xps_resource *entry; + xps_item *node; char *source; char *key; int code; @@ -133,7 +133,7 @@ xps_parse_resource_dictionary(xps_context_t *ctx, xps_resource_t **dictp, char * key = xps_att(node, "Key"); if (key) { - entry = xps_alloc(ctx, sizeof(xps_resource_t)); + entry = xps_alloc(ctx, sizeof(xps_resource)); if (!entry) return fz_throw("cannot allocate resource entry"); entry->name = key; @@ -156,9 +156,9 @@ xps_parse_resource_dictionary(xps_context_t *ctx, xps_resource_t **dictp, char * } void -xps_free_resource_dictionary(xps_context_t *ctx, xps_resource_t *dict) +xps_free_resource_dictionary(xps_context *ctx, xps_resource *dict) { - xps_resource_t *next; + xps_resource *next; while (dict) { next = dict->next; @@ -172,7 +172,7 @@ xps_free_resource_dictionary(xps_context_t *ctx, xps_resource_t *dict) } void -xps_debug_resource_dictionary(xps_resource_t *dict) +xps_debug_resource_dictionary(xps_resource *dict) { while (dict) { diff --git a/xps/xpstiff.c b/xps/xpstiff.c index 27e5ac2b..6d6050e6 100644 --- a/xps/xpstiff.c +++ b/xps/xpstiff.c @@ -2,7 +2,7 @@ #include "muxps.h" int -xps_decode_tiff(xps_context_t *ctx, byte *buf, int len, xps_image_t *image) +xps_decode_tiff(xps_context *ctx, byte *buf, int len, xps_image *image) { return fz_throw("TIFF codec is not available"); } @@ -30,7 +30,7 @@ xps_decode_tiff(xps_context_t *ctx, byte *buf, int len, xps_image_t *image) * TODO: RGBPal images */ -typedef struct xps_tiff_s xps_tiff_t; +typedef struct xps_tiff_s xps_tiff; struct xps_tiff_s { @@ -158,7 +158,7 @@ xps_report_error(stream_state * st, const char *str) } static inline int -readbyte(xps_tiff_t *tiff) +readbyte(xps_tiff *tiff) { if (tiff->rp < tiff->ep) return *tiff->rp++; @@ -166,7 +166,7 @@ readbyte(xps_tiff_t *tiff) } static inline unsigned -readshort(xps_tiff_t *tiff) +readshort(xps_tiff *tiff) { unsigned a = readbyte(tiff); unsigned b = readbyte(tiff); @@ -176,7 +176,7 @@ readshort(xps_tiff_t *tiff) } static inline unsigned -readlong(xps_tiff_t *tiff) +readlong(xps_tiff *tiff) { unsigned a = readbyte(tiff); unsigned b = readbyte(tiff); @@ -188,14 +188,14 @@ readlong(xps_tiff_t *tiff) } static int -xps_decode_tiff_uncompressed(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, byte *wp, byte *wl) +xps_decode_tiff_uncompressed(xps_context *ctx, xps_tiff *tiff, byte *rp, byte *rl, byte *wp, byte *wl) { memcpy(wp, rp, wl - wp); return gs_okay; } static int -xps_decode_tiff_packbits(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, byte *wp, byte *wl) +xps_decode_tiff_packbits(xps_context *ctx, xps_tiff *tiff, byte *rp, byte *rl, byte *wp, byte *wl) { stream_RLD_state state; stream_cursor_read scr; @@ -221,7 +221,7 @@ xps_decode_tiff_packbits(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *r } static int -xps_decode_tiff_lzw(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, byte *wp, byte *wl) +xps_decode_tiff_lzw(xps_context *ctx, xps_tiff *tiff, byte *rp, byte *rl, byte *wp, byte *wl) { stream_LZW_state state; stream_cursor_read scr; @@ -267,7 +267,7 @@ xps_decode_tiff_lzw(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, by } static int -xps_decode_tiff_flate(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, byte *wp, byte *wl) +xps_decode_tiff_flate(xps_context *ctx, xps_tiff *tiff, byte *rp, byte *rl, byte *wp, byte *wl) { stream_zlib_state state; stream_cursor_read scr; @@ -298,7 +298,7 @@ xps_decode_tiff_flate(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, } static int -xps_decode_tiff_fax(xps_context_t *ctx, xps_tiff_t *tiff, int comp, byte *rp, byte *rl, byte *wp, byte *wl) +xps_decode_tiff_fax(xps_context *ctx, xps_tiff *tiff, int comp, byte *rp, byte *rl, byte *wp, byte *wl) { stream_CFD_state state; stream_cursor_read scr; @@ -349,7 +349,7 @@ xps_decode_tiff_fax(xps_context_t *ctx, xps_tiff_t *tiff, int comp, byte *rp, by */ static int -xps_decode_tiff_jpeg(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, byte *wp, byte *wl) +xps_decode_tiff_jpeg(xps_context *ctx, xps_tiff *tiff, byte *rp, byte *rl, byte *wp, byte *wl) { stream_DCT_state state; /* used by gs_jpeg_* wrappers */ jpeg_decompress_data jddp; @@ -518,7 +518,7 @@ xps_invert_tiff(byte *line, int width, int comps, int bits, int alpha) } static int -xps_expand_colormap(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image) +xps_expand_colormap(xps_context *ctx, xps_tiff *tiff, xps_image *image) { int maxval = 1 << image->bits; byte *samples; @@ -576,7 +576,7 @@ xps_expand_colormap(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image) } static int -xps_decode_tiff_strips(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image) +xps_decode_tiff_strips(xps_context *ctx, xps_tiff *tiff, xps_image *image) { int error; @@ -773,7 +773,7 @@ xps_decode_tiff_strips(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image) } static void -xps_read_tiff_bytes(unsigned char *p, xps_tiff_t *tiff, unsigned ofs, unsigned n) +xps_read_tiff_bytes(unsigned char *p, xps_tiff *tiff, unsigned ofs, unsigned n) { tiff->rp = tiff->bp + ofs; if (tiff->rp > tiff->ep) @@ -786,7 +786,7 @@ xps_read_tiff_bytes(unsigned char *p, xps_tiff_t *tiff, unsigned ofs, unsigned n } static void -xps_read_tiff_tag_value(unsigned *p, xps_tiff_t *tiff, unsigned type, unsigned ofs, unsigned n) +xps_read_tiff_tag_value(unsigned *p, xps_tiff *tiff, unsigned type, unsigned ofs, unsigned n) { tiff->rp = tiff->bp + ofs; if (tiff->rp > tiff->ep) @@ -810,7 +810,7 @@ xps_read_tiff_tag_value(unsigned *p, xps_tiff_t *tiff, unsigned type, unsigned o } static int -xps_read_tiff_tag(xps_context_t *ctx, xps_tiff_t *tiff, unsigned offset) +xps_read_tiff_tag(xps_context *ctx, xps_tiff *tiff, unsigned offset) { unsigned tag; unsigned type; @@ -949,7 +949,7 @@ xps_swap_byte_order(byte *buf, int n) } static int -xps_decode_tiff_header(xps_context_t *ctx, xps_tiff_t *tiff, byte *buf, int len) +xps_decode_tiff_header(xps_context *ctx, xps_tiff *tiff, byte *buf, int len) { unsigned version; unsigned offset; @@ -957,7 +957,7 @@ xps_decode_tiff_header(xps_context_t *ctx, xps_tiff_t *tiff, byte *buf, int len) unsigned i; int error; - memset(tiff, 0, sizeof(xps_tiff_t)); + memset(tiff, 0, sizeof(xps_tiff)); tiff->bp = buf; tiff->rp = buf; @@ -1015,11 +1015,11 @@ xps_decode_tiff_header(xps_context_t *ctx, xps_tiff_t *tiff, byte *buf, int len) } int -xps_decode_tiff(xps_context_t *ctx, byte *buf, int len, xps_image_t *image) +xps_decode_tiff(xps_context *ctx, byte *buf, int len, xps_image *image) { int error; - xps_tiff_t tiffst; - xps_tiff_t *tiff = &tiffst; + xps_tiff tiffst; + xps_tiff *tiff = &tiffst; error = xps_decode_tiff_header(ctx, tiff, buf, len); if (error) @@ -1063,11 +1063,11 @@ xps_decode_tiff(xps_context_t *ctx, byte *buf, int len, xps_image_t *image) } int -xps_tiff_has_alpha(xps_context_t *ctx, byte *buf, int len) +xps_tiff_has_alpha(xps_context *ctx, byte *buf, int len) { int error; - xps_tiff_t tiffst; - xps_tiff_t *tiff = &tiffst; + xps_tiff tiffst; + xps_tiff *tiff = &tiffst; error = xps_decode_tiff_header(ctx, tiff, buf, len); if (error) diff --git a/xps/xpstile.c b/xps/xpstile.c index 89db1e37..0bfff9b0 100644 --- a/xps/xpstile.c +++ b/xps/xpstile.c @@ -11,14 +11,14 @@ enum { TILE_NONE, TILE_TILE, TILE_FLIP_X, TILE_FLIP_Y, TILE_FLIP_X_Y }; struct closure { char *base_uri; - xps_resource_t *dict; - xps_item_t *root; + xps_resource *dict; + xps_item *root; void *user; - void (*func)(xps_context_t*, fz_matrix, char*, xps_resource_t*, xps_item_t*, void*); + void (*func)(xps_context*, fz_matrix, char*, xps_resource*, xps_item*, void*); }; static void -xps_paint_tiling_brush_clipped(xps_context_t *ctx, fz_matrix ctm, fz_rect viewbox, struct closure *c) +xps_paint_tiling_brush_clipped(xps_context *ctx, fz_matrix ctm, fz_rect viewbox, struct closure *c) { ctx->path = fz_newpath(); fz_moveto(ctx->path, viewbox.x0, viewbox.y0); @@ -34,7 +34,7 @@ xps_paint_tiling_brush_clipped(xps_context_t *ctx, fz_matrix ctm, fz_rect viewbo } static void -xps_paint_tiling_brush(xps_context_t *ctx, fz_matrix ctm, fz_rect viewbox, int tile_mode, struct closure *c) +xps_paint_tiling_brush(xps_context *ctx, fz_matrix ctm, fz_rect viewbox, int tile_mode, struct closure *c) { fz_matrix ttm; @@ -63,11 +63,11 @@ xps_paint_tiling_brush(xps_context_t *ctx, fz_matrix ctm, fz_rect viewbox, int t } void -xps_parse_tiling_brush(xps_context_t *ctx, fz_matrix ctm, - char *base_uri, xps_resource_t *dict, xps_item_t *root, - void (*func)(xps_context_t*, fz_matrix, char*, xps_resource_t*, xps_item_t*, void*), void *user) +xps_parse_tiling_brush(xps_context *ctx, fz_matrix ctm, + char *base_uri, xps_resource *dict, xps_item *root, + void (*func)(xps_context*, fz_matrix, char*, xps_resource*, xps_item*, void*), void *user) { - xps_item_t *node; + xps_item *node; struct closure c; char *opacity_att; @@ -78,7 +78,7 @@ xps_parse_tiling_brush(xps_context_t *ctx, fz_matrix ctm, char *viewbox_units_att; char *viewport_units_att; - xps_item_t *transform_tag = NULL; + xps_item *transform_tag = NULL; fz_matrix transform; fz_rect viewbox; diff --git a/xps/xpstop.c b/xps/xpstop.c index e1a2fe1e..2ae1d585 100644 --- a/xps/xpstop.c +++ b/xps/xpstop.c @@ -83,16 +83,16 @@ static int isrange(char *s) } static void -xps_run_page(xps_context_t *ctx, xps_page_t *page, fz_device *dev, fz_matrix ctm) +xps_run_page(xps_context *ctx, xps_page *page, fz_device *dev, fz_matrix ctm) { ctx->dev = dev; xps_parse_fixed_page(ctx, ctm, page); ctx->dev = nil; } -static void drawpage(xps_context_t *ctx, int pagenum) +static void drawpage(xps_context *ctx, int pagenum) { - xps_page_t *page; + xps_page *page; fz_displaylist *list; fz_device *dev; int start; @@ -241,7 +241,7 @@ static void drawpage(xps_context_t *ctx, int pagenum) } -static void drawrange(xps_context_t *ctx, char *range) +static void drawrange(xps_context *ctx, char *range) { int page, spage, epage; char *spec, *dash; @@ -282,7 +282,7 @@ int main(int argc, char **argv) { int grayscale = 0; int accelerate = 1; - xps_context_t *ctx; + xps_context *ctx; int code; int c; diff --git a/xps/xpsvisual.c b/xps/xpsvisual.c index d9aa5340..82d37691 100644 --- a/xps/xpsvisual.c +++ b/xps/xpsvisual.c @@ -4,20 +4,20 @@ enum { TILE_NONE, TILE_TILE, TILE_FLIP_X, TILE_FLIP_Y, TILE_FLIP_X_Y }; static void -xps_paint_visual_brush(xps_context_t *ctx, fz_matrix ctm, - char *base_uri, xps_resource_t *dict, xps_item_t *root, void *visual_tag) +xps_paint_visual_brush(xps_context *ctx, fz_matrix ctm, + char *base_uri, xps_resource *dict, xps_item *root, void *visual_tag) { - xps_parse_element(ctx, ctm, base_uri, dict, (xps_item_t *)visual_tag); + xps_parse_element(ctx, ctm, base_uri, dict, (xps_item *)visual_tag); } void -xps_parse_visual_brush(xps_context_t *ctx, fz_matrix ctm, char *base_uri, xps_resource_t *dict, xps_item_t *root) +xps_parse_visual_brush(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict, xps_item *root) { - xps_item_t *node; + xps_item *node; char *visual_uri; char *visual_att; - xps_item_t *visual_tag = NULL; + xps_item *visual_tag = NULL; visual_att = xps_att(root, "Visual"); diff --git a/xps/xpsxml.c b/xps/xpsxml.c index 94d1e351..70dbe49d 100644 --- a/xps/xpsxml.c +++ b/xps/xpsxml.c @@ -10,13 +10,13 @@ #define NS_XPS "http://schemas.microsoft.com/xps/2005/06" #define NS_MC "http://schemas.openxmlformats.org/markup-compatibility/2006" -typedef struct xps_parser_s xps_parser_t; +typedef struct xps_parser_s xps_parser; struct xps_parser_s { - xps_context_t *ctx; - xps_item_t *root; - xps_item_t *head; + xps_context *ctx; + xps_item *root; + xps_item *head; char *error; int compat; char *base; /* base of relative URIs */ @@ -26,9 +26,9 @@ struct xps_item_s { char *name; char **atts; - xps_item_t *up; - xps_item_t *down; - xps_item_t *next; + xps_item *up; + xps_item *down; + xps_item *next; }; static char * @@ -43,9 +43,9 @@ skip_namespace(char *s) static void on_open_tag(void *zp, char *ns_name, char **atts) { - xps_parser_t *parser = zp; - xps_item_t *item; - xps_item_t *tail; + xps_parser *parser = zp; + xps_item *item; + xps_item *tail; int namelen; int attslen; int textlen; @@ -92,7 +92,7 @@ on_open_tag(void *zp, char *ns_name, char **atts) textlen += strlen(atts[i]) + 1; } - item = fz_malloc(sizeof(xps_item_t) + attslen + namelen + textlen); + item = fz_malloc(sizeof(xps_item) + attslen + namelen + textlen); if (!item) { parser->error = "out of memory"; @@ -100,9 +100,9 @@ on_open_tag(void *zp, char *ns_name, char **atts) /* copy strings to new memory */ - item->atts = (char**) (((char*)item) + sizeof(xps_item_t)); - item->name = ((char*)item) + sizeof(xps_item_t) + attslen; - p = ((char*)item) + sizeof(xps_item_t) + attslen + namelen; + item->atts = (char**) (((char*)item) + sizeof(xps_item)); + item->name = ((char*)item) + sizeof(xps_item) + attslen; + p = ((char*)item) + sizeof(xps_item) + attslen + namelen; strcpy(item->name, name); for (i = 0; atts[i]; i++) @@ -147,7 +147,7 @@ on_open_tag(void *zp, char *ns_name, char **atts) static void on_close_tag(void *zp, char *name) { - xps_parser_t *parser = zp; + xps_parser *parser = zp; if (parser->error) return; @@ -165,7 +165,7 @@ is_xml_space(int c) static void on_text(void *zp, char *buf, int len) { - xps_parser_t *parser = zp; + xps_parser *parser = zp; char *atts[3]; int i; @@ -197,17 +197,17 @@ on_text(void *zp, char *buf, int len) } } -static xps_item_t * -xps_process_compatibility(xps_context_t *ctx, xps_item_t *root) +static xps_item * +xps_process_compatibility(xps_context *ctx, xps_item *root) { fz_warn("XPS document uses markup compatibility tags"); return root; } -xps_item_t * -xps_parse_xml(xps_context_t *ctx, byte *buf, int len) +xps_item * +xps_parse_xml(xps_context *ctx, byte *buf, int len) { - xps_parser_t parser; + xps_parser parser; XML_Parser xp; int code; @@ -248,26 +248,26 @@ xps_parse_xml(xps_context_t *ctx, byte *buf, int len) return parser.root; } -xps_item_t * -xps_next(xps_item_t *item) +xps_item * +xps_next(xps_item *item) { return item->next; } -xps_item_t * -xps_down(xps_item_t *item) +xps_item * +xps_down(xps_item *item) { return item->down; } char * -xps_tag(xps_item_t *item) +xps_tag(xps_item *item) { return item->name; } char * -xps_att(xps_item_t *item, const char *att) +xps_att(xps_item *item, const char *att) { int i; for (i = 0; item->atts[i]; i += 2) @@ -277,9 +277,9 @@ xps_att(xps_item_t *item, const char *att) } void -xps_free_item(xps_context_t *ctx, xps_item_t *item) +xps_free_item(xps_context *ctx, xps_item *item) { - xps_item_t *next; + xps_item *next; while (item) { next = item->next; @@ -297,7 +297,7 @@ static void indent(int n) } static void -xps_debug_item_imp(xps_item_t *item, int level, int loop) +xps_debug_item_imp(xps_item *item, int level, int loop) { int i; @@ -333,7 +333,7 @@ xps_debug_item_imp(xps_item_t *item, int level, int loop) } void -xps_debug_item(xps_item_t *item, int level) +xps_debug_item(xps_item *item, int level) { xps_debug_item_imp(item, level, 0); } diff --git a/xps/xpszip.c b/xps/xpszip.c index 639134cf..d3c03103 100644 --- a/xps/xpszip.c +++ b/xps/xpszip.c @@ -20,13 +20,13 @@ static inline int getlong(FILE *file) } static void * -xps_zip_alloc_items(xps_context_t *ctx, int items, int size) +xps_zip_alloc_items(xps_context *ctx, int items, int size) { return xps_alloc(ctx, items * size); } static void -xps_zip_free(xps_context_t *ctx, void *ptr) +xps_zip_free(xps_context *ctx, void *ptr) { xps_free(ctx, ptr); } @@ -34,13 +34,13 @@ xps_zip_free(xps_context_t *ctx, void *ptr) static int xps_compare_entries(const void *a0, const void *b0) { - xps_entry_t *a = (xps_entry_t*) a0; - xps_entry_t *b = (xps_entry_t*) b0; + xps_entry *a = (xps_entry*) a0; + xps_entry *b = (xps_entry*) b0; return xps_strcasecmp(a->name, b->name); } -static xps_entry_t * -xps_find_zip_entry(xps_context_t *ctx, char *name) +static xps_entry * +xps_find_zip_entry(xps_context *ctx, char *name) { int l = 0; int r = ctx->zip_count - 1; @@ -63,7 +63,7 @@ xps_find_zip_entry(xps_context_t *ctx, char *name) */ static int -xps_read_zip_entry(xps_context_t *ctx, xps_entry_t *ent, unsigned char *outbuf) +xps_read_zip_entry(xps_context *ctx, xps_entry *ent, unsigned char *outbuf) { z_stream stream; unsigned char *inbuf; @@ -138,7 +138,7 @@ xps_read_zip_entry(xps_context_t *ctx, xps_entry_t *ent, unsigned char *outbuf) */ static int -xps_read_zip_dir(xps_context_t *ctx, int start_offset) +xps_read_zip_dir(xps_context *ctx, int start_offset) { int sig; int offset, count; @@ -159,11 +159,11 @@ xps_read_zip_dir(xps_context_t *ctx, int start_offset) offset = getlong(ctx->file); /* offset to central directory */ ctx->zip_count = count; - ctx->zip_table = xps_alloc(ctx, sizeof(xps_entry_t) * count); + ctx->zip_table = xps_alloc(ctx, sizeof(xps_entry) * count); if (!ctx->zip_table) return fz_throw("cannot allocate zip entry table"); - memset(ctx->zip_table, 0, sizeof(xps_entry_t) * count); + memset(ctx->zip_table, 0, sizeof(xps_entry) * count); fseek(ctx->file, offset, 0); @@ -201,13 +201,13 @@ xps_read_zip_dir(xps_context_t *ctx, int start_offset) fseek(ctx->file, commentsize, 1); } - qsort(ctx->zip_table, count, sizeof(xps_entry_t), xps_compare_entries); + qsort(ctx->zip_table, count, sizeof(xps_entry), xps_compare_entries); return fz_okay; } static int -xps_find_and_read_zip_dir(xps_context_t *ctx) +xps_find_and_read_zip_dir(xps_context *ctx) { int filesize, back, maxback; int i, n; @@ -241,12 +241,12 @@ xps_find_and_read_zip_dir(xps_context_t *ctx) * Read and interleave split parts from a ZIP file. */ -static xps_part_t * -xps_read_zip_part(xps_context_t *ctx, char *partname) +static xps_part * +xps_read_zip_part(xps_context *ctx, char *partname) { char buf[2048]; - xps_entry_t *ent; - xps_part_t *part; + xps_entry *ent; + xps_part *part; int count, size, offset, i; char *name; @@ -306,11 +306,11 @@ xps_read_zip_part(xps_context_t *ctx, char *partname) * Read and interleave split parts from files in the directory. */ -static xps_part_t * -xps_read_dir_part(xps_context_t *ctx, char *name) +static xps_part * +xps_read_dir_part(xps_context *ctx, char *name) { char buf[2048]; - xps_part_t *part; + xps_part *part; FILE *file; int count, size, offset, i, n; @@ -372,8 +372,8 @@ xps_read_dir_part(xps_context_t *ctx, char *name) return NULL; } -xps_part_t * -xps_read_part(xps_context_t *ctx, char *partname) +xps_part * +xps_read_part(xps_context *ctx, char *partname) { if (ctx->directory) return xps_read_dir_part(ctx, partname); @@ -385,9 +385,9 @@ xps_read_part(xps_context_t *ctx, char *partname) */ static int -xps_read_and_process_metadata_part(xps_context_t *ctx, char *name) +xps_read_and_process_metadata_part(xps_context *ctx, char *name) { - xps_part_t *part; + xps_part *part; int code; part = xps_read_part(ctx, name); @@ -408,10 +408,10 @@ xps_read_and_process_metadata_part(xps_context_t *ctx, char *name) */ int -xps_open_file(xps_context_t *ctx, char *filename) +xps_open_file(xps_context *ctx, char *filename) { char buf[2048]; - xps_document_t *doc; + xps_document *doc; int code; char *p; @@ -457,19 +457,19 @@ xps_open_file(xps_context_t *ctx, char *filename) } int -xps_count_pages(xps_context_t *ctx) +xps_count_pages(xps_context *ctx) { - xps_page_t *page; + xps_page *page; int n = 0; for (page = ctx->first_page; page; page = page->next) n ++; return n; } -xps_page_t * -xps_load_page(xps_context_t *ctx, int number) +xps_page * +xps_load_page(xps_context *ctx, int number) { - xps_page_t *page; + xps_page *page; int code; int n = 0; @@ -490,14 +490,14 @@ xps_load_page(xps_context_t *ctx, int number) return nil; } -xps_context_t * +xps_context * xps_new_context(void) { - xps_context_t *ctx; + xps_context *ctx; - ctx = fz_malloc(sizeof(xps_context_t)); + ctx = fz_malloc(sizeof(xps_context)); - memset(ctx, 0, sizeof(xps_context_t)); + memset(ctx, 0, sizeof(xps_context)); ctx->font_table = xps_hash_new(ctx); ctx->colorspace_table = xps_hash_new(ctx); @@ -514,19 +514,19 @@ xps_new_context(void) return ctx; } -static void xps_free_key_func(xps_context_t *ctx, void *ptr) +static void xps_free_key_func(xps_context *ctx, void *ptr) { xps_free(ctx, ptr); } -static void xps_free_font_func(xps_context_t *ctx, void *ptr) +static void xps_free_font_func(xps_context *ctx, void *ptr) { fz_dropfont(ptr); } /* Wrap up interp instance after a "job" */ int -xps_free_context(xps_context_t *ctx) +xps_free_context(xps_context *ctx) { int i; -- cgit v1.2.3