diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2008-08-25 08:57:48 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2008-08-25 08:57:48 +0000 |
commit | f4f4e4853a925905deb77a72a3311ab683fbeeb5 (patch) | |
tree | 5c77be8c2160e7de1bc2e170af9d3cd7bd3f618d | |
parent | 4bf899bf1b719d692be407b89f6610103f13bd5d (diff) | |
download | android_external_libxml2-f4f4e4853a925905deb77a72a3311ab683fbeeb5.tar.gz android_external_libxml2-f4f4e4853a925905deb77a72a3311ab683fbeeb5.tar.bz2 android_external_libxml2-f4f4e4853a925905deb77a72a3311ab683fbeeb5.zip |
rework the patch to avoid some ABI issue with people allocating entities
* include/libxml/entities.h entities.c SAX2.c parser.c: rework
the patch to avoid some ABI issue with people allocating
entities structure directly
Daniel
svn path=/trunk/; revision=3773
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | SAX2.c | 3 | ||||
-rw-r--r-- | entities.c | 10 | ||||
-rw-r--r-- | include/libxml/entities.h | 1 | ||||
-rw-r--r-- | parser.c | 17 |
5 files changed, 22 insertions, 15 deletions
@@ -1,3 +1,9 @@ +Mon Aug 25 10:56:30 CEST 2008 Daniel Veillard <daniel@veillard.com> + + * include/libxml/entities.h entities.c SAX2.c parser.c: rework + the patch to avoid some ABI issue with people allocating + entities structure directly + Wed Aug 20 19:02:01 CEST 2008 Daniel Veillard <daniel@veillard.com> * include/libxml/parser.h include/libxml/entities.h entities.c @@ -580,7 +580,8 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) return(NULL); } ret->owner = 1; - ret->checked = 1; + if (ret->checked == 0) + ret->checked = 1; } return(ret); } @@ -31,35 +31,35 @@ static xmlEntity xmlEntityLt = { NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "<", BAD_CAST "<", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityGt = { NULL, XML_ENTITY_DECL, BAD_CAST "gt", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST ">", BAD_CAST ">", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityAmp = { NULL, XML_ENTITY_DECL, BAD_CAST "amp", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "&", BAD_CAST "&", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityQuot = { NULL, XML_ENTITY_DECL, BAD_CAST "quot", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "\"", BAD_CAST "\"", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityApos = { NULL, XML_ENTITY_DECL, BAD_CAST "apos", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "'", BAD_CAST "'", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1, 0 + NULL, NULL, NULL, NULL, 0, 1 }; /** diff --git a/include/libxml/entities.h b/include/libxml/entities.h index d464cecb..fdd72225 100644 --- a/include/libxml/entities.h +++ b/include/libxml/entities.h @@ -57,7 +57,6 @@ struct _xmlEntity { const xmlChar *URI; /* the full URI as computed */ int owner; /* does the entity own the childrens */ int checked; /* was the entity content checked */ - unsigned long nbentities; /* the number of entities references */ }; /* @@ -2421,7 +2421,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, goto int_error; ctxt->nbentities++; if (ent != NULL) - ctxt->nbentities += ent->nbentities; + ctxt->nbentities += ent->checked; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { @@ -2471,7 +2471,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, goto int_error; ctxt->nbentities++; if (ent != NULL) - ctxt->nbentities += ent->nbentities; + ctxt->nbentities += ent->checked; if (ent != NULL) { if (ent->content == NULL) { if (xmlLoadEntityContent(ctxt, ent) < 0) { @@ -3555,7 +3555,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { ent = xmlParseEntityRef(ctxt); ctxt->nbentities++; if (ent != NULL) - ctxt->nbentities += ent->nbentities; + ctxt->nbentities += ent->checked; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (len > buf_size - 10) { @@ -5083,7 +5083,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { } } if (cur != NULL) { - cur->nbentities = ctxt->nbentities - oldnbent; + cur->checked = ctxt->nbentities - oldnbent; if (cur->orig != NULL) xmlFree(orig); else @@ -6594,7 +6594,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, "invalid entity type found\n", NULL); } - ent->nbentities = ctxt->nbentities - oldnbent; + ent->checked = ctxt->nbentities - oldnbent; if (ret == XML_ERR_ENTITY_LOOP) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return; @@ -6651,9 +6651,10 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { list = NULL; } } - ent->checked = 1; + if (ent->checked == 0) + ent->checked = 1; } - ctxt->nbentities += ent->nbentities; + ctxt->nbentities += ent->checked; if (ent->children == NULL) { /* @@ -6662,7 +6663,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { * though parsing for first checking go though the entity * content to generate callbacks associated to the entity */ - if (was_checked == 1) { + if (was_checked != 0) { void *user_data; /* * This is a bit hackish but this seems the best |