Check return code in ixml
Check return code of ixmlDocument_CreateElementEx in ixmlDocument_CreateElement. Check return code of ixmlNode_setNodeName and ixmlNode_setNodeValue in ixmlNode_cloneCDATASect and ixmlNode_cloneTextNode.
This commit is contained in:
parent
e0444b26e6
commit
d3d17da6e5
@ -2,6 +2,15 @@
|
||||
Version 1.6.16
|
||||
*******************************************************************************
|
||||
|
||||
2012-03-16 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||
|
||||
Check return code in ixml
|
||||
|
||||
Check return code of ixmlDocument_CreateElementEx in
|
||||
ixmlDocument_CreateElement.
|
||||
Check return code of ixmlNode_setNodeName and ixmlNode_setNodeValue in
|
||||
ixmlNode_cloneCDATASect and ixmlNode_cloneTextNode.
|
||||
|
||||
2012-03-16 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||
|
||||
Add more explicit casts and remove dead code
|
||||
|
@ -165,8 +165,14 @@ IXML_Element *ixmlDocument_createElement(
|
||||
const DOMString tagName)
|
||||
{
|
||||
IXML_Element *newElement = NULL;
|
||||
int ret = IXML_SUCCESS;
|
||||
|
||||
ixmlDocument_createElementEx(doc, tagName, &newElement);
|
||||
ret = ixmlDocument_createElementEx(doc, tagName, &newElement);
|
||||
if (ret != IXML_SUCCESS) {
|
||||
IxmlPrintf(__FILE__, __LINE__, "ixmlDocument_createElement",
|
||||
"Error %d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
return newElement;
|
||||
}
|
||||
|
||||
|
@ -655,6 +655,7 @@ static IXML_Node *ixmlNode_cloneTextNode(
|
||||
IXML_Node *nodeptr)
|
||||
{
|
||||
IXML_Node *newNode = NULL;
|
||||
int rc;
|
||||
|
||||
assert(nodeptr != NULL);
|
||||
|
||||
@ -663,8 +664,16 @@ static IXML_Node *ixmlNode_cloneTextNode(
|
||||
return NULL;
|
||||
} else {
|
||||
ixmlNode_init(newNode);
|
||||
ixmlNode_setNodeName(newNode, nodeptr->nodeName);
|
||||
ixmlNode_setNodeValue(newNode, nodeptr->nodeValue);
|
||||
rc = ixmlNode_setNodeName(newNode, nodeptr->nodeName);
|
||||
if (rc != IXML_SUCCESS) {
|
||||
ixmlNode_free(newNode);
|
||||
return NULL;
|
||||
}
|
||||
rc = ixmlNode_setNodeValue(newNode, nodeptr->nodeValue);
|
||||
if (rc != IXML_SUCCESS) {
|
||||
ixmlNode_free(newNode);
|
||||
return NULL;
|
||||
}
|
||||
newNode->nodeType = eTEXT_NODE;
|
||||
}
|
||||
|
||||
@ -683,15 +692,24 @@ static IXML_CDATASection *ixmlNode_cloneCDATASect(
|
||||
IXML_CDATASection *newCDATA = NULL;
|
||||
IXML_Node *newNode;
|
||||
IXML_Node *srcNode;
|
||||
int rc;
|
||||
|
||||
assert(nodeptr != NULL);
|
||||
newCDATA = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection));
|
||||
if (newCDATA != NULL) {
|
||||
newNode = (IXML_Node *)newCDATA;
|
||||
ixmlNode_init(newNode);
|
||||
ixmlCDATASection_init(newCDATA);
|
||||
srcNode = (IXML_Node *)nodeptr;
|
||||
ixmlNode_setNodeName(newNode, srcNode->nodeName);
|
||||
ixmlNode_setNodeValue(newNode, srcNode->nodeValue);
|
||||
rc = ixmlNode_setNodeName(newNode, srcNode->nodeName);
|
||||
if (rc != IXML_SUCCESS) {
|
||||
ixmlCDATASection_free(newCDATA);
|
||||
return NULL;
|
||||
}
|
||||
rc = ixmlNode_setNodeValue(newNode, srcNode->nodeValue);
|
||||
if (rc != IXML_SUCCESS) {
|
||||
ixmlCDATASection_free(newCDATA);
|
||||
return NULL;
|
||||
}
|
||||
newNode->nodeType = eCDATA_SECTION_NODE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user