mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Replace last change by a better one.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34829 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7e3141f7f5
commit
aa4ce6d720
4 changed files with 15 additions and 22 deletions
|
@ -1,6 +1,12 @@
|
|||
2012-02-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSXMLNode.m (-copyWithZone:): Copy name spaces as well.
|
||||
* Source/NSXMLDocument.m (-copyWithZone:): Rewrite copy method.
|
||||
* Source/NSXMLElement.m: Remove copy method.
|
||||
|
||||
2012-02-27 Doug Simons <doug.simons@testplant.com>
|
||||
Merged to trunk by: greg.casamento@gmail.com
|
||||
|
||||
|
||||
* Source/NSXMLDocument.m: Fix bugs in setCharacterEncoding: and
|
||||
copyWithZone: that cause a memory crash when tree is freed.
|
||||
Doug Simons <doug.simons@testplant.com>
|
||||
|
|
|
@ -76,7 +76,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
- (NSString*) characterEncoding
|
||||
{
|
||||
if (MY_DOC->encoding)
|
||||
return [NSString stringWithUTF8String: (const char *)MY_DOC->encoding];
|
||||
return StringFromXMLStringPtr(MY_DOC->encoding);
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
|
||||
- (void) setCharacterEncoding: (NSString*)encoding
|
||||
{
|
||||
MY_DOC->encoding = xmlStrdup(XMLSTRING(encoding));
|
||||
MY_DOC->encoding = XMLStringCopy(encoding);
|
||||
}
|
||||
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)kind
|
||||
|
@ -475,12 +475,11 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
|
||||
- (id) copyWithZone: (NSZone *)zone
|
||||
{
|
||||
id c = [[self class] allocWithZone: zone];
|
||||
xmlDocPtr newNode = xmlCopyDoc(MY_DOC, 1); // make a deep copy
|
||||
clearPrivatePointers((xmlNodePtr)newNode);
|
||||
|
||||
c = [c _initWithNode:(xmlNodePtr)newNode kind:internal->kind];
|
||||
NSXMLDocument *c = (NSXMLDocument*)[super copyWithZone: zone];
|
||||
|
||||
[c setMIMEType: [self MIMEType]];
|
||||
[c setDTD: [self DTD]];
|
||||
[c setDocumentContentKind: [self documentContentKind]];
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
@ -554,15 +554,6 @@ static void joinTextNodes(xmlNodePtr nodeA, xmlNodePtr nodeB, NSMutableArray *no
|
|||
}
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *)zone
|
||||
{
|
||||
NSXMLElement *c = [[self class] alloc]; ///(NSXMLElement*)[super copyWithZone: zone];
|
||||
xmlNodePtr newNode = (xmlNodePtr)xmlCopyNode(MY_NODE, 1); // copy recursively
|
||||
clearPrivatePointers(newNode); // clear out all of the _private pointers in the entire tree
|
||||
c = [c _initWithNode:newNode kind:internal->kind];
|
||||
return c;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -937,15 +937,12 @@ NSArray *execute_xpath(NSXMLNode *xmlNode,
|
|||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
id c = [[self class] allocWithZone: zone];
|
||||
xmlNodePtr newNode = xmlCopyNode([self _node], 1); // make a deep copy
|
||||
// make a deep copy
|
||||
xmlNodePtr newNode = xmlCopyNode([self _node], 2);
|
||||
clearPrivatePointers(newNode);
|
||||
|
||||
//c = [c initWithKind: internal->kind options: internal->options];
|
||||
//[c _setNode: newNode];
|
||||
c = [c _initWithNode: newNode kind: internal->kind];
|
||||
|
||||
|
||||
|
||||
// [c setName: [self name]];
|
||||
// [c setURI: [self URI]];
|
||||
// [c setObjectValue: [self objectValue]];
|
||||
|
|
Loading…
Reference in a new issue