diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-09-21 17:39:55 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-09-21 17:39:55 +0200 |
commit | ba46cad4b09bb957085900a203206c8fa5868cd4 (patch) | |
tree | e97bd846e63c0f496b6aff983ff9c4d14cef82c9 /xps/xps_resource.c | |
parent | f783c31203be2dbd7a28c89557014f97a367bec9 (diff) | |
download | mupdf-ba46cad4b09bb957085900a203206c8fa5868cd4.tar.xz |
Rename xps_context to xps_document.
Diffstat (limited to 'xps/xps_resource.c')
-rw-r--r-- | xps/xps_resource.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/xps/xps_resource.c b/xps/xps_resource.c index 176afd77..4a084b29 100644 --- a/xps/xps_resource.c +++ b/xps/xps_resource.c @@ -2,7 +2,7 @@ #include "muxps.h" static xml_element * -xps_find_resource(xps_context *ctx, xps_resource *dict, char *name, char **urip) +xps_find_resource(xps_document *doc, xps_resource *dict, char *name, char **urip) { xps_resource *head, *node; for (head = dict; head; head = head->parent) @@ -21,7 +21,7 @@ xps_find_resource(xps_context *ctx, xps_resource *dict, char *name, char **urip) } static xml_element * -xps_parse_resource_reference(xps_context *ctx, xps_resource *dict, char *att, char **urip) +xps_parse_resource_reference(xps_document *doc, xps_resource *dict, char *att, char **urip) { char name[1024]; char *s; @@ -34,16 +34,16 @@ xps_parse_resource_reference(xps_context *ctx, xps_resource *dict, char *att, ch if (s) *s = 0; - return xps_find_resource(ctx, dict, name, urip); + return xps_find_resource(doc, dict, name, urip); } void -xps_resolve_resource_reference(xps_context *ctx, xps_resource *dict, +xps_resolve_resource_reference(xps_document *doc, xps_resource *dict, char **attp, xml_element **tagp, char **urip) { if (*attp) { - xml_element *rsrc = xps_parse_resource_reference(ctx, dict, *attp, urip); + xml_element *rsrc = xps_parse_resource_reference(doc, dict, *attp, urip); if (rsrc) { *attp = NULL; @@ -53,7 +53,7 @@ xps_resolve_resource_reference(xps_context *ctx, xps_resource *dict, } static int -xps_parse_remote_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base_uri, char *source_att) +xps_parse_remote_resource_dictionary(xps_document *doc, xps_resource **dictp, char *base_uri, char *source_att) { char part_name[1024]; char part_uri[1024]; @@ -65,23 +65,23 @@ xps_parse_remote_resource_dictionary(xps_context *ctx, xps_resource **dictp, cha /* External resource dictionaries MUST NOT reference other resource dictionaries */ xps_absolute_path(part_name, base_uri, source_att, sizeof part_name); - part = xps_read_part(ctx, part_name); + part = xps_read_part(doc, part_name); if (!part) { return fz_error_make("cannot find remote resource part '%s'", part_name); } - xml = xml_parse_document(ctx->ctx, part->data, part->size); + xml = xml_parse_document(doc->ctx, part->data, part->size); if (!xml) { - xps_free_part(ctx, part); + xps_free_part(doc, part); return fz_error_note(-1, "cannot parse xml"); } if (strcmp(xml_tag(xml), "ResourceDictionary")) { - xml_free_element(ctx->ctx, xml); - xps_free_part(ctx, part); + xml_free_element(doc->ctx, xml); + xps_free_part(doc, part); return fz_error_make("expected ResourceDictionary element (found %s)", xml_tag(xml)); } @@ -90,24 +90,24 @@ xps_parse_remote_resource_dictionary(xps_context *ctx, xps_resource **dictp, cha if (s) s[1] = 0; - code = xps_parse_resource_dictionary(ctx, &dict, part_uri, xml); + code = xps_parse_resource_dictionary(doc, &dict, part_uri, xml); if (code) { - xml_free_element(ctx->ctx, xml); - xps_free_part(ctx, part); + xml_free_element(doc->ctx, xml); + xps_free_part(doc, part); return fz_error_note(code, "cannot parse remote resource dictionary: %s", part_uri); } dict->base_xml = xml; /* pass on ownership */ - xps_free_part(ctx, part); + xps_free_part(doc, part); *dictp = dict; return fz_okay; } int -xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base_uri, xml_element *root) +xps_parse_resource_dictionary(xps_document *doc, xps_resource **dictp, char *base_uri, xml_element *root) { xps_resource *head; xps_resource *entry; @@ -119,7 +119,7 @@ xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base source = xml_att(root, "Source"); if (source) { - code = xps_parse_remote_resource_dictionary(ctx, dictp, base_uri, source); + code = xps_parse_remote_resource_dictionary(doc, dictp, base_uri, source); if (code) return fz_error_note(code, "cannot parse remote resource dictionary"); return fz_okay; @@ -132,7 +132,7 @@ xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base key = xml_att(node, "x:Key"); if (key) { - entry = fz_malloc(ctx->ctx, sizeof(xps_resource)); + entry = fz_malloc(doc->ctx, sizeof(xps_resource)); entry->name = key; entry->base_uri = NULL; entry->base_xml = NULL; @@ -144,7 +144,7 @@ xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base } if (head) - head->base_uri = fz_strdup(ctx->ctx, base_uri); + head->base_uri = fz_strdup(doc->ctx, base_uri); else return fz_error_make("empty resource dictionary"); @@ -153,17 +153,17 @@ xps_parse_resource_dictionary(xps_context *ctx, xps_resource **dictp, char *base } void -xps_free_resource_dictionary(xps_context *ctx, xps_resource *dict) +xps_free_resource_dictionary(xps_document *doc, xps_resource *dict) { xps_resource *next; while (dict) { next = dict->next; if (dict->base_xml) - xml_free_element(ctx->ctx, dict->base_xml); + xml_free_element(doc->ctx, dict->base_xml); if (dict->base_uri) - fz_free(ctx->ctx, dict->base_uri); - fz_free(ctx->ctx, dict); + fz_free(doc->ctx, dict->base_uri); + fz_free(doc->ctx, dict); dict = next; } } |