diff --git a/c14n.c b/c14n.c index ae730441..f1fadf8c 100644 --- a/c14n.c +++ b/c14n.c @@ -134,87 +134,95 @@ static xmlChar *xmlC11NNormalizeString(const xmlChar * input, * Handle a redefinition of memory error */ static void -xmlC14NErrMemory(const char *extra) +xmlC14NErrMemory(void) { - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, - XML_ERR_NO_MEMORY, XML_ERR_ERROR, NULL, 0, extra, - NULL, NULL, 0, 0, - "Memory allocation failed : %s\n", extra); + xmlRaiseMemoryError(NULL, NULL, NULL, XML_FROM_C14N, NULL); +} + +static void +xmlC14NErrFull(xmlC14NCtxPtr ctxt, xmlNodePtr node, int code, const char *str1, + const char *msg, ...) +{ + va_list ap; + int res; + + if (ctxt != NULL) + ctxt->error = code; + + va_start(ap, msg); + res = xmlVRaiseError(NULL, NULL, NULL, ctxt, node, + XML_FROM_C14N, code, XML_ERR_ERROR, NULL, 0, + str1, NULL, NULL, 0, 0, + msg, ap); + va_end(ap); + if (res < 0) + xmlC14NErrMemory(); } /** * xmlC14NErrParam: * @extra: extra information * - * Handle a redefinition of param error + * Handle a param error */ static void -xmlC14NErrParam(const char *extra) +xmlC14NErrParam(xmlC14NCtxPtr ctxt) { - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, - XML_ERR_INTERNAL_ERROR, XML_ERR_ERROR, NULL, 0, extra, - NULL, NULL, 0, 0, - "Invalid parameter : %s\n", extra); + xmlC14NErrFull(ctxt, NULL, XML_ERR_ARGUMENT, NULL, + "Invalid argument\n", NULL); } /** * xmlC14NErrInternal: * @extra: extra information * - * Handle a redefinition of internal error + * Handle an internal error */ static void -xmlC14NErrInternal(const char *extra) +xmlC14NErrInternal(xmlC14NCtxPtr ctxt, const char *extra) { - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, - XML_ERR_INTERNAL_ERROR, XML_ERR_ERROR, NULL, 0, extra, - NULL, NULL, 0, 0, - "Internal error : %s\n", extra); + xmlC14NErrFull(ctxt, NULL, XML_ERR_INTERNAL_ERROR, extra, + "Internal error : %s\n", extra); } /** * xmlC14NErrInvalidNode: * @extra: extra information * - * Handle a redefinition of invalid node error + * Handle an invalid node error */ static void -xmlC14NErrInvalidNode(const char *node_type, const char *extra) +xmlC14NErrInvalidNode(xmlC14NCtxPtr ctxt, const char *node_type, + const char *extra) { - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, - XML_C14N_INVALID_NODE, XML_ERR_ERROR, NULL, 0, extra, - NULL, NULL, 0, 0, - "Node %s is invalid here : %s\n", node_type, extra); + xmlC14NErrFull(ctxt, NULL, XML_C14N_INVALID_NODE, extra, + "Node %s is invalid here : %s\n", node_type, extra); } /** * xmlC14NErrUnknownNode: * @extra: extra information * - * Handle a redefinition of unknown node error + * Handle an unknown node error */ static void -xmlC14NErrUnknownNode(int node_type, const char *extra) +xmlC14NErrUnknownNode(xmlC14NCtxPtr ctxt, int node_type, const char *extra) { - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, - XML_C14N_UNKNOW_NODE, XML_ERR_ERROR, NULL, 0, extra, - NULL, NULL, 0, 0, - "Unknown node type %d found : %s\n", node_type, extra); + xmlC14NErrFull(ctxt, NULL, XML_C14N_UNKNOW_NODE, extra, + "Unknown node type %d found : %s\n", node_type, extra); } /** * xmlC14NErrRelativeNamespace: * @extra: extra information * - * Handle a redefinition of relative namespace error + * Handle a relative namespace error */ static void -xmlC14NErrRelativeNamespace(const char *ns_uri) +xmlC14NErrRelativeNamespace(xmlC14NCtxPtr ctxt, const char *ns_uri) { - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, - XML_C14N_RELATIVE_NAMESPACE, XML_ERR_ERROR, NULL, 0, NULL, - NULL, NULL, 0, 0, - "Relative namespace UR is invalid here : %s\n", ns_uri); + xmlC14NErrFull(ctxt, NULL, XML_C14N_RELATIVE_NAMESPACE, ns_uri, + "Relative namespace UR is invalid here : %s\n", ns_uri); } @@ -227,18 +235,13 @@ xmlC14NErrRelativeNamespace(const char *ns_uri) * @msg: the message * @extra: extra information * - * Handle a redefinition of attribute error + * Handle an error */ static void xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error, const char * msg) { - if (ctxt != NULL) - ctxt->error = error; - __xmlRaiseError(NULL, NULL, NULL, - ctxt, node, XML_FROM_C14N, error, - XML_ERR_ERROR, NULL, 0, - NULL, NULL, NULL, 0, 0, "%s", msg); + xmlC14NErrFull(ctxt, node, error, NULL, "%s", msg); } /************************************************************************ @@ -282,7 +285,7 @@ xmlC14NVisibleNsStackCreate(void) { ret = (xmlC14NVisibleNsStackPtr) xmlMalloc(sizeof(xmlC14NVisibleNsStack)); if (ret == NULL) { - xmlC14NErrMemory("creating namespaces stack"); + xmlC14NErrMemory(); return(NULL); } memset(ret, 0, sizeof(xmlC14NVisibleNsStack)); @@ -292,7 +295,7 @@ xmlC14NVisibleNsStackCreate(void) { static void xmlC14NVisibleNsStackDestroy(xmlC14NVisibleNsStackPtr cur) { if(cur == NULL) { - xmlC14NErrParam("destroying namespaces stack"); + xmlC14NErrParam(NULL); return; } if(cur->nsTab != NULL) { @@ -313,7 +316,7 @@ xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr n if((cur == NULL) || ((cur->nsTab == NULL) && (cur->nodeTab != NULL)) || ((cur->nsTab != NULL) && (cur->nodeTab == NULL))) { - xmlC14NErrParam("adding namespace to stack"); + xmlC14NErrParam(NULL); return; } @@ -321,7 +324,7 @@ xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr n cur->nsTab = (xmlNsPtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr)); cur->nodeTab = (xmlNodePtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr)); if ((cur->nsTab == NULL) || (cur->nodeTab == NULL)) { - xmlC14NErrMemory("adding node to stack"); + xmlC14NErrMemory(); return; } memset(cur->nsTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr)); @@ -334,14 +337,14 @@ xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr n tmpSize = 2 * cur->nsMax; tmp = xmlRealloc(cur->nsTab, tmpSize * sizeof(xmlNsPtr)); if (tmp == NULL) { - xmlC14NErrMemory("adding node to stack"); + xmlC14NErrMemory(); return; } cur->nsTab = (xmlNsPtr*)tmp; tmp = xmlRealloc(cur->nodeTab, tmpSize * sizeof(xmlNodePtr)); if (tmp == NULL) { - xmlC14NErrMemory("adding node to stack"); + xmlC14NErrMemory(); return; } cur->nodeTab = (xmlNodePtr*)tmp; @@ -357,7 +360,7 @@ xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr n static void xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) { if((cur == NULL) || (state == NULL)) { - xmlC14NErrParam("saving namespaces stack"); + xmlC14NErrParam(NULL); return; } @@ -369,7 +372,7 @@ xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr static void xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) { if((cur == NULL) || (state == NULL)) { - xmlC14NErrParam("restoring namespaces stack"); + xmlC14NErrParam(NULL); return; } cur->nsCurEnd = state->nsCurEnd; @@ -380,7 +383,7 @@ xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStack static void xmlC14NVisibleNsStackShift(xmlC14NVisibleNsStackPtr cur) { if(cur == NULL) { - xmlC14NErrParam("shifting namespaces stack"); + xmlC14NErrParam(NULL); return; } cur->nsPrevStart = cur->nsPrevEnd; @@ -416,7 +419,7 @@ xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns) int has_empty_ns; if(cur == NULL) { - xmlC14NErrParam("searching namespaces stack (c14n)"); + xmlC14NErrParam(NULL); return (0); } @@ -449,7 +452,7 @@ xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NC int has_empty_ns; if(cur == NULL) { - xmlC14NErrParam("searching namespaces stack (exc c14n)"); + xmlC14NErrParam(ctx); return (0); } @@ -540,7 +543,7 @@ xmlC14NPrintNamespaces(const xmlNs *ns, xmlC14NCtxPtr ctx) { if ((ns == NULL) || (ctx == NULL)) { - xmlC14NErrParam("writing namespaces"); + xmlC14NErrParam(ctx); return 0; } @@ -613,7 +616,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) int has_empty_ns = 0; if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { - xmlC14NErrParam("processing namespaces axis (c14n)"); + xmlC14NErrParam(ctx); return (-1); } @@ -622,7 +625,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) */ list = xmlListCreate(NULL, xmlC14NNsCompare); if (list == NULL) { - xmlC14NErrInternal("creating namespaces list (c14n)"); + xmlC14NErrInternal(ctx, "creating namespaces list (c14n)"); return (-1); } @@ -720,12 +723,12 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) int has_empty_ns_in_inclusive_list = 0; if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { - xmlC14NErrParam("processing namespaces axis (exc c14n)"); + xmlC14NErrParam(ctx); return (-1); } if(!xmlC14NIsExclusive(ctx)) { - xmlC14NErrParam("processing namespaces axis (exc c14n)"); + xmlC14NErrParam(ctx); return (-1); } @@ -735,7 +738,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) */ list = xmlListCreate(NULL, xmlC14NNsCompare); if (list == NULL) { - xmlC14NErrInternal("creating namespaces list (exc c14n)"); + xmlC14NErrInternal(ctx, "creating namespaces list (exc c14n)"); return (-1); } @@ -946,7 +949,7 @@ xmlC14NPrintAttrs(const void *data, void *user) xmlChar *buffer; if ((attr == NULL) || (ctx == NULL)) { - xmlC14NErrParam("writing attributes"); + xmlC14NErrParam(ctx); return (0); } @@ -968,7 +971,7 @@ xmlC14NPrintAttrs(const void *data, void *user) xmlOutputBufferWriteString(ctx->buf, (const char *) buffer); xmlFree(buffer); } else { - xmlC14NErrInternal("normalizing attributes axis"); + xmlC14NErrInternal(ctx, "normalizing attributes axis"); return (0); } } @@ -1017,14 +1020,14 @@ xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr) int tmp_str_len; if ((ctx == NULL) || (xml_base_attr == NULL) || (xml_base_attr->parent == NULL)) { - xmlC14NErrParam("processing xml:base attribute"); + xmlC14NErrParam(ctx); return (NULL); } /* start from current value */ res = xmlNodeListGetString(ctx->doc, xml_base_attr->children, 1); if(res == NULL) { - xmlC14NErrInternal("processing xml:base attribute - can't get attr value"); + xmlC14NErrInternal(ctx, "processing xml:base attribute - can't get attr value"); return (NULL); } @@ -1038,7 +1041,7 @@ xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr) if(tmp_str == NULL) { xmlFree(res); - xmlC14NErrInternal("processing xml:base attribute - can't get attr value"); + xmlC14NErrInternal(ctx, "processing xml:base attribute - can't get attr value"); return (NULL); } @@ -1051,7 +1054,7 @@ xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr) xmlFree(tmp_str); xmlFree(res); - xmlC14NErrInternal("processing xml:base attribute - can't modify uri"); + xmlC14NErrInternal(ctx, "processing xml:base attribute - can't modify uri"); return (NULL); } @@ -1064,7 +1067,7 @@ xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr) xmlFree(tmp_str); xmlFree(res); - xmlC14NErrInternal("processing xml:base attribute - can't construct uri"); + xmlC14NErrInternal(ctx, "processing xml:base attribute - can't construct uri"); return (NULL); } @@ -1089,7 +1092,7 @@ xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr) if(attr == NULL) { xmlFree(res); - xmlC14NErrInternal("processing xml:base attribute - can't construct attribute"); + xmlC14NErrInternal(ctx, "processing xml:base attribute - can't construct attribute"); return (NULL); } @@ -1144,7 +1147,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible) xmlAttrPtr xml_space_attr = NULL; if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { - xmlC14NErrParam("processing attributes axis"); + xmlC14NErrParam(ctx); return (-1); } @@ -1153,7 +1156,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible) */ list = xmlListCreate(NULL, xmlC14NAttrsCompare); if (list == NULL) { - xmlC14NErrInternal("creating attributes list"); + xmlC14NErrInternal(ctx, "creating attributes list"); return (-1); } @@ -1365,7 +1368,7 @@ xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur) xmlNsPtr ns; if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { - xmlC14NErrParam("checking for relative namespaces"); + xmlC14NErrParam(ctx); return (-1); } @@ -1376,11 +1379,11 @@ xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur) uri = xmlParseURI((const char *) ns->href); if (uri == NULL) { - xmlC14NErrInternal("parsing namespace uri"); + xmlC14NErrInternal(ctx, "parsing namespace uri"); return (-1); } if (xmlStrlen((const xmlChar *) uri->scheme) == 0) { - xmlC14NErrRelativeNamespace(uri->scheme); + xmlC14NErrRelativeNamespace(ctx, uri->scheme); xmlFreeURI(uri); return (-1); } @@ -1422,7 +1425,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) int parent_is_doc = 0; if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { - xmlC14NErrParam("processing element node"); + xmlC14NErrParam(ctx); return (-1); } @@ -1432,7 +1435,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) * failure on documents containing relative namespace URIs. */ if (xmlC14NCheckForRelativeNamespaces(ctx, cur) < 0) { - xmlC14NErrInternal("checking for relative namespaces"); + xmlC14NErrInternal(ctx, "checking for relative namespaces"); return (-1); } @@ -1466,7 +1469,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible); } if (ret < 0) { - xmlC14NErrInternal("processing namespaces axis"); + xmlC14NErrInternal(ctx, "processing namespaces axis"); return (-1); } /* todo: shouldn't this go to "visible only"? */ @@ -1476,7 +1479,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) ret = xmlC14NProcessAttrsAxis(ctx, cur, visible); if (ret < 0) { - xmlC14NErrInternal("processing attributes axis"); + xmlC14NErrInternal(ctx, "processing attributes axis"); return (-1); } @@ -1486,7 +1489,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) if (cur->children != NULL) { ret = xmlC14NProcessNodeList(ctx, cur->children); if (ret < 0) { - xmlC14NErrInternal("processing childrens list"); + xmlC14NErrInternal(ctx, "processing childrens list"); return (-1); } } @@ -1529,7 +1532,7 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) int visible; if ((ctx == NULL) || (cur == NULL)) { - xmlC14NErrParam("processing node"); + xmlC14NErrParam(ctx); return (-1); } @@ -1558,7 +1561,7 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) (const char *) buffer); xmlFree(buffer); } else { - xmlC14NErrInternal("normalizing text node"); + xmlC14NErrInternal(ctx, "normalizing text node"); return (-1); } } @@ -1597,7 +1600,7 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) (const char *) buffer); xmlFree(buffer); } else { - xmlC14NErrInternal("normalizing pi node"); + xmlC14NErrInternal(ctx, "normalizing pi node"); return (-1); } } @@ -1642,7 +1645,7 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) (const char *) buffer); xmlFree(buffer); } else { - xmlC14NErrInternal("normalizing comment node"); + xmlC14NErrInternal(ctx, "normalizing comment node"); return (-1); } } @@ -1667,16 +1670,16 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) break; case XML_ATTRIBUTE_NODE: - xmlC14NErrInvalidNode("XML_ATTRIBUTE_NODE", "processing node"); + xmlC14NErrInvalidNode(ctx, "XML_ATTRIBUTE_NODE", "processing node"); return (-1); case XML_NAMESPACE_DECL: - xmlC14NErrInvalidNode("XML_NAMESPACE_DECL", "processing node"); + xmlC14NErrInvalidNode(ctx, "XML_NAMESPACE_DECL", "processing node"); return (-1); case XML_ENTITY_REF_NODE: - xmlC14NErrInvalidNode("XML_ENTITY_REF_NODE", "processing node"); + xmlC14NErrInvalidNode(ctx, "XML_ENTITY_REF_NODE", "processing node"); return (-1); case XML_ENTITY_NODE: - xmlC14NErrInvalidNode("XML_ENTITY_NODE", "processing node"); + xmlC14NErrInvalidNode(ctx, "XML_ENTITY_NODE", "processing node"); return (-1); case XML_DOCUMENT_TYPE_NODE: @@ -1694,7 +1697,7 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) */ break; default: - xmlC14NErrUnknownNode(cur->type, "processing node"); + xmlC14NErrUnknownNode(ctx, cur->type, "processing node"); return (-1); } @@ -1716,7 +1719,7 @@ xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur) int ret; if (ctx == NULL) { - xmlC14NErrParam("processing node list"); + xmlC14NErrParam(ctx); return (-1); } @@ -1738,7 +1741,7 @@ static void xmlC14NFreeCtx(xmlC14NCtxPtr ctx) { if (ctx == NULL) { - xmlC14NErrParam("freeing context"); + xmlC14NErrParam(ctx); return; } @@ -1778,7 +1781,7 @@ xmlC14NNewCtx(xmlDocPtr doc, xmlC14NCtxPtr ctx = NULL; if ((doc == NULL) || (buf == NULL)) { - xmlC14NErrParam("creating new context"); + xmlC14NErrParam(ctx); return (NULL); } @@ -1796,7 +1799,7 @@ xmlC14NNewCtx(xmlDocPtr doc, */ ctx = (xmlC14NCtxPtr) xmlMalloc(sizeof(xmlC14NCtx)); if (ctx == NULL) { - xmlC14NErrMemory("creating context"); + xmlC14NErrMemory(); return (NULL); } memset(ctx, 0, sizeof(xmlC14NCtx)); @@ -1828,6 +1831,7 @@ xmlC14NNewCtx(xmlDocPtr doc, if(xmlC14NIsExclusive(ctx)) { ctx->inclusive_ns_prefixes = inclusive_ns_prefixes; } + return (ctx); } @@ -1864,7 +1868,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, int ret; if ((buf == NULL) || (doc == NULL)) { - xmlC14NErrParam("executing c14n"); + xmlC14NErrParam(NULL); return (-1); } @@ -1877,7 +1881,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, c14n_mode = (xmlC14NMode)mode; break; default: - xmlC14NErrParam("invalid mode for executing c14n"); + xmlC14NErrParam(NULL); return (-1); } @@ -1912,7 +1916,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, if (doc->children != NULL) { ret = xmlC14NProcessNodeList(ctx, doc->children); if (ret < 0) { - xmlC14NErrInternal("processing docs children list"); + xmlC14NErrInternal(ctx, "processing docs children list"); xmlC14NFreeCtx(ctx); return (-1); } @@ -1923,7 +1927,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, */ ret = xmlOutputBufferFlush(buf); if (ret < 0) { - xmlC14NErrInternal("flushing output buffer"); + xmlC14NErrInternal(ctx, "flushing output buffer"); xmlC14NFreeCtx(ctx); return (-1); } @@ -2000,7 +2004,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlOutputBufferPtr buf; if (doc_txt_ptr == NULL) { - xmlC14NErrParam("dumping doc to memory"); + xmlC14NErrParam(NULL); return (-1); } @@ -2011,7 +2015,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, */ buf = xmlAllocOutputBuffer(NULL); if (buf == NULL) { - xmlC14NErrMemory("creating output buffer"); + xmlC14NErrMemory(); return (-1); } @@ -2021,7 +2025,6 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); if (ret < 0) { - xmlC14NErrInternal("saving doc to output buffer"); (void) xmlOutputBufferClose(buf); return (-1); } @@ -2033,7 +2036,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, (void) xmlOutputBufferClose(buf); if ((*doc_txt_ptr == NULL) && (ret >= 0)) { - xmlC14NErrMemory("copying canonicalized document"); + xmlC14NErrMemory(); return (-1); } return (ret); @@ -2071,7 +2074,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, int ret; if (filename == NULL) { - xmlC14NErrParam("saving doc"); + xmlC14NErrParam(NULL); return (-1); } #ifdef LIBXML_ZLIB_ENABLED @@ -2084,7 +2087,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, */ buf = xmlOutputBufferCreateFilename(filename, NULL, compression); if (buf == NULL) { - xmlC14NErrInternal("creating temporary filename"); + xmlC14NErrInternal(NULL, "creating temporary filename"); return (-1); } @@ -2094,7 +2097,6 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); if (ret < 0) { - xmlC14NErrInternal("canonize document to buffer"); (void) xmlOutputBufferClose(buf); return (-1); } @@ -2116,7 +2118,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, buffer = (xmlChar *) \ xmlRealloc(buffer, buffer_size); \ if (buffer == NULL) { \ - xmlC14NErrMemory("growing buffer"); \ + xmlC14NErrMemory(); \ return(NULL); \ } \ } @@ -2151,7 +2153,7 @@ xmlC11NNormalizeString(const xmlChar * input, buffer_size = 1000; buffer = (xmlChar *) xmlMallocAtomic(buffer_size); if (buffer == NULL) { - xmlC14NErrMemory("allocating buffer"); + xmlC14NErrMemory(); return (NULL); } out = buffer;