mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-13 13:17:36 +03:00
xmlSetProp() and xmlNewProp() fixes, mem extra alloc bug in parser fixed, Daniel
This commit is contained in:
parent
bdc28bc299
commit
51e3b154bf
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Fri Nov 12 17:41:20 CET 1999 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* valid.[ch] : removed a typo and an enumerated type bug in the
|
||||||
|
xmlAddElementDecl() function
|
||||||
|
* tree.c : I changed xmlSetProp() and xmlNewProp() to do the
|
||||||
|
call to xmlEncodeEntitiesReentrant() so that the functions
|
||||||
|
New, Set and Get are at the same level.
|
||||||
|
* parser.c HTMLparser.c: extra memory allocation bug for
|
||||||
|
attributes detected by someone using libxml in embedded systems :-)
|
||||||
|
|
||||||
Thu Oct 28 17:49:26 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
|
Thu Oct 28 17:49:26 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* xmlmemory.h: turned off mem debug :-\
|
* xmlmemory.h: turned off mem debug :-\
|
||||||
|
@ -1993,7 +1993,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
|
|||||||
if (name != NULL) xmlFree(name);
|
if (name != NULL) xmlFree(name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (nbatts + 2 < maxatts) {
|
} else if (nbatts + 4 > maxatts) {
|
||||||
maxatts *= 2;
|
maxatts *= 2;
|
||||||
atts = (const xmlChar **) xmlRealloc(atts, maxatts * sizeof(xmlChar *));
|
atts = (const xmlChar **) xmlRealloc(atts, maxatts * sizeof(xmlChar *));
|
||||||
if (atts == NULL) {
|
if (atts == NULL) {
|
||||||
|
@ -120,7 +120,7 @@ void xmlFreeElementContent(xmlElementContentPtr cur);
|
|||||||
xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
|
xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
|
||||||
xmlDtdPtr dtd,
|
xmlDtdPtr dtd,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
xmlElementContentType type,
|
xmlElementTypeVal type,
|
||||||
xmlElementContentPtr content);
|
xmlElementContentPtr content);
|
||||||
xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
|
xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
|
||||||
void xmlFreeElementTable (xmlElementTablePtr table);
|
void xmlFreeElementTable (xmlElementTablePtr table);
|
||||||
|
28
parser.c
28
parser.c
@ -379,7 +379,7 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlFreeInputStream:
|
* xmlFreeInputStream:
|
||||||
* @input: an xmlP arserInputPtr
|
* @input: an xmlParserInputPtr
|
||||||
*
|
*
|
||||||
* Free up an input stream.
|
* Free up an input stream.
|
||||||
*/
|
*/
|
||||||
@ -887,7 +887,7 @@ fprintf(stderr, "xmlParserHandleReference : ctxt->token != 0\n");
|
|||||||
case XML_PARSER_ENTITY_VALUE:
|
case XML_PARSER_ENTITY_VALUE:
|
||||||
/*
|
/*
|
||||||
* NOTE: in the case of entity values, we don't do the
|
* NOTE: in the case of entity values, we don't do the
|
||||||
* substitution here since we need the litteral
|
* substitution here since we need the literal
|
||||||
* entity value to be able to save the internal
|
* entity value to be able to save the internal
|
||||||
* subset of the document.
|
* subset of the document.
|
||||||
* This will be handled by xmlDecodeEntities
|
* This will be handled by xmlDecodeEntities
|
||||||
@ -928,7 +928,7 @@ fprintf(stderr, "xmlParserHandleReference : ctxt->token != 0\n");
|
|||||||
case XML_PARSER_ENTITY_VALUE:
|
case XML_PARSER_ENTITY_VALUE:
|
||||||
/*
|
/*
|
||||||
* NOTE: in the case of entity values, we don't do the
|
* NOTE: in the case of entity values, we don't do the
|
||||||
* substitution here since we need the litteral
|
* substitution here since we need the literal
|
||||||
* entity value to be able to save the internal
|
* entity value to be able to save the internal
|
||||||
* subset of the document.
|
* subset of the document.
|
||||||
* This will be handled by xmlDecodeEntities
|
* This will be handled by xmlDecodeEntities
|
||||||
@ -1103,7 +1103,7 @@ fprintf(stderr, "xmlParserHandlePEReference : ctxt->token != 0\n");
|
|||||||
case XML_PARSER_ENTITY_VALUE:
|
case XML_PARSER_ENTITY_VALUE:
|
||||||
/*
|
/*
|
||||||
* NOTE: in the case of entity values, we don't do the
|
* NOTE: in the case of entity values, we don't do the
|
||||||
* substitution here since we need the litteral
|
* substitution here since we need the literal
|
||||||
* entity value to be able to save the internal
|
* entity value to be able to save the internal
|
||||||
* subset of the document.
|
* subset of the document.
|
||||||
* This will be handled by xmlDecodeEntities
|
* This will be handled by xmlDecodeEntities
|
||||||
@ -1690,7 +1690,7 @@ xmlStrsub(const xmlChar *str, int start, int len) {
|
|||||||
* xmlStrlen:
|
* xmlStrlen:
|
||||||
* @str: the xmlChar * array
|
* @str: the xmlChar * array
|
||||||
*
|
*
|
||||||
* lenght of a xmlChar's string
|
* length of a xmlChar's string
|
||||||
*
|
*
|
||||||
* Returns the number of xmlChar contained in the ARRAY.
|
* Returns the number of xmlChar contained in the ARRAY.
|
||||||
*/
|
*/
|
||||||
@ -1921,7 +1921,7 @@ xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt) {
|
|||||||
*
|
*
|
||||||
* [NS 7] LocalPart ::= NCName
|
* [NS 7] LocalPart ::= NCName
|
||||||
*
|
*
|
||||||
* Returns the function returns the local part, and prefix is updated
|
* Returns the local part, and prefix is updated
|
||||||
* to get the Prefix if any.
|
* to get the Prefix if any.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1953,7 +1953,7 @@ xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, xmlChar **prefix) {
|
|||||||
*
|
*
|
||||||
* [NS 7] LocalPart ::= NCName
|
* [NS 7] LocalPart ::= NCName
|
||||||
*
|
*
|
||||||
* Returns the function returns the local part, and prefix is updated
|
* Returns the local part, and prefix is updated
|
||||||
* to get the Prefix if any.
|
* to get the Prefix if any.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -2082,7 +2082,7 @@ xmlParseQuotedString(xmlParserCtxtPtr ctxt) {
|
|||||||
*
|
*
|
||||||
* This is what the older xml-name Working Draft specified, a bunch of
|
* This is what the older xml-name Working Draft specified, a bunch of
|
||||||
* other stuff may still rely on it, so support is still here as
|
* other stuff may still rely on it, so support is still here as
|
||||||
* if ot was declared on the root of the Tree:-(
|
* if it was declared on the root of the Tree:-(
|
||||||
*
|
*
|
||||||
* To be removed at next drop of binary compatibility
|
* To be removed at next drop of binary compatibility
|
||||||
*/
|
*/
|
||||||
@ -5033,7 +5033,7 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) {
|
|||||||
maxatts * (long)sizeof(xmlChar *));
|
maxatts * (long)sizeof(xmlChar *));
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
} else if (nbatts + 2 < maxatts) {
|
} else if (nbatts + 4 > maxatts) {
|
||||||
maxatts *= 2;
|
maxatts *= 2;
|
||||||
atts = (const xmlChar **) xmlRealloc(atts,
|
atts = (const xmlChar **) xmlRealloc(atts,
|
||||||
maxatts * sizeof(xmlChar *));
|
maxatts * sizeof(xmlChar *));
|
||||||
@ -6332,7 +6332,7 @@ xmlRecoverFile(const char *filename) {
|
|||||||
/**
|
/**
|
||||||
* xmlCreateMemoryParserCtxt :
|
* xmlCreateMemoryParserCtxt :
|
||||||
* @buffer: an pointer to a char array
|
* @buffer: an pointer to a char array
|
||||||
* @size: the siwe of the array
|
* @size: the size of the array
|
||||||
*
|
*
|
||||||
* Create a parser context for an XML in-memory document.
|
* Create a parser context for an XML in-memory document.
|
||||||
*
|
*
|
||||||
@ -6381,8 +6381,8 @@ xmlCreateMemoryParserCtxt(char *buffer, int size) {
|
|||||||
* xmlSAXParseMemory :
|
* xmlSAXParseMemory :
|
||||||
* @sax: the SAX handler block
|
* @sax: the SAX handler block
|
||||||
* @buffer: an pointer to a char array
|
* @buffer: an pointer to a char array
|
||||||
* @size: the siwe of the array
|
* @size: the size of the array
|
||||||
* @recovery: work in recovery mode, i.e. tries to read no Well Formed
|
* @recovery: work in recovery mode, i.e. tries to read not Well Formed
|
||||||
* documents
|
* documents
|
||||||
*
|
*
|
||||||
* parse an XML in-memory block and use the given SAX function block
|
* parse an XML in-memory block and use the given SAX function block
|
||||||
@ -6522,7 +6522,7 @@ int xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
|
|||||||
* @sax: a SAX handler
|
* @sax: a SAX handler
|
||||||
* @user_data: The user data returned on SAX callbacks
|
* @user_data: The user data returned on SAX callbacks
|
||||||
* @buffer: an in-memory XML document input
|
* @buffer: an in-memory XML document input
|
||||||
* @size: the lenght of the XML document in bytes
|
* @size: the length of the XML document in bytes
|
||||||
*
|
*
|
||||||
* A better SAX parsing routine.
|
* A better SAX parsing routine.
|
||||||
* parse an XML in-memory buffer and call the given SAX handler routines.
|
* parse an XML in-memory buffer and call the given SAX handler routines.
|
||||||
@ -6559,7 +6559,7 @@ int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
|
|||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Miscelaneous *
|
* Miscellaneous *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
16
tree.c
16
tree.c
@ -753,8 +753,12 @@ xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
|
|||||||
cur->node = node;
|
cur->node = node;
|
||||||
cur->ns = NULL;
|
cur->ns = NULL;
|
||||||
cur->name = xmlStrdup(name);
|
cur->name = xmlStrdup(name);
|
||||||
if (value != NULL)
|
if (value != NULL) {
|
||||||
cur->val = xmlStringGetNodeList(node->doc, value);
|
xmlChar *buffer;
|
||||||
|
buffer = xmlEncodeEntitiesReentrant(node->doc, value);
|
||||||
|
cur->val = xmlStringGetNodeList(node->doc, buffer);
|
||||||
|
xmlFree(buffer);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cur->val = NULL;
|
cur->val = NULL;
|
||||||
#ifndef XML_WITHOUT_CORBA
|
#ifndef XML_WITHOUT_CORBA
|
||||||
@ -2406,8 +2410,12 @@ xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
|
|||||||
if (prop->val != NULL)
|
if (prop->val != NULL)
|
||||||
xmlFreeNodeList(prop->val);
|
xmlFreeNodeList(prop->val);
|
||||||
prop->val = NULL;
|
prop->val = NULL;
|
||||||
if (value != NULL)
|
if (value != NULL) {
|
||||||
prop->val = xmlStringGetNodeList(node->doc, value);
|
xmlChar *buffer;
|
||||||
|
buffer = xmlEncodeEntitiesReentrant(node->doc, value);
|
||||||
|
prop->val = xmlStringGetNodeList(node->doc, buffer);
|
||||||
|
xmlFree(buffer);
|
||||||
|
}
|
||||||
return(prop);
|
return(prop);
|
||||||
}
|
}
|
||||||
prop = prop->next;
|
prop = prop->next;
|
||||||
|
3
valid.c
3
valid.c
@ -309,7 +309,7 @@ xmlCreateElementTable(void) {
|
|||||||
*/
|
*/
|
||||||
xmlElementPtr
|
xmlElementPtr
|
||||||
xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
|
xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
|
||||||
xmlElementContentType type, xmlElementContentPtr content) {
|
xmlElementTypeVal type, xmlElementContentPtr content) {
|
||||||
xmlElementPtr ret, cur;
|
xmlElementPtr ret, cur;
|
||||||
xmlElementTablePtr table;
|
xmlElementTablePtr table;
|
||||||
int i;
|
int i;
|
||||||
@ -2059,7 +2059,6 @@ xmlValidateNmtokenValue(const xmlChar *value) {
|
|||||||
if (*cur != 0) return(0);
|
if (*cur != 0) return(0);
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
valid.h
2
valid.h
@ -120,7 +120,7 @@ void xmlFreeElementContent(xmlElementContentPtr cur);
|
|||||||
xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
|
xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
|
||||||
xmlDtdPtr dtd,
|
xmlDtdPtr dtd,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
xmlElementContentType type,
|
xmlElementTypeVal type,
|
||||||
xmlElementContentPtr content);
|
xmlElementContentPtr content);
|
||||||
xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
|
xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
|
||||||
void xmlFreeElementTable (xmlElementTablePtr table);
|
void xmlFreeElementTable (xmlElementTablePtr table);
|
||||||
|
Loading…
Reference in New Issue
Block a user