Recommit gcc-4 tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21431 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-07-08 11:48:37 +00:00
parent 18c6fddb3b
commit 7c4a87c2c0
53 changed files with 466 additions and 322 deletions

View file

@ -107,6 +107,11 @@ static Class treeClass;
static IMP usImp;
static SEL usSel;
/*
* Macro to cast results to correct type for libxml2
*/
#define UTF8STRING(X) ((const unsigned char*)[X UTF8String])
inline static NSString*
UTF8Str(const unsigned char *bytes)
{
@ -344,7 +349,7 @@ static NSMapTable *attrNames = 0;
*/
+ (GSXMLDocument*) documentWithVersion: (NSString*)version
{
void *data = xmlNewDoc([version UTF8String]);
void *data = xmlNewDoc(UTF8STRING(version));
GSXMLDocument *document = nil;
if (data == 0)
@ -448,7 +453,7 @@ static NSMapTable *attrNames = 0;
GSXMLNode *n = [GSXMLNode alloc];
n = [n _initFrom:
xmlNewDocNode(lib, [ns lib], [name UTF8String], [content UTF8String])
xmlNewDocNode(lib, [ns lib], UTF8STRING(name), UTF8STRING(content))
parent: self];
return AUTORELEASE(n);
}
@ -1141,7 +1146,7 @@ static NSMapTable *nodeNames = 0;
{
void *l;
l = xmlNewProp((xmlNodePtr)[self lib], [name cString], [value cString]);
l = xmlNewProp((xmlNodePtr)[self lib], UTF8STRING(name), UTF8STRING(value));
return AUTORELEASE([[GSXMLAttribute alloc] _initFrom: l parent: self]);
}
@ -1182,7 +1187,7 @@ static NSMapTable *nodeNames = 0;
GSXMLNode *n = [GSXMLNode alloc];
n = [n _initFrom:
xmlNewTextChild(lib, [ns lib], [name UTF8String], [content UTF8String])
xmlNewTextChild(lib, [ns lib], UTF8STRING(name), UTF8STRING(content))
parent: self];
return AUTORELEASE(n);
}
@ -1204,7 +1209,7 @@ static NSMapTable *nodeNames = 0;
GSXMLNode *n = [GSXMLNode alloc];
n = [n _initFrom:
xmlAddChild((xmlNodePtr)lib, xmlNewText([content UTF8String]))
xmlAddChild((xmlNodePtr)lib, xmlNewText(UTF8STRING(content)))
parent: self];
return AUTORELEASE(n);
}
@ -1226,7 +1231,7 @@ static NSMapTable *nodeNames = 0;
GSXMLNode *n = [GSXMLNode alloc];
n = [n _initFrom:
xmlAddChild((xmlNodePtr)lib, xmlNewComment([content UTF8String]))
xmlAddChild((xmlNodePtr)lib, xmlNewComment(UTF8STRING(content)))
parent: self];
return AUTORELEASE(n);
}
@ -1239,7 +1244,7 @@ static NSMapTable *nodeNames = 0;
{
void *data;
data = xmlNewNs((xmlNodePtr)lib, [href UTF8String], [prefix UTF8String]);
data = xmlNewNs((xmlNodePtr)lib, UTF8STRING(href), UTF8STRING(prefix));
if (data == NULL)
{
NSLog(@"Can't create GSXMLNamespace object");
@ -1266,8 +1271,8 @@ static NSMapTable *nodeNames = 0;
GSXMLNode *n = [GSXMLNode alloc];
n = [n _initFrom:
xmlAddChild((xmlNodePtr)lib, xmlNewPI([name UTF8String],
[content UTF8String])) parent: self];
xmlAddChild((xmlNodePtr)lib, xmlNewPI(UTF8STRING(name),
UTF8STRING(content))) parent: self];
return AUTORELEASE(n);
}
@ -1523,7 +1528,7 @@ static NSMapTable *nodeNames = 0;
*/
- (void) setObject: (NSString*)value forKey: (NSString*)key
{
xmlSetProp(lib, [key UTF8String], [value UTF8String]);
xmlSetProp(lib, UTF8STRING(key), UTF8STRING(value));
}
/**
@ -1842,7 +1847,7 @@ static NSString *endMarker = @"At end of incremental parse";
// Stop incoming data being parsed.
ctxt->instate = XML_PARSER_EOF;
// Pretend we are at end of file (nul byte).
if (ctxt->input != NULL) ctxt->input->cur = "";
if (ctxt->input != NULL) ctxt->input->cur = (const unsigned char*)"";
}
}
@ -2270,7 +2275,7 @@ static NSString *endMarker = @"At end of incremental parse";
- (BOOL) _initLibXML
{
const unsigned char *file;
const char *file;
if ([src isKindOfClass: NSString_class])
{
@ -2836,7 +2841,7 @@ processingInstructionFunction(void *ctx, const unsigned char *target,
{
NSCAssert(ctx,@"No Context");
[HANDLER processInstruction: UTF8Str(target)
data: UTF8Str(data)];
data: UTF8Str((const unsigned char*)data)];
}
static void
@ -3598,7 +3603,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
- (NSString *) stringValue
{
xmlChar *string = ((xmlXPathObject*)_lib)->stringval;
return [NSString_class stringWithUTF8String: string];
return [NSString_class stringWithUTF8String: (const char*)string];
}
- (NSString *) description
{
@ -3712,7 +3717,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
xmlXPathObject *res;
GSXPathObject *result;
comp = xmlXPathCompile ([XPathExpression UTF8String]);
comp = xmlXPathCompile (UTF8STRING(XPathExpression));
if (comp == NULL)
{
/* Maybe an exception would be better ? */