aboutsummaryrefslogtreecommitdiffstats
path: root/c14n.c
diff options
context:
space:
mode:
Diffstat (limited to 'c14n.c')
-rw-r--r--c14n.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/c14n.c b/c14n.c
index ca77f922..c04ce666 100644
--- a/c14n.c
+++ b/c14n.c
@@ -89,7 +89,7 @@ static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
xmlNsPtr ns,
xmlC14NCtxPtr ctx);
-static int xmlC14NIsNodeInNodeset (xmlNodeSetPtr nodes,
+static int xmlC14NIsNodeInNodeset (void *user_data,
xmlNodePtr node,
xmlNodePtr parent);
@@ -252,7 +252,8 @@ xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error,
#define XML_NAMESPACES_DEFAULT 16
static int
-xmlC14NIsNodeInNodeset(xmlNodeSetPtr nodes, xmlNodePtr node, xmlNodePtr parent) {
+xmlC14NIsNodeInNodeset(void *user_data, xmlNodePtr node, xmlNodePtr parent) {
+ xmlNodeSetPtr nodes = (xmlNodeSetPtr) user_data;
if((nodes != NULL) && (node != NULL)) {
if(node->type != XML_NAMESPACE_DECL) {
return(xmlXPathNodeSetContains(nodes, node));
@@ -513,8 +514,10 @@ xmlC14NIsXmlNs(xmlNsPtr ns)
* Returns -1 if ns1 < ns2, 0 if ns1 == ns2 or 1 if ns1 > ns2.
*/
static int
-xmlC14NNsCompare(xmlNsPtr ns1, xmlNsPtr ns2)
+xmlC14NNsCompare(const void *data1, const void *data2)
{
+ const xmlNsPtr ns1 = (const xmlNsPtr) data1;
+ const xmlNsPtr ns2 = (const xmlNsPtr) data2;
if (ns1 == ns2)
return (0);
if (ns1 == NULL)
@@ -559,6 +562,11 @@ xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx)
return (1);
}
+static int
+xmlC14NPrintNamespacesWalker(const void *ns, void *ctx) {
+ return xmlC14NPrintNamespaces((const xmlNsPtr) ns, (xmlC14NCtxPtr) ctx);
+}
+
/**
* xmlC14NProcessNamespacesAxis:
* @ctx: the C14N context
@@ -615,7 +623,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
/*
* Create a sorted list to store element namespaces
*/
- list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare);
+ list = xmlListCreate(NULL, xmlC14NNsCompare);
if (list == NULL) {
xmlC14NErrInternal("creating namespaces list (c14n)");
return (-1);
@@ -663,7 +671,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
/*
* print out all elements from list
*/
- xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx);
+ xmlListWalk(list, xmlC14NPrintNamespacesWalker, (void *) ctx);
/*
* Cleanup
@@ -728,7 +736,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
/*
* Create a sorted list to store element namespaces
*/
- list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare);
+ list = xmlListCreate(NULL, xmlC14NNsCompare);
if (list == NULL) {
xmlC14NErrInternal("creating namespaces list (exc c14n)");
return (-1);
@@ -840,7 +848,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
/*
* print out all elements from list
*/
- xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx);
+ xmlListWalk(list, xmlC14NPrintNamespacesWalker, (void *) ctx);
/*
* Cleanup
@@ -879,8 +887,10 @@ xmlC14NIsXmlAttr(xmlAttrPtr attr)
* Returns -1 if attr1 < attr2, 0 if attr1 == attr2 or 1 if attr1 > attr2.
*/
static int
-xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2)
+xmlC14NAttrsCompare(const void *data1, const void *data2)
{
+ const xmlAttrPtr attr1 = (const xmlAttrPtr) data1;
+ const xmlAttrPtr attr2 = (const xmlAttrPtr) data2;
int ret = 0;
/*
@@ -931,8 +941,10 @@ xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2)
* Returns 1 on success or 0 on fail.
*/
static int
-xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx)
+xmlC14NPrintAttrs(const void *data, void *user)
{
+ const xmlAttrPtr attr = (const xmlAttrPtr) data;
+ xmlC14NCtxPtr ctx = (xmlC14NCtxPtr) user;
xmlChar *value;
xmlChar *buffer;
@@ -1142,7 +1154,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
/*
* Create a sorted list to store element attributes
*/
- list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NAttrsCompare);
+ list = xmlListCreate(NULL, xmlC14NAttrsCompare);
if (list == NULL) {
xmlC14NErrInternal("creating attributes list");
return (-1);
@@ -1331,7 +1343,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
/*
* print out all elements from list
*/
- xmlListWalk(list, (xmlListWalker) xmlC14NPrintAttrs, (const void *) ctx);
+ xmlListWalk(list, xmlC14NPrintAttrs, (void *) ctx);
/*
* Cleanup
@@ -1375,13 +1387,6 @@ xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur)
xmlFreeURI(uri);
return (-1);
}
- if ((xmlStrcasecmp((const xmlChar *) uri->scheme, BAD_CAST "urn") != 0)
- && (xmlStrcasecmp((const xmlChar *) uri->scheme, BAD_CAST "dav") !=0)
- && (xmlStrlen((const xmlChar *) uri->server) == 0)) {
- xmlC14NErrRelativeNamespace(uri->scheme);
- xmlFreeURI(uri);
- return (-1);
- }
xmlFreeURI(uri);
}
ns = ns->next;
@@ -1971,7 +1976,7 @@ xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes,
int mode, xmlChar ** inclusive_ns_prefixes,
int with_comments, xmlOutputBufferPtr buf) {
return(xmlC14NExecute(doc,
- (xmlC14NIsVisibleCallback)xmlC14NIsNodeInNodeset,
+ xmlC14NIsNodeInNodeset,
nodes,
mode,
inclusive_ns_prefixes,
@@ -2084,7 +2089,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
xmlC14NErrParam("saving doc");
return (-1);
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (compression < 0)
compression = xmlGetCompressMode();
#endif