small fix fixing bug #58539 reported by coolo, in entity substitution mode
* SAX.c: small fix fixing bug #58539 reported by coolo, in
entity substitution mode text at the end of the entity might
be added due to text coalescing.
* nanoftp.c parser.c: small cleanup
Daniel
diff --git a/SAX.c b/SAX.c
index 86e95d7..b542157 100644
--- a/SAX.c
+++ b/SAX.c
@@ -1307,8 +1307,10 @@
}
#endif
} else {
- int isText = xmlNodeIsText(lastChild);
- if ((isText) && (ctxt->nodemem != 0)) {
+ int coalesceText = (lastChild != NULL) &&
+ (lastChild->type == XML_TEXT_NODE) &&
+ (lastChild->name == xmlStringText);
+ if ((coalesceText) && (ctxt->nodemem != 0)) {
#ifndef XML_USE_BUFFER_CONTENT
/*
* The whole point of maintaining nodelen and nodemem,
@@ -1339,7 +1341,7 @@
#else
xmlTextConcat(lastChild, ch, len);
#endif
- } else if (isText) {
+ } else if (coalesceText) {
xmlTextConcat(lastChild, ch, len);
if (ctxt->node->children != NULL) {
ctxt->nodelen = xmlStrlen(lastChild->content);