summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>1999-09-01 12:19:13 +0000
committerDaniel Veillard <veillard@src.gnome.org>1999-09-01 12:19:13 +0000
commit1ff7ae3dfd22cf9b0ca92666b71b347bc4e83594 (patch)
treecccb3d66c7b62e8bf0b79924aaaf0ae186b5b348
parente7a5a77dd0abc0be021415f14027007b9a740991 (diff)
downloadlibxml2-1ff7ae3dfd22cf9b0ca92666b71b347bc4e83594.tar.gz
Fixing two stupid bugs on entities and HTML tree deallocation, Daniel.
-rw-r--r--ChangeLog10
-rw-r--r--HTMLparser.c32
-rw-r--r--entities.c18
3 files changed, 56 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 621a0ca2..5e9bc8e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
+ }
}
/**
diff --git a/entities.c b/entities.c
index 2cedf928..54be393d 100644
--- a/entities.c
+++ b/entities.c
@@ -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;