mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
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:
parent
18c6fddb3b
commit
7c4a87c2c0
53 changed files with 466 additions and 322 deletions
|
@ -609,7 +609,7 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
lineLength -= 3;
|
||||
}
|
||||
}
|
||||
else if (pos > 6 && strncmp(bytes, "begin ", 6) == 0)
|
||||
else if (pos > 6 && strncmp((const char*)bytes, "begin ", 6) == 0)
|
||||
{
|
||||
unsigned off = 6;
|
||||
unsigned end = pos;
|
||||
|
@ -678,8 +678,8 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
|||
/*
|
||||
* The header is a line of the form 'begin mode filename'
|
||||
*/
|
||||
sprintf(buf, "begin %03o ", mode);
|
||||
[encoded appendBytes: buf length: strlen(buf)];
|
||||
sprintf((char*)buf, "begin %03o ", mode);
|
||||
[encoded appendBytes: buf length: strlen((const char*)buf)];
|
||||
[encoded appendData: [name dataUsingEncoding: NSASCIIStringEncoding]];
|
||||
[encoded appendBytes: "\n" length: 1];
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ static Class documentClass = 0;
|
|||
* Purpose - Convert 4 bytes in base64 encoding to 3 bytes raw data.
|
||||
*/
|
||||
static void
|
||||
decodebase64(unsigned char *dst, const char *src)
|
||||
decodebase64(unsigned char *dst, const unsigned char *src)
|
||||
{
|
||||
dst[0] = (src[0] << 2) | ((src[1] & 0x30) >> 4);
|
||||
dst[1] = ((src[1] & 0x0F) << 4) | ((src[2] & 0x3C) >> 2);
|
||||
|
@ -83,7 +83,7 @@ static char b64[]
|
|||
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static int
|
||||
encodebase64(char *dst, const unsigned char *src, int length)
|
||||
encodebase64(unsigned char *dst, const unsigned char *src, int length)
|
||||
{
|
||||
int dIndex = 0;
|
||||
int sIndex;
|
||||
|
@ -808,7 +808,7 @@ wordData(NSString *word)
|
|||
if (buflen == 8)
|
||||
{
|
||||
buffer[8] = '\0';
|
||||
if (strcasecmp(buffer, "encoding") == 0)
|
||||
if (strcasecmp((char*)buffer, "encoding") == 0)
|
||||
{
|
||||
found = YES;
|
||||
}
|
||||
|
@ -1615,7 +1615,7 @@ wordData(NSString *word)
|
|||
|
||||
b[0] = '-';
|
||||
b[1] = '-';
|
||||
[tmp getCString: &b[2]];
|
||||
[tmp getCString: (char*)&b[2]];
|
||||
boundary = [[NSData alloc] initWithBytesNoCopy: b length: l];
|
||||
}
|
||||
|
||||
|
@ -2235,7 +2235,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
*src = '\0';
|
||||
|
||||
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
s = [s initWithCString: tmp];
|
||||
s = [s initWithCString: (const char *)tmp];
|
||||
enc = [documentClass encodingFromCharset: s];
|
||||
RELEASE(s);
|
||||
|
||||
|
@ -3318,8 +3318,8 @@ static NSCharacterSet *tokenSet = nil;
|
|||
{
|
||||
int length;
|
||||
int declen ;
|
||||
const signed char *src;
|
||||
const signed char *end;
|
||||
const unsigned char *src;
|
||||
const unsigned char *end;
|
||||
unsigned char *result;
|
||||
unsigned char *dst;
|
||||
unsigned char buf[4];
|
||||
|
@ -3335,7 +3335,7 @@ static NSCharacterSet *tokenSet = nil;
|
|||
return [NSData data];
|
||||
}
|
||||
declen = ((length + 3) * 3)/4;
|
||||
src = (const char*)[source bytes];
|
||||
src = (const unsigned char*)[source bytes];
|
||||
end = &src[length];
|
||||
|
||||
result = (unsigned char*)NSZoneMalloc(NSDefaultMallocZone(), declen);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSMethodSignature.h>
|
||||
#include <Foundation/NSNull.h>
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
#include <Foundation/NSSet.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
@ -54,8 +55,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
@class NSNull;
|
||||
|
||||
#ifdef NeXT_Foundation_LIBRARY
|
||||
@interface NSObject (MissingFromMacOSX)
|
||||
+ (IMP) methodForSelector: (SEL)aSelector;
|
||||
|
|
|
@ -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 ? */
|
||||
|
|
|
@ -1031,7 +1031,8 @@ int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
|
|||
BOOL result;
|
||||
unsigned int old = dl;
|
||||
|
||||
result = GSToUnicode(&dst, &dl, src, sl, enc, 0, 0);
|
||||
result = GSToUnicode(&dst, (unsigned int*)&dl, (unsigned char*)src,
|
||||
sl, enc, 0, 0);
|
||||
if (result == NO)
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue