diff options
author | Daniel Veillard <veillard@src.gnome.org> | 1999-09-01 12:19:13 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 1999-09-01 12:19:13 +0000 |
commit | 1ff7ae3dfd22cf9b0ca92666b71b347bc4e83594 (patch) | |
tree | cccb3d66c7b62e8bf0b79924aaaf0ae186b5b348 | |
parent | e7a5a77dd0abc0be021415f14027007b9a740991 (diff) | |
download | libxml2-1ff7ae3dfd22cf9b0ca92666b71b347bc4e83594.tar.gz |
Fixing two stupid bugs on entities and HTML tree deallocation, Daniel.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | HTMLparser.c | 32 | ||||
-rw-r--r-- | entities.c | 18 |
3 files changed, 56 insertions, 4 deletions
@@ -1,4 +1,12 @@ -Mon Aug 30 13:22:26 CEST 1999 +Wed Sep 1 14:15:09 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org> + + * HTMLparser.c: corrected a stupid bug leading to core dump at + tree deallocation. Removed warnings indicated by + Stephane.Conversy@lri.fr + * entities.c: Fixes Yet Another Stupid Bug, entities were not + looked for in the external subset + +Mon Aug 30 13:22:26 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org> * parser.c valid.[ch] xpath.c: patched compilation warnings reported on SGI by Stephane.Conversy@lri.fr diff --git a/HTMLparser.c b/HTMLparser.c index 7ecf2b5a..d45b6cde 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2220,18 +2220,22 @@ void htmlParseElement(htmlParserCtxtPtr ctxt) { const CHAR *openTag = CUR_PTR; CHAR *name; - htmlParserNodeInfo node_info; htmlNodePtr currentNode; htmlElemDescPtr info; + htmlParserNodeInfo node_info; /* Capture start position */ - node_info.begin_pos = CUR_PTR - ctxt->input->base; - node_info.begin_line = ctxt->input->line; + if (ctxt->record_info) { + node_info.begin_pos = ctxt->input->consumed + + (CUR_PTR - ctxt->input->base); + node_info.begin_line = ctxt->input->line; + } name = htmlParseStartTag(ctxt); if (name == NULL) { return; } + currentNode = ctxt->node; /* * Lookup the info for that element. @@ -2274,6 +2278,17 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { */ nodePop(ctxt); free(name); + + /* + * Capture end position and add node + */ + if ( currentNode != NULL && ctxt->record_info ) { + node_info.end_pos = ctxt->input->consumed + + (CUR_PTR - ctxt->input->base); + node_info.end_line = ctxt->input->line; + node_info.node = currentNode; + xmlParserAddNodeInfo(ctxt, &node_info); + } return; } @@ -2317,6 +2332,17 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { } free(name); + + /* + * Capture end position and add node + */ + if ( currentNode != NULL && ctxt->record_info ) { + node_info.end_pos = ctxt->input->consumed + + (CUR_PTR - ctxt->input->base); + node_info.end_line = ctxt->input->line; + node_info.node = currentNode; + xmlParserAddNodeInfo(ctxt, &node_info); + } } /** @@ -260,6 +260,15 @@ xmlGetParameterEntity(xmlDocPtr doc, const CHAR *name) { (!xmlStrcmp(cur->name, name))) return(cur); } } + if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; + for (i = 0;i < table->nb_entities;i++) { + cur = &table->table[i]; + if (((cur->type == XML_INTERNAL_PARAMETER_ENTITY) || + (cur->type == XML_EXTERNAL_PARAMETER_ENTITY)) && + (!xmlStrcmp(cur->name, name))) return(cur); + } + } return(NULL); } @@ -317,6 +326,15 @@ xmlGetDocEntity(xmlDocPtr doc, const CHAR *name) { (!xmlStrcmp(cur->name, name))) return(cur); } } + if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; + for (i = 0;i < table->nb_entities;i++) { + cur = &table->table[i]; + if ((cur->type != XML_INTERNAL_PARAMETER_ENTITY) && + (cur->type != XML_EXTERNAL_PARAMETER_ENTITY) && + (!xmlStrcmp(cur->name, name))) return(cur); + } + } if (xmlPredefinedEntities == NULL) xmlInitializePredefinedEntities(); table = xmlPredefinedEntities; |