mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-04 10:30:47 +00:00
osx compatibility fixup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39122 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3d55d782bd
commit
612c1f983c
3 changed files with 42 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2015-11-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSXMLElement.m: (insertChild:atIndex:) if the child already
|
||||||
|
has a parent, detach from that before adding to the new parent.
|
||||||
|
OSX compatibility fix.
|
||||||
|
|
||||||
2015-11-01 Richard Frith-Macdonald <rfm@gnu.org>
|
2015-11-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSXMLDocument.m: When libxml2 is not enabled, create a
|
* Source/NSXMLDocument.m: When libxml2 is not enabled, create a
|
||||||
|
|
|
@ -648,7 +648,6 @@ extern void ensure_oldNs(xmlNodePtr node);
|
||||||
// Check to make sure this is a valid addition...
|
// Check to make sure this is a valid addition...
|
||||||
NSAssert(nil != child, NSInvalidArgumentException);
|
NSAssert(nil != child, NSInvalidArgumentException);
|
||||||
NSAssert(index <= childCount, NSInvalidArgumentException);
|
NSAssert(index <= childCount, NSInvalidArgumentException);
|
||||||
NSAssert(nil == [child parent], NSInvalidArgumentException);
|
|
||||||
NSAssert(NSXMLAttributeKind != theKind, NSInvalidArgumentException);
|
NSAssert(NSXMLAttributeKind != theKind, NSInvalidArgumentException);
|
||||||
NSAssert(NSXMLDTDKind != theKind, NSInvalidArgumentException);
|
NSAssert(NSXMLDTDKind != theKind, NSInvalidArgumentException);
|
||||||
NSAssert(NSXMLDocumentKind != theKind, NSInvalidArgumentException);
|
NSAssert(NSXMLDocumentKind != theKind, NSInvalidArgumentException);
|
||||||
|
@ -658,6 +657,11 @@ extern void ensure_oldNs(xmlNodePtr node);
|
||||||
NSAssert(NSXMLNamespaceKind != theKind, NSInvalidArgumentException);
|
NSAssert(NSXMLNamespaceKind != theKind, NSInvalidArgumentException);
|
||||||
NSAssert(NSXMLNotationDeclarationKind != theKind, NSInvalidArgumentException);
|
NSAssert(NSXMLNotationDeclarationKind != theKind, NSInvalidArgumentException);
|
||||||
|
|
||||||
|
if (nil != [child parent])
|
||||||
|
{
|
||||||
|
[child detach];
|
||||||
|
}
|
||||||
|
|
||||||
[self _insertChild: child atIndex: index];
|
[self _insertChild: child atIndex: index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,29 @@ isEqualNode(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
||||||
xmlFree(contentA);
|
xmlFree(contentA);
|
||||||
xmlFree(contentB);
|
xmlFree(contentB);
|
||||||
}
|
}
|
||||||
|
if (1)
|
||||||
|
{
|
||||||
|
xmlChar *contentA = NULL;
|
||||||
|
xmlChar *contentB = NULL;
|
||||||
|
|
||||||
// FIXME: Handle more node types
|
// FIXME: Handle more node types
|
||||||
|
if (!isEqualAttributes(nodeA, nodeB))
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the value of any text node underneath the current element.
|
||||||
|
contentA = xmlNodeGetContent((const xmlNodePtr)nodeA);
|
||||||
|
contentB = xmlNodeGetContent((const xmlNodePtr)nodeB);
|
||||||
|
if (xmlStrcmp(contentA, contentB) != 0)
|
||||||
|
{
|
||||||
|
xmlFree(contentA);
|
||||||
|
xmlFree(contentB);
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
xmlFree(contentA);
|
||||||
|
xmlFree(contentB);
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -541,8 +563,9 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
||||||
|
|
||||||
if (ns->href == NULL)
|
if (ns->href == NULL)
|
||||||
{
|
{
|
||||||
xmlNsPtr ns1 = xmlSearchNs(parentNode->doc, parentNode, ns->prefix);
|
xmlNsPtr ns1;
|
||||||
|
|
||||||
|
ns1 = xmlSearchNs(parentNode->doc, parentNode, ns->prefix);
|
||||||
if (ns1 != NULL)
|
if (ns1 != NULL)
|
||||||
{
|
{
|
||||||
cleanup_namespaces(childNode, ns1);
|
cleanup_namespaces(childNode, ns1);
|
||||||
|
@ -552,8 +575,10 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
||||||
/*
|
/*
|
||||||
else if (ns->prefix == NULL)
|
else if (ns->prefix == NULL)
|
||||||
{
|
{
|
||||||
xmlNsPtr ns1 = xmlSearchNsByHref(parentNode->doc, parentNode, ns->href);
|
xmlNsPtr ns1;
|
||||||
|
|
||||||
|
ns1
|
||||||
|
= xmlSearchNsByHref(parentNode->doc, parentNode, ns->href);
|
||||||
if (ns1 != NULL)
|
if (ns1 != NULL)
|
||||||
{
|
{
|
||||||
cleanup_namespaces(childNode, ns1);
|
cleanup_namespaces(childNode, ns1);
|
||||||
|
@ -609,9 +634,9 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mergeTextNodes ||
|
if (mergeTextNodes
|
||||||
((childNode->type != XML_TEXT_NODE) &&
|
|| ((childNode->type != XML_TEXT_NODE)
|
||||||
(parentNode->type != XML_TEXT_NODE)))
|
&& (parentNode->type != XML_TEXT_NODE)))
|
||||||
{
|
{
|
||||||
// this uses the built-in libxml functions which merge adjacent text nodes
|
// this uses the built-in libxml functions which merge adjacent text nodes
|
||||||
xmlNodePtr addedNode = NULL;
|
xmlNodePtr addedNode = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue