From 126c3993d2ad55db2abfe80e3d671bf584e7b13b Mon Sep 17 00:00:00 2001 From: akirilov Date: Fri, 1 Jun 2018 13:46:04 -0700 Subject: RESTRICT AUTOMERGE: Update libxml2 to 2.9.8 Merge to pi-dev and restore Android.mk Bug: 79662501 Bug: 36809766 Bug: 36810305 Bug: 62151041 Test: manually verify functionality for regression Change-Id: Ife351c91c932eb92992656f8ea5c08724a220306 (cherry picked from commit 4e91cfdbb1a8624e5cd5a850d6e17da11d1e34a8) --- tree.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'tree.c') diff --git a/tree.c b/tree.c index 9d330b85..959421bd 100644 --- a/tree.c +++ b/tree.c @@ -10,10 +10,16 @@ * */ +/* To avoid EBCDIC trouble when parsing on zOS */ +#if defined(__MVS__) +#pragma convert("ISO8859-1") +#endif + #define IN_LIBXML #include "libxml.h" #include /* for memset() only ! */ +#include #include #ifdef HAVE_CTYPE_H #include @@ -21,7 +27,7 @@ #ifdef HAVE_STDLIB_H #include #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include #endif @@ -254,10 +260,10 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix, * * [NS 7] LocalPart ::= NCName * - * Returns NULL if not a QName, otherwise the local part, and prefix - * is updated to get the Prefix if any. + * Returns NULL if the name doesn't have a prefix. Otherwise, returns the + * local part, and prefix is updated to get the Prefix. Both the return value + * and the prefix must be freed by the caller. */ - xmlChar * xmlSplitQName2(const xmlChar *name, xmlChar **prefix) { int len = 0; @@ -1401,6 +1407,8 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) { else if ((ent != NULL) && (ent->children == NULL)) { xmlNodePtr temp; + /* Set to non-NULL value to avoid recursion. */ + ent->children = (xmlNodePtr) -1; ent->children = xmlStringGetNodeList(doc, (const xmlChar*)node->content); ent->owner = 1; @@ -1593,6 +1601,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) { else if ((ent != NULL) && (ent->children == NULL)) { xmlNodePtr temp; + /* Set to non-NULL value to avoid recursion. */ ent->children = (xmlNodePtr) -1; ent->children = xmlStringGetNodeList(doc, (const xmlChar*)node->content); @@ -1600,6 +1609,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) { temp = ent->children; while (temp) { temp->parent = (xmlNodePtr)ent; + ent->last = temp; temp = temp->next; } } @@ -4596,7 +4606,7 @@ xmlGetLineNoInternal(const xmlNode *node, int depth) (node->type == XML_PI_NODE)) { if (node->line == 65535) { if ((node->type == XML_TEXT_NODE) && (node->psvi != NULL)) - result = (long) node->psvi; + result = (long) (ptrdiff_t) node->psvi; else if ((node->type == XML_ELEMENT_NODE) && (node->children != NULL)) result = xmlGetLineNoInternal(node->children, depth + 1); @@ -4755,8 +4765,8 @@ xmlGetNodePath(const xmlNode *node) if (occur == 0) { tmp = cur->next; while (tmp != NULL && occur == 0) { - if (tmp->type == XML_COMMENT_NODE) - occur++; + if (tmp->type == XML_COMMENT_NODE) + occur++; tmp = tmp->next; } if (occur != 0) @@ -8249,7 +8259,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, ns = ns->next; } while (ns != NULL); } - /* No break on purpose. */ + /* Falls through. */ case XML_ATTRIBUTE_NODE: if (node->ns != NULL) { /* @@ -8840,7 +8850,7 @@ next_ns_decl: } if (! adoptns) goto ns_end; - /* No break on purpose. */ + /* Falls through. */ case XML_ATTRIBUTE_NODE: /* No ns, no fun. */ if (cur->ns == NULL) @@ -9121,7 +9131,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, goto internal_error; } } - /* No break on purpose. */ + /* Falls through. */ case XML_ATTRIBUTE_NODE: /* No namespace, no fun. */ if (cur->ns == NULL) -- cgit v1.2.3