mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
Make the NSXMLNode ivar a union.
Having the same ivar exposed as different types in different compilation units is probably a bad idea in general and will break with the new ObjC ABI, where we have link-time checks for this. It would also confuse reflection and any languages that use reflection for bridging in exciting ways.
This commit is contained in:
parent
146d823689
commit
9b7e3a8fff
6 changed files with 97 additions and 85 deletions
|
@ -27,7 +27,6 @@
|
|||
|
||||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GS_XMLNODETYPE xmlDoc
|
||||
#define GSInternal NSXMLDocumentInternal
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
@ -56,8 +55,8 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) characterEncoding
|
||||
{
|
||||
if (internal->node->encoding)
|
||||
return StringFromXMLStringPtr(internal->node->encoding);
|
||||
if (internal->node.doc->encoding)
|
||||
return StringFromXMLStringPtr(internal->node.doc->encoding);
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
@ -69,7 +68,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSXMLDTD*) DTD
|
||||
{
|
||||
xmlDtdPtr dtd = xmlGetIntSubset(internal->node);
|
||||
xmlDtdPtr dtd = xmlGetIntSubset(internal->node.doc);
|
||||
return (NSXMLDTD *)[NSXMLNode _objectForNode: (xmlNodePtr)dtd];
|
||||
}
|
||||
|
||||
|
@ -152,7 +151,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
}
|
||||
|
||||
// Free old node
|
||||
xmlFreeDoc((xmlDocPtr)internal->node);
|
||||
xmlFreeDoc((xmlDocPtr)internal->node.doc);
|
||||
[self _setNode: doc];
|
||||
|
||||
if (mask & NSXMLDocumentValidate)
|
||||
|
@ -215,7 +214,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (BOOL) isStandalone
|
||||
{
|
||||
return (internal->node->standalone == 1);
|
||||
return (internal->node.doc->standalone == 1);
|
||||
}
|
||||
|
||||
- (NSString*) MIMEType
|
||||
|
@ -225,17 +224,17 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSXMLElement*) rootElement
|
||||
{
|
||||
xmlNodePtr rootElem = xmlDocGetRootElement(internal->node);
|
||||
xmlNodePtr rootElem = xmlDocGetRootElement(internal->node.doc);
|
||||
return (NSXMLElement *)[NSXMLNode _objectForNode: rootElem];
|
||||
}
|
||||
|
||||
- (void) setCharacterEncoding: (NSString*)encoding
|
||||
{
|
||||
if (internal->node->encoding != NULL)
|
||||
if (internal->node.doc->encoding != NULL)
|
||||
{
|
||||
xmlFree((xmlChar *)internal->node->encoding);
|
||||
xmlFree((xmlChar *)internal->node.doc->encoding);
|
||||
}
|
||||
internal->node->encoding = XMLStringCopy(encoding);
|
||||
internal->node.doc->encoding = XMLStringCopy(encoding);
|
||||
}
|
||||
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)theContentKind
|
||||
|
@ -253,7 +252,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
old = [self DTD];
|
||||
[old detach];
|
||||
|
||||
internal->node->intSubset = (xmlDtdPtr)[documentTypeDeclaration _node];
|
||||
internal->node.doc->intSubset = (xmlDtdPtr)[documentTypeDeclaration _node];
|
||||
[self addChild: documentTypeDeclaration];
|
||||
}
|
||||
|
||||
|
@ -280,7 +279,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
[self setChildren: nil];
|
||||
|
||||
// FIXME: Should we use addChild: here?
|
||||
xmlDocSetRootElement(internal->node, [root _node]);
|
||||
xmlDocSetRootElement(internal->node.doc, [root _node]);
|
||||
|
||||
// Do our subNode housekeeping...
|
||||
[self _addSubNode: root];
|
||||
|
@ -288,12 +287,12 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (void) setStandalone: (BOOL)standalone
|
||||
{
|
||||
internal->node->standalone = standalone;
|
||||
internal->node.doc->standalone = standalone;
|
||||
}
|
||||
|
||||
- (void) setURI: (NSString*)URI
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->URL != NULL)
|
||||
{
|
||||
|
@ -304,7 +303,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) URI
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->URL)
|
||||
{
|
||||
|
@ -320,7 +319,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
{
|
||||
if ([version isEqualToString: @"1.0"] || [version isEqualToString: @"1.1"])
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->version != NULL)
|
||||
{
|
||||
|
@ -337,7 +336,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) version
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->version)
|
||||
return StringFromXMLStringPtr(theNode->version);
|
||||
|
@ -459,7 +458,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
}
|
||||
|
||||
// Apply the stylesheet and get the result...
|
||||
resultDoc = xsltApplyStylesheet(stylesheet, internal->node,
|
||||
resultDoc = xsltApplyStylesheet(stylesheet, internal->node.doc,
|
||||
(const char **)params);
|
||||
|
||||
// Cleanup...
|
||||
|
@ -502,7 +501,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
xmlValidCtxtPtr ctxt = xmlNewValidCtxt();
|
||||
// FIXME: Should use xmlValidityErrorFunc and userData
|
||||
// to get the error
|
||||
BOOL result = (BOOL)(xmlValidateDocument(ctxt, internal->node));
|
||||
BOOL result = (BOOL)(xmlValidateDocument(ctxt, internal->node.doc));
|
||||
xmlFreeValidCtxt(ctxt);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue