From 9ac16024f511406160b3b7c995dd7cb21a119511 Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 1 Jul 2005 12:29:50 +0000 Subject: [PATCH] Tweaks to avoid compiler warnings with gcc-4 git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21390 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 58 ++++++++++++++++ Headers/Foundation/NSUserDefaults.h | 2 +- Source/Additions/GSCategories.m | 6 +- Source/Additions/GSMime.m | 16 ++--- Source/Additions/GSObjCRuntime.m | 3 +- Source/Additions/GSXML.m | 35 ++++++---- Source/Additions/Unicode.m | 3 +- Source/GSArray.m | 38 ++++++----- Source/GSCountedSet.m | 4 +- Source/GSFileHandle.m | 12 ++-- Source/GSSet.m | 4 +- Source/GSString.m | 69 ++++++++++--------- Source/GSeq.h | 4 +- Source/NSArchiver.m | 24 ++++--- Source/NSArray.m | 36 ++++++---- Source/NSAttributedString.m | 6 ++ Source/NSCalendarDate.m | 14 ++-- Source/NSCharacterSet.m | 2 + Source/NSConnection.m | 6 +- Source/NSCountedSet.m | 2 + Source/NSData.m | 16 ++--- Source/NSDictionary.m | 44 ++++++------ Source/NSDistributedNotificationCenter.m | 4 +- Source/NSFileManager.m | 2 +- Source/NSMessagePort.m | 25 +++---- Source/NSMessagePortNameServer.m | 10 +-- Source/NSMethodSignature.m | 4 +- Source/NSNotification.m | 8 ++- Source/NSObject.m | 23 +++++-- Source/NSPipe.m | 4 +- Source/NSPortCoder.m | 14 ++-- Source/NSPropertyList.m | 10 +-- Source/NSRange.m | 4 +- Source/NSScanner.m | 42 +++++++----- Source/NSSerializer.m | 12 ++++ Source/NSSet.m | 4 ++ Source/NSSocketPort.m | 4 +- Source/NSSocketPortNameServer.m | 6 +- Source/NSString.m | 42 +++++++----- Source/NSThread.m | 87 ++++++++++++------------ Source/NSTimeZone.m | 5 +- Source/NSTimer.m | 6 +- Source/NSURLHandle.m | 20 +++--- Source/NSUnarchiver.m | 9 ++- Source/NSUserDefaults.m | 1 + Source/NSValue.m | 20 +++++- Source/mframe.m | 2 +- Tools/AGSHtml.m | 6 +- Tools/AGSIndex.m | 10 ++- Tools/AGSOutput.m | 5 +- Tools/gdomap.c | 23 ++++--- Tools/gdomap.h | 2 +- Tools/make_strings/make_strings.m | 6 +- 53 files changed, 502 insertions(+), 322 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31c29facf..db0bf84f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,61 @@ +2005-07-01 Richard Frith-Macdonald + + * Headers/Foundation/NSUserDefaults.h: Fix bad return type + * Source/GSArray.m: + * Source/GSCountedSet.m: + * Source/GSFileHandle.m: + * Source/GSSet.m: + * Source/GSString.m: + * Source/GSeq.h: + * Source/NSArchiver.m: + * Source/NSArray.m: + * Source/NSAttributedString.m: + * Source/NSCalendarDate.m: + * Source/NSCharacterSet.m: + * Source/NSConnection.m: + * Source/NSCountedSet.m: + * Source/NSData.m: + * Source/NSDictionary.m: + * Source/NSDistributedNotificationCenter.m: + * Source/NSFileManager.m: + * Source/NSMessagePort.m: + * Source/NSMessagePortNameServer.m: + * Source/NSMethodSignature.m: + * Source/NSNotification.m: + * Source/NSObject.m: + * Source/NSPipe.m: + * Source/NSPortCoder.m: + * Source/NSPropertyList.m: + * Source/NSRange.m: + * Source/NSScanner.m: + * Source/NSSerializer.m: + * Source/NSSet.m: + * Source/NSSocketPort.m: + * Source/NSSocketPortNameServer.m: + * Source/NSString.m: + * Source/NSThread.m: + * Source/NSTimeZone.m: + * Source/NSTimer.m: + * Source/NSURLHandle.m: + * Source/NSUnarchiver.m: + * Source/NSUserDefaults.m: + * Source/NSValue.m: + * Source/mframe.m: + * Source/Additions/GSCategories.m: + * Source/Additions/GSMime.m: + * Source/Additions/GSObjCRuntime.m: + * Source/Additions/GSXML.m: + * Source/Additions/Unicode.m: + * Tools/AGSHtml.m: + * Tools/AGSIndex.m: + * Tools/AGSOutput.m: + * Tools/gdomap.c: + * Tools/gdomap.h: + * Tools/make_strings/make_strings.m: + Tweaks to avoid compiler warnings with gcc-4. Mostly signed pointer + casts and bogus interface declarations to allow +class to be called + on a class for which we don't have the real interface visible. + 2005-07-01 Richard Frith-Macdonald * Source/NSException.m: ([-raise]) Fix behavior to be the same as in diff --git a/Headers/Foundation/NSUserDefaults.h b/Headers/Foundation/NSUserDefaults.h index a56a35334..1a215742a 100644 --- a/Headers/Foundation/NSUserDefaults.h +++ b/Headers/Foundation/NSUserDefaults.h @@ -252,7 +252,7 @@ GS_EXPORT NSString* const NSLocale; - (NSString*) stringForKey: (NSString*)defaultName; /* Returning the Search List */ -- (NSMutableArray*) searchList; +- (NSArray*) searchList; - (void) setSearchList: (NSArray*)newList; #ifndef STRICT_OPENSTEP - (void) addSuiteNamed: (NSString*)aName; diff --git a/Source/Additions/GSCategories.m b/Source/Additions/GSCategories.m index 6ad06cb9f..a6f08f9e0 100644 --- a/Source/Additions/GSCategories.m +++ b/Source/Additions/GSCategories.m @@ -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]; diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index 59f212d89..4d8cbd622 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -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); diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m index 3cf7c8764..433962ef1 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -54,8 +55,6 @@ #include -@class NSNull; - #ifdef NeXT_Foundation_LIBRARY @interface NSObject (MissingFromMacOSX) + (IMP) methodForSelector: (SEL)aSelector; diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m index 942f3aec9..2a9e003cc 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -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 ? */ diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index 302eb7790..acbb64149 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -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; diff --git a/Source/GSArray.m b/Source/GSArray.m index 33d288525..4184ee8e5 100644 --- a/Source/GSArray.m +++ b/Source/GSArray.m @@ -40,8 +40,19 @@ static SEL oaiSel; static Class GSInlineArrayClass; -@class GSArrayEnumerator; -@class GSArrayEnumeratorReverse; +@class GSArray; + +@interface GSArrayEnumerator : NSEnumerator +{ + GSArray *array; + unsigned pos; +} +- (id) initWithArray: (GSArray*)anArray; +@end + +@interface GSArrayEnumeratorReverse : GSArrayEnumerator +@end + @interface GSArray : NSArray { @@ -813,28 +824,24 @@ static Class GSInlineArrayClass; - (NSEnumerator*) objectEnumerator { - return AUTORELEASE([[GSArrayEnumerator allocWithZone: NSDefaultMallocZone()] - initWithArray: self]); + GSArrayEnumerator *enumerator; + + enumerator = [GSArrayEnumerator allocWithZone: NSDefaultMallocZone()]; + return AUTORELEASE([enumerator initWithArray: (GSArray*)self]); } - (NSEnumerator*) reverseObjectEnumerator { - return AUTORELEASE([[GSArrayEnumeratorReverse allocWithZone: - NSDefaultMallocZone()] initWithArray: self]); + GSArrayEnumeratorReverse *enumerator; + + enumerator = [GSArrayEnumeratorReverse allocWithZone: NSDefaultMallocZone()]; + return AUTORELEASE([enumerator initWithArray: (GSArray*)self]); } @end -@interface GSArrayEnumerator : NSEnumerator -{ - GSArray *array; - unsigned pos; -} -- (id) initWithArray: (GSArray*)anArray; -@end - @implementation GSArrayEnumerator - (id) initWithArray: (GSArray*)anArray @@ -861,9 +868,6 @@ static Class GSInlineArrayClass; @end -@interface GSArrayEnumeratorReverse : GSArrayEnumerator -@end - @implementation GSArrayEnumeratorReverse - (id) initWithArray: (GSArray*)anArray diff --git a/Source/GSCountedSet.m b/Source/GSCountedSet.m index 20b63f254..800eeb74e 100644 --- a/Source/GSCountedSet.m +++ b/Source/GSCountedSet.m @@ -101,7 +101,7 @@ * method) then the count for that object is incremented rather * than the new object being added. */ -- (void) addObject: (NSObject*)anObject +- (void) addObject: (id)anObject { GSIMapNode node; @@ -301,7 +301,7 @@ * [-isEqual:] method) has been added to the set. If the count * becomes zero, the object is removed from the set. */ -- (void) removeObject: (NSObject*)anObject +- (void) removeObject: (id)anObject { GSIMapBucket bucket; diff --git a/Source/GSFileHandle.m b/Source/GSFileHandle.m index 18af1e544..e905405a8 100644 --- a/Source/GSFileHandle.m +++ b/Source/GSFileHandle.m @@ -926,7 +926,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; #endif SOCKET net; struct sockaddr_in sin; - int size = sizeof(sin); + unsigned int size = sizeof(sin); if (getAddr(a, s, p, &sin) == NO) { @@ -2120,7 +2120,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; #else int desc; #endif - int blen = sizeof(buf); + unsigned int blen = sizeof(buf); #if defined(__MINGW__) desc = accept((SOCKET)_get_osfhandle(descriptor), (struct sockaddr*)&buf, &blen); @@ -2139,7 +2139,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { // Accept attempt completed. GSFileHandle *h; struct sockaddr_in sin; - int size = sizeof(sin); + unsigned int size = sizeof(sin); int status; /* @@ -2238,7 +2238,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; || operation == GSSOCKSConnect) { // Connection attempt completed. int result; - int len = sizeof(result); + unsigned len = sizeof(result); #if defined(__MINGW__) if (getsockopt((SOCKET)_get_osfhandle(descriptor), SOL_SOCKET, SO_ERROR, @@ -2496,7 +2496,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { NSString *str = nil; struct sockaddr_in sin; - int size = sizeof(sin); + unsigned size = sizeof(sin); if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) { @@ -2513,7 +2513,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { NSString *str = nil; struct sockaddr_in sin; - int size = sizeof(sin); + unsigned size = sizeof(sin); if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) { diff --git a/Source/GSSet.m b/Source/GSSet.m index 8754dad40..f4978142c 100644 --- a/Source/GSSet.m +++ b/Source/GSSet.m @@ -517,7 +517,7 @@ static Class mutableSetClass; } } -- (void) addObject: (NSObject*)anObject +- (void) addObject: (id)anObject { GSIMapNode node; @@ -665,7 +665,7 @@ static Class mutableSetClass; GSIMapCleanMap(&map); } -- (void) removeObject: (NSObject *)anObject +- (void) removeObject: (id)anObject { if (anObject == nil) { diff --git a/Source/GSString.m b/Source/GSString.m index 2512b9611..613c18bb5 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -410,7 +410,8 @@ setup(void) unichar *u = 0; unsigned l = 0; - if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, (const unsigned char*)chars, length, defEnc, + GSObjCZone(self), 0) == NO) { return nil; } @@ -444,7 +445,8 @@ setup(void) unichar *u = 0; unsigned l = 0; - if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, (const unsigned char*)chars, length, defEnc, + GSObjCZone(self), 0) == NO) { self = nil; } @@ -692,7 +694,7 @@ UTF8String_c(GSStr self) NSZoneFree(NSDefaultMallocZone(), u); } - return r; + return (char*)r; } static inline char* @@ -715,7 +717,7 @@ UTF8String_u(GSStr self) [NSException raise: NSCharacterConversionException format: @"Can't get UTF8 from Unicode string."]; } - return r; + return (char*)r; } } @@ -751,7 +753,7 @@ boolValue_c(GSStr self) memcpy(buf, self->_contents.c, len); buf[len] = '\0'; - return atoi(buf); + return atoi((const char*)buf); } } } @@ -787,7 +789,7 @@ boolValue_u(GSStr self) } else { - return atoi(buf); + return atoi((const char*)buf); } } } @@ -983,7 +985,7 @@ cString_c(GSStr self, NSStringEncoding enc) NSZoneFree(NSDefaultMallocZone(), u); } - return r; + return (char*)r; } static inline char* @@ -1015,7 +1017,7 @@ cString_u(GSStr self, NSStringEncoding enc) [NSException raise: NSCharacterConversionException format: @"Can't get cString from Unicode string."]; } - return r; + return (char*)r; } } @@ -1395,7 +1397,7 @@ intValue_c(GSStr self) memcpy(buf, self->_contents.c, len); buf[len] = '\0'; - return atol(buf); + return atol((const char*)buf); } } @@ -1413,7 +1415,7 @@ intValue_u(GSStr self) unsigned char *b = buf; GSFromUnicode(&b, &l, self->_contents.u, l, intEnc, 0, GSUniTerminate); - return atol(buf); + return atol((const char*)buf); } } @@ -1686,7 +1688,7 @@ static void GSStrMakeSpace(GSStr s, unsigned size) static void GSStrWiden(GSStr s) { unichar *tmp = 0; - int len = 0; + unsigned len = 0; NSCAssert(s->_flags.wide == 0, @"string is not wide"); @@ -1947,7 +1949,7 @@ substring_c(GSStr self, NSRange aRange) if (self->_flags.free == 1) { sub = NSAllocateObject(GSCSubStringClass, 0, NSDefaultMallocZone()); - sub = [sub initWithCString: self->_contents.c + aRange.location + sub = [sub initWithCString: (char*)self->_contents.c + aRange.location length: aRange.length fromParent: (GSCString *)self]; } @@ -1955,7 +1957,7 @@ substring_c(GSStr self, NSRange aRange) { sub = NSAllocateObject(GSCInlineStringClass, aRange.length, NSDefaultMallocZone()); - sub = [sub initWithCString: self->_contents.c + aRange.location + sub = [sub initWithCString: (char*)self->_contents.c + aRange.location length: aRange.length]; } AUTORELEASE(sub); @@ -2279,7 +2281,7 @@ transmute(GSStr self, NSString *aString) obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, NSDefaultMallocZone()); - obj = [obj initWithCString: _contents.c length: _count]; + obj = [obj initWithCString: (char*)_contents.c length: _count]; return obj; } @@ -2288,7 +2290,7 @@ transmute(GSStr self, NSString *aString) GSMutableString *obj; obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z); - obj = [obj initWithCString: _contents.c length: _count]; + obj = [obj initWithCString: (char*)_contents.c length: _count]; return obj; } @@ -2346,7 +2348,7 @@ agree, create a new GSCInlineString otherwise. NSString *obj; obj = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z); - obj = [obj initWithCString: _contents.c length: _count]; + obj = [obj initWithCString: (char*)_contents.c length: _count]; return obj; } else @@ -2370,7 +2372,7 @@ agree, create a new GSCInlineString otherwise. format: @"re-initialisation of string"]; } _count = length; - _contents.c = chars; + _contents.c = (unsigned char*)chars; _flags.wide = 0; if (flag == YES) { @@ -2442,7 +2444,7 @@ agree, create a new GSCInlineString otherwise. NSString *obj; obj = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z); - obj = [obj initWithCString: _contents.c length: _count]; + obj = [obj initWithCString: (char*)_contents.c length: _count]; return obj; } @@ -2902,7 +2904,7 @@ agree, create a new GSUnicodeInlineString otherwise. else { copy = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z); - copy = [copy initWithCString: _contents.c length: _count]; + copy = [copy initWithCString: (char*)_contents.c length: _count]; } return copy; } @@ -3130,7 +3132,8 @@ agree, create a new GSUnicodeInlineString otherwise. unichar *u = 0; unsigned l = 0; - if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, (unsigned char*)chars, length, defEnc, + GSObjCZone(self), 0) == NO) { DESTROY(self); } @@ -3160,7 +3163,7 @@ agree, create a new GSUnicodeInlineString otherwise. } _count = length; _capacity = length; - _contents.c = chars; + _contents.c = (unsigned char*)chars; _flags.wide = 0; return self; @@ -3270,7 +3273,7 @@ agree, create a new GSUnicodeInlineString otherwise. if (_flags.wide == 1) obj = [obj initWithCharacters: _contents.u length: _count]; else - obj = [obj initWithCString: _contents.c length: _count]; + obj = [obj initWithCString: (char*)_contents.c length: _count]; return obj; } @@ -3283,7 +3286,7 @@ agree, create a new GSUnicodeInlineString otherwise. if (_flags.wide == 1) obj = [obj initWithCharacters: _contents.u length: _count]; else - obj = [obj initWithCString: _contents.c length: _count]; + obj = [obj initWithCString: (char*)_contents.c length: _count]; return obj; } @@ -3393,7 +3396,7 @@ agree, create a new GSUnicodeInlineString otherwise. { unsigned char tmp = _contents.c[aRange.location + length]; - [aString getCString: &_contents.c[aRange.location] + [aString getCString: (char*)&_contents.c[aRange.location] maxLength: length]; _contents.c[aRange.location + length] = tmp; } @@ -3406,7 +3409,7 @@ agree, create a new GSUnicodeInlineString otherwise. if (l > 0) { - [aString getCString: &_contents.c[aRange.location] + [aString getCString: (char*)&_contents.c[aRange.location] maxLength: l]; } u = [aString characterAtIndex: l]; @@ -3475,7 +3478,7 @@ agree, create a new GSUnicodeInlineString otherwise. l = len - 1; if (l > 0) { - [aString getCString: _contents.c maxLength: l]; + [aString getCString: (char*)_contents.c maxLength: l]; } _contents.c[l] = encode_unitochar([aString characterAtIndex: l], intEnc); @@ -3514,7 +3517,7 @@ agree, create a new GSUnicodeInlineString otherwise. { sub = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, NSDefaultMallocZone()); - sub = [sub initWithCString: self->_contents.c + aRange.location + sub = [sub initWithCString: (char*)self->_contents.c + aRange.location length: aRange.length]; } AUTORELEASE(sub); @@ -3540,7 +3543,7 @@ agree, create a new GSUnicodeInlineString otherwise. sub = (NSString*)NSAllocateObject(GSCInlineStringClass, aRange.length, NSDefaultMallocZone()); - sub = [sub initWithCString: self->_contents.c + aRange.location + sub = [sub initWithCString: (char*)self->_contents.c + aRange.location length: aRange.length]; } AUTORELEASE(sub); @@ -4005,7 +4008,7 @@ agree, create a new GSUnicodeInlineString otherwise. - (const char*) cString { - return _self->_contents.c; + return (char*)_self->_contents.c; } - (id) retain @@ -4212,13 +4215,13 @@ agree, create a new GSUnicodeInlineString otherwise. [aCoder decodeArrayOfObjCType: @encode(unsigned char) count: count at: chars]; - self = [self initWithCStringNoCopy: chars + self = [self initWithCStringNoCopy: (char*)chars length: count freeWhenDone: YES]; } else { - self = [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO]; + self = [self initWithCStringNoCopy: (char*)0 length: 0 freeWhenDone: NO]; } return self; } @@ -4243,13 +4246,13 @@ agree, create a new GSUnicodeInlineString otherwise. [aCoder decodeArrayOfObjCType: @encode(unsigned char) count: count at: chars]; - self = [self initWithCStringNoCopy: chars + self = [self initWithCStringNoCopy: (char*)chars length: count freeWhenDone: YES]; } else { - self = [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO]; + self = [self initWithCStringNoCopy: (char*)0 length: 0 freeWhenDone: NO]; } return self; } diff --git a/Source/GSeq.h b/Source/GSeq.h index 19e5a8c4b..8450a9dee 100644 --- a/Source/GSeq.h +++ b/Source/GSeq.h @@ -394,7 +394,7 @@ GSEQ_STRCOMP(NSString *ss, NSString *os, unsigned mask, NSRange aRange) #if GSEQ_S == GSEQ_US unichar *sBuf; #else - char *sBuf; + unsigned char *sBuf; #endif #endif #if GSEQ_O == GSEQ_NS @@ -404,7 +404,7 @@ GSEQ_STRCOMP(NSString *ss, NSString *os, unsigned mask, NSRange aRange) #if GSEQ_O == GSEQ_US unichar *oBuf; #else - char *oBuf; + unsigned char *oBuf; #endif #endif diff --git a/Source/NSArchiver.m b/Source/NSArchiver.m index 5cf2fe28d..3a0963b0c 100644 --- a/Source/NSArchiver.m +++ b/Source/NSArchiver.m @@ -56,6 +56,17 @@ NSString * const NSInconsistentArchiveException = #define PREFIX "GNUstep archive" +static SEL serSel; +static SEL tagSel; +static SEL xRefSel; +static SEL eObjSel; +static SEL eValSel; + +@class NSMutableDataMalloc; +@interface NSMutableDataMalloc : NSObject // Help the compiler +@end +static Class NSMutableDataMallocClass; + /** *

Implementation of [NSCoder] capable of creating sequential archives which * must be read in the same order they were written. This class implements @@ -68,15 +79,6 @@ NSString * const NSInconsistentArchiveException = */ @implementation NSArchiver -static SEL serSel; -static SEL tagSel; -static SEL xRefSel; -static SEL eObjSel; -static SEL eValSel; - -@class NSMutableDataMalloc; -static Class NSMutableDataMallocClass; - + (void) initialize { if (self == [NSArchiver class]) @@ -327,8 +329,8 @@ static Class NSMutableDataMallocClass; objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSArray.m b/Source/NSArray.m index 82a86bc88..6dcd192e7 100644 --- a/Source/NSArray.m +++ b/Source/NSArray.m @@ -53,13 +53,32 @@ extern BOOL GSMacOSXCompatiblePropertyLists(void); extern void GSPropertyListMake(id,NSDictionary*,BOOL,BOOL,unsigned,id*); -@class NSArrayEnumerator; -@class NSArrayEnumeratorReverse; +@interface NSArrayEnumerator : NSEnumerator +{ + NSArray *array; + unsigned pos; + IMP get; + unsigned (*cnt)(NSArray*, SEL); +} +- (id) initWithArray: (NSArray*)anArray; +@end +@interface NSArrayEnumeratorReverse : NSArrayEnumerator +@end + + @class GSArray; +@interface GSArray : NSObject // Help the compiler +@end @class GSInlineArray; +@interface GSInlineArray : NSObject // Help the compiler +@end @class GSMutableArray; +@interface GSMutableArray : NSObject // Help the compiler +@end @class GSPlaceholderArray; +@interface GSPlaceholderArray : NSObject // Help the compiler +@end static Class NSArrayClass; static Class GSArrayClass; @@ -1898,16 +1917,6 @@ compare(id elem1, id elem2, void* context) } @end -@interface NSArrayEnumerator : NSEnumerator -{ - NSArray *array; - unsigned pos; - IMP get; - unsigned (*cnt)(NSArray*, SEL); -} -- (id) initWithArray: (NSArray*)anArray; -@end - @implementation NSArrayEnumerator - (id) initWithArray: (NSArray*)anArray @@ -1945,9 +1954,6 @@ compare(id elem1, id elem2, void* context) @end -@interface NSArrayEnumeratorReverse : NSArrayEnumerator -@end - @implementation NSArrayEnumeratorReverse - (id) initWithArray: (NSArray*)anArray diff --git a/Source/NSAttributedString.m b/Source/NSAttributedString.m index 4b53a7e21..5a4332d85 100644 --- a/Source/NSAttributedString.m +++ b/Source/NSAttributedString.m @@ -57,8 +57,14 @@ #include "Foundation/NSRange.h" @class GSAttributedString; +@interface GSAttributedString : NSObject // Help the compiler +@end @class GSMutableAttributedString; +@interface GSMutableAttributedString : NSObject // Help the compiler +@end @class GSMutableDictionary; +@interface GSMutableDictionary : NSObject // Help the compiler +@end static Class dictionaryClass = 0; static SEL eqSel; diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index d10286a2c..0a1d00469 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -60,7 +60,15 @@ #define GREGORIAN_REFERENCE 730486 @class GSTimeZone; +@interface GSTimeZone : NSObject // Help the compiler +@end @class GSAbsTimeZone; +@interface GSAbsTimeZone : NSObject // Help the compiler +@end +@class NSGDate; +@interface NSGDate : NSObject // Help the compiler +@end + static NSString *cformat = @"%Y-%m-%d %H:%M:%S %z"; @@ -276,8 +284,6 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, *mil = (a - h - m - c) * 1000; } -@class NSGDate; - /** * An [NSDate] subclass which understands about timezones and provides * methods for dealing with date and time information by calendar and @@ -1763,8 +1769,8 @@ static void Grow(DescriptionInfo *info, unsigned size) unsigned char tmp[16]; int idx = 0; - sprintf(tmp, "%d", v); - Grow(info, strlen(tmp)); + sprintf((char*)tmp, "%d", v); + Grow(info, strlen((char*)tmp)); while (tmp[idx] != '\0') { info->t[info->offset++] = tmp[idx++]; diff --git a/Source/NSCharacterSet.m b/Source/NSCharacterSet.m index 62f129f47..cd03c5c70 100644 --- a/Source/NSCharacterSet.m +++ b/Source/NSCharacterSet.m @@ -53,6 +53,8 @@ #endif @class NSDataStatic; +@interface NSDataStatic : NSObject // Help the compiler +@end @interface NSBitmapCharSet : NSCharacterSet { diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 750cb6b5c..cccb98b03 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -1814,7 +1814,7 @@ static void retEncoder (DOContext *ctxt) NSParameterAssert(type); NSParameterAssert(*type); - ctxt.encoder = [self _makeOutRmc: 0 generate: &ctxt.seq reply: YES]; + ctxt.encoder = [self _makeOutRmc: 0 generate: (int*)&ctxt.seq reply: YES]; if (debug_connection > 4) NSLog(@"building packet seq %d", ctxt.seq); @@ -1951,7 +1951,7 @@ static void retEncoder (DOContext *ctxt) memset(&ctxt, 0, sizeof(ctxt)); ctxt.connection = self; - op = [self _makeOutRmc: 0 generate: &ctxt.seq reply: YES]; + op = [self _makeOutRmc: 0 generate: (int*)&ctxt.seq reply: YES]; if (debug_connection > 4) NSLog(@"building packet seq %d", ctxt.seq); @@ -2635,7 +2635,7 @@ static void callEncoder (DOContext *ctxt) * while we run the NSRunLoop. Raise exception if we don't get anything * before timing out. */ -- _getReplyRmc: (int)sn +- (NSPortCoder*) _getReplyRmc: (int)sn { NSPortCoder *rmc; GSIMapNode node = 0; diff --git a/Source/NSCountedSet.m b/Source/NSCountedSet.m index 6f39ef407..04ae4f170 100644 --- a/Source/NSCountedSet.m +++ b/Source/NSCountedSet.m @@ -37,6 +37,8 @@ #include "Foundation/NSObjCRuntime.h" @class GSCountedSet; +@interface GSCountedSet : NSObject // Help the compiler +@end /* * Class variables for uniquing objects; diff --git a/Source/NSData.m b/Source/NSData.m index 48f5c9dc6..5d7a3211e 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -1206,8 +1206,8 @@ failure: objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); @@ -2063,8 +2063,8 @@ failure: objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); @@ -2524,8 +2524,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); @@ -3328,8 +3328,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index 3c16100db..0e0fe3b57 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -43,6 +43,30 @@ #include "GNUstepBase/GSCategories.h" #include "GSPrivate.h" +@class GSDictionary; +@interface GSDictionary : NSObject // Help the compiler +@end +@class GSMutableDictionary; +@interface GSMutableDictionary : NSObject // Help the compiler +@end + +extern BOOL GSMacOSXCompatiblePropertyLists(void); +extern void GSPropertyListMake(id,NSDictionary*,BOOL,BOOL,unsigned,id*); + + +static Class NSArray_class; +static Class NSDictionaryClass; +static Class NSMutableDictionaryClass; +static Class GSDictionaryClass; +static Class GSMutableDictionaryClass; + +static SEL eqSel; +static SEL nxtSel; +static SEL objSel; +static SEL remSel; +static SEL setSel; +static SEL appSel; + /** *

This class and its subclasses store key-value pairs, where the key and * the value are objects. A great many utility methods for working with @@ -67,26 +91,6 @@ */ @implementation NSDictionary -@class GSDictionary; -@class GSMutableDictionary; - -extern BOOL GSMacOSXCompatiblePropertyLists(void); -extern void GSPropertyListMake(id,NSDictionary*,BOOL,BOOL,unsigned,id*); - - -static Class NSArray_class; -static Class NSDictionaryClass; -static Class NSMutableDictionaryClass; -static Class GSDictionaryClass; -static Class GSMutableDictionaryClass; - -static SEL eqSel; -static SEL nxtSel; -static SEL objSel; -static SEL remSel; -static SEL setSel; -static SEL appSel; - + (void) initialize { if (self == [NSDictionary class]) diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index f9feafc41..c44b2578a 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -115,7 +115,7 @@ static NSDistributedNotificationCenter *netCenter = nil; * equivalent to calling +notificationCenterForType: with * NSLocalNotificationCenterType as its argument. */ -+ (id) defaultCenter ++ (NSNotificationCenter*) defaultCenter { return [self notificationCenterForType: NSLocalNotificationCenterType]; } @@ -132,7 +132,7 @@ static NSDistributedNotificationCenter *netCenter = nil; * a notificatiuon center used by processes on the local network.
* MacOS-X supports only NSLocalNotificationCenterType. */ -+ (id) notificationCenterForType: (NSString*)type ++ (NSNotificationCenter*) notificationCenterForType: (NSString*)type { if ([type isEqual: NSLocalNotificationCenterType] == YES) { diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index b69975410..910965892 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -3075,7 +3075,7 @@ static NSSet *fileKeys = nil; return [GSAttrDictionaryEnumerator enumeratorFor: self]; } -- (id) objectForKey: (NSString*)key +- (id) objectForKey: (id)key { int count = 0; diff --git a/Source/NSMessagePort.m b/Source/NSMessagePort.m index f3e9c621b..f7a692f1d 100644 --- a/Source/NSMessagePort.m +++ b/Source/NSMessagePort.m @@ -170,8 +170,8 @@ typedef struct { } GSPortMsgHeader; typedef struct { - char version; - char addr[0]; /* name of the socket in the port directory */ + unsigned char version; + unsigned char addr[0]; /* name of the socket in the port directory */ } GSPortInfo; /* @@ -271,14 +271,14 @@ newDataWithEncodedPort(NSMessagePort *port) unsigned plen; const unsigned char *name = [port _name]; - plen = 2 + strlen(name); + plen = 2 + strlen((char*)name); data = [[NSMutableData alloc] initWithLength: sizeof(GSPortItemHeader)+plen]; pih = (GSPortItemHeader*)[data mutableBytes]; pih->type = GSSwapHostI32ToBig(GSP_PORT); pih->length = GSSwapHostI32ToBig(plen); pi = (GSPortInfo*)&pih[1]; - strcpy(pi->addr, name); + strcpy((char*)pi->addr, (char*)name); NSDebugFLLog(@"NSMessagePort", @"Encoded port as '%s'", pi->addr); @@ -409,7 +409,7 @@ static Class runLoopClass; name = [aPort _name]; memset(&sockAddr, '\0', sizeof(sockAddr)); sockAddr.sun_family = AF_LOCAL; - strncpy(sockAddr.sun_path, name, sizeof(sockAddr.sun_path)); + strncpy(sockAddr.sun_path, (char*)name, sizeof(sockAddr.sun_path)); if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0) { @@ -927,8 +927,8 @@ static Class runLoopClass; { if (state == GS_H_TRYCON) /* Connection attempt. */ { - int res = 0; - int len = sizeof(res); + int res = 0; + unsigned len = sizeof(res); if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) == 0 && res != 0) @@ -1216,8 +1216,8 @@ static int unique_index = 0; [[NSProcessInfo processInfo] processIdentifier], unique_index++]]; M_UNLOCK(messagePortLock); - return RETAIN([self _portWithName: [path fileSystemRepresentation] - listener: YES]); + return RETAIN([self _portWithName: + (unsigned char*)[path fileSystemRepresentation] listener: YES]); } /* @@ -1233,7 +1233,7 @@ static int unique_index = 0; NSData *theName; theName = [[NSData alloc] initWithBytes: socketName - length: strlen(socketName)+1]; + length: strlen((char*)socketName)+1]; M_LOCK(messagePortLock); @@ -1263,7 +1263,8 @@ static int unique_index = 0; */ memset(&sockaddr, '\0', sizeof(sockaddr)); sockaddr.sun_family = AF_LOCAL; - strncpy(sockaddr.sun_path, socketName, sizeof(sockaddr.sun_path)); + strncpy(sockaddr.sun_path, (char*)socketName, + sizeof(sockaddr.sun_path)); /* * Need size of buffer for getsockbyname() later. @@ -1625,7 +1626,7 @@ static int unique_index = 0; if (desc == listener) { struct sockaddr_un sockAddr; - int size = sizeof(sockAddr); + unsigned size = sizeof(sockAddr); desc = accept(listener, (struct sockaddr*)&sockAddr, &size); if (desc < 0) diff --git a/Source/NSMessagePortNameServer.m b/Source/NSMessagePortNameServer.m index 3e3472d97..f126e970d 100644 --- a/Source/NSMessagePortNameServer.m +++ b/Source/NSMessagePortNameServer.m @@ -251,7 +251,7 @@ static void clean_up_names(void) NSDebugLLog(@"NSMessagePort", @"got %s", socket_path); - return [NSMessagePort _portWithName: socket_path + return [NSMessagePort _portWithName: (unsigned char*)socket_path listener: NO]; } @@ -290,10 +290,10 @@ static void clean_up_names(void) socket_name = [(NSMessagePort *)port _name]; - write(fd, socket_name, strlen(socket_name)); + write(fd, (char*)socket_name, strlen((char*)socket_name)); write(fd, "\n", 1); - sprintf(buf, "%i\n", getpid()); - write(fd, buf, strlen(buf)); + sprintf((char*)buf, "%i\n", getpid()); + write(fd, (char*)buf, strlen((char*)buf)); close(fd); @@ -376,7 +376,7 @@ static void clean_up_names(void) port_path = [(NSMessagePort *)port _name]; - if (!strcmp(socket_path, port_path)) + if (!strcmp((char*)socket_path, (char*)port_path)) { unlink([path fileSystemRepresentation]); } diff --git a/Source/NSMethodSignature.m b/Source/NSMethodSignature.m index 11f529d62..8a2a33641 100644 --- a/Source/NSMethodSignature.m +++ b/Source/NSMethodSignature.m @@ -46,8 +46,8 @@ return nil; } newMs = AUTORELEASE([NSMethodSignature alloc]); - newMs->_methodTypes = mframe_build_signature(t, &newMs->_argFrameLength, - &newMs->_numArgs, 0); + newMs->_methodTypes = mframe_build_signature(t, (int*)&newMs->_argFrameLength, + (int*)&newMs->_numArgs, 0); return newMs; } diff --git a/Source/NSNotification.m b/Source/NSNotification.m index e690fa8c1..28051341a 100644 --- a/Source/NSNotification.m +++ b/Source/NSNotification.m @@ -29,6 +29,10 @@ #include "Foundation/NSCoder.h" #include "Foundation/NSString.h" +@class GSNotification; +@interface GSNotification : NSObject // Help the compiler +@end + /** *

Represents a notification for posting to an [NSNotificationCenter]. * Consists of a name, an object, and an optional dictionary. The @@ -43,9 +47,7 @@ static Class abstractClass = 0; static Class concreteClass = 0; -@class GSNotification; - -+ (NSNotification*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { if (self == abstractClass) { diff --git a/Source/NSObject.m b/Source/NSObject.m index 91d5d86fe..d45b906aa 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -31,6 +31,7 @@ #include #include "Foundation/NSMethodSignature.h" #include "Foundation/NSInvocation.h" +#include "Foundation/NSLock.h" #include "Foundation/NSAutoreleasePool.h" #include "Foundation/NSString.h" #include "Foundation/NSArray.h" @@ -75,6 +76,16 @@ static Class NSConstantStringClass; @class NSDataMalloc; @class NSMutableDataMalloc; +@interface NSZombie +{ + Class isa; +} +- (Class) class; +- (retval_t) forward:(SEL)aSel :(arglist_t)argFrame; +- (void) forwardInvocation: (NSInvocation*)anInvocation; +- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector; +@end + /* * allocationLock is needed when running multi-threaded for retain/release * to work reliably. @@ -1513,7 +1524,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) /** * This method is called automatically to handle a message sent to * the receiver for which the receivers class has no method.
- * The default implemnentation calls -doesNotRecognizeSelector: + * The default implementation calls -doesNotRecognizeSelector: */ - (void) forwardInvocation: (NSInvocation*)anInvocation { @@ -2421,13 +2432,11 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) -@interface NSZombie -- (retval_t) forward:(SEL)aSel :(arglist_t)argFrame; -- (void) forwardInvocation: (NSInvocation*)anInvocation; -- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector; -@end - @implementation NSZombie +- (Class) class +{ + return object_get_class(self); +} - (retval_t) forward:(SEL)aSel :(arglist_t)argFrame { if (aSel == 0) diff --git a/Source/NSPipe.m b/Source/NSPipe.m index f1f37ab60..4cf079a22 100644 --- a/Source/NSPipe.m +++ b/Source/NSPipe.m @@ -103,7 +103,7 @@ /** * Returns the file handle for reading from the pipe. */ -- (id) fileHandleForReading +- (NSFileHandle*) fileHandleForReading { return readHandle; } @@ -111,7 +111,7 @@ /** * Returns the file handle for writing to the pipe. */ -- (id) fileHandleForWriting +- (NSFileHandle*) fileHandleForWriting { return writeHandle; } diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index f54ad62db..3768eb0be 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -46,6 +46,10 @@ #include "Foundation/NSPort.h" #include "Foundation/NSString.h" +@class NSMutableDataMalloc; +@interface NSMutableDataMalloc : NSObject // Help the compiler +@end + /* * Setup for inline operation of pointer map tables. */ @@ -295,8 +299,6 @@ typeCheck(char t1, char t2) @implementation NSPortCoder -@class NSMutableDataMalloc; - static Class connectionClass; static Class mutableArrayClass; static Class mutableDataClass; @@ -742,8 +744,8 @@ static IMP _xRefImp; /* Serialize a crossref. */ objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); @@ -1347,8 +1349,8 @@ static IMP _xRefImp; /* Serialize a crossref. */ objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 45abc7a79..4382c6f53 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -49,10 +49,12 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*); -@class GSString; -@class GSMutableString; @class GSMutableArray; +@interface GSMutableArray : NSObject // Help the compiler +@end @class GSMutableDictionary; +@interface GSMutableDictionary : NSObject // Help the compiler +@end @interface GSBinaryPLParser : NSObject { @@ -2750,8 +2752,8 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, else if ((next >= 0x50) && (next < 0x5F)) { // Short string - unsigned len = next - 0x50; - unsigned char buffer[len+1]; + unsigned len = next - 0x50; + char buffer[len+1]; [data getBytes: buffer range: NSMakeRange(counter, len)]; buffer[len] = '\0'; diff --git a/Source/NSRange.m b/Source/NSRange.m index f91f39e15..0957dc488 100644 --- a/Source/NSRange.m +++ b/Source/NSRange.m @@ -73,11 +73,11 @@ NSRangeFromString(NSString *aString) if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL) && (*scanStringImp)(scanner, scanStringSel, @"location", NULL) && (*scanStringImp)(scanner, scanStringSel, @"=", NULL) - && (*scanIntImp)(scanner, scanIntSel, &range.location) + && (*scanIntImp)(scanner, scanIntSel, (int*)&range.location) && (*scanStringImp)(scanner, scanStringSel, @",", NULL) && (*scanStringImp)(scanner, scanStringSel, @"length", NULL) && (*scanStringImp)(scanner, scanStringSel, @"=", NULL) - && (*scanIntImp)(scanner, scanIntSel, &range.length) + && (*scanIntImp)(scanner, scanIntSel, (int*)&range.length) && (*scanStringImp)(scanner, scanStringSel, @"}", NULL)) return range; else diff --git a/Source/NSScanner.m b/Source/NSScanner.m index 72079fc22..9ac816a2d 100644 --- a/Source/NSScanner.m +++ b/Source/NSScanner.m @@ -51,26 +51,17 @@ #define ULONG_LONG_MAX ULLONG_MAX #endif -/** - *

- * The NSScanner class cluster (currently a single class in - * GNUstep) provides a mechanism to parse the contents of a string into - * number and string values by making a sequence of scan operations to - * step through the string retrieving successive items. - *

- *

- * You can tell the scanner whether its scanning is supposed to be - * case sensitive or not, and you can specify a set of characters - * to be skipped before each scanning operation (by default, - * whitespace and newlines). - *

- */ -@implementation NSScanner @class GSCString; +@interface GSCString : NSObject // Help the compiler +@end @class GSUnicodeString; +@interface GSUnicodeString : NSObject // Help the compiler +@end @class GSMutableString; @class GSPlaceholderString; +@interface GSPlaceholderString : NSObject // Help the compiler +@end static Class NSStringClass; static Class GSCStringClass; @@ -106,6 +97,22 @@ typedef struct { (_scanLocation >= myLength()) ? NO : YES;\ }) +/** + *

+ * The NSScanner class cluster (currently a single class in + * GNUstep) provides a mechanism to parse the contents of a string into + * number and string values by making a sequence of scan operations to + * step through the string retrieving successive items. + *

+ *

+ * You can tell the scanner whether its scanning is supposed to be + * case sensitive or not, and you can specify a set of characters + * to be skipped before each scanning operation (by default, + * whitespace and newlines). + *

+ */ +@implementation NSScanner + + (void) initialize { if (self == [NSScanner class]) @@ -195,8 +202,9 @@ typedef struct { else { _isUnicode = NO; - _string = [_holder initWithCString: ((ivars)aString)->_contents.c - length: ((ivars)aString)->_count]; + _string = [_holder initWithCString: + (char*)((ivars)aString)->_contents.c + length: ((ivars)aString)->_count]; } } else if (c == NSConstantStringClass) diff --git a/Source/NSSerializer.m b/Source/NSSerializer.m index 3321b2ab0..520458ea3 100644 --- a/Source/NSSerializer.m +++ b/Source/NSSerializer.m @@ -43,13 +43,25 @@ @class GSDictionary; @class GSMutableDictionary; +@interface GSMutableDictionary : NSObject // Help the compiler +@end @class NSDataMalloc; +@interface NSDataMalloc : NSObject // Help the compiler +@end @class GSInlineArray; @class GSMutableArray; +@interface GSMutableArray : NSObject // Help the compiler +@end @class GSCString; +@interface GSCString : NSObject // Help the compiler +@end @class GSCBufferString; +@interface GSCBufferString : NSObject // Help the compiler +@end @class GSUnicodeString; @class GSUnicodeBufferString; +@interface GSUnicodeBufferString : NSObject // Help the compiler +@end @class GSMutableString; /* diff --git a/Source/NSSet.m b/Source/NSSet.m index 9ace1d0dd..18c6e1277 100644 --- a/Source/NSSet.m +++ b/Source/NSSet.m @@ -39,7 +39,11 @@ #include "GSPrivate.h" @class GSSet; +@interface GSSet : NSObject // Help the compiler +@end @class GSMutableSet; +@interface GSMutableSet : NSObject // Help the compiler +@end /** * NSSet maintains an unordered collection of unique objects diff --git a/Source/NSSocketPort.m b/Source/NSSocketPort.m index 7580fcada..7b092af97 100644 --- a/Source/NSSocketPort.m +++ b/Source/NSSocketPort.m @@ -1076,7 +1076,7 @@ static Class runLoopClass; if (state == GS_H_TRYCON) /* Connection attempt. */ { int res = 0; - int len = sizeof(res); + unsigned len = sizeof(res); if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) == 0 && res != 0) @@ -2117,7 +2117,7 @@ static unsigned wordAlign; #endif { struct sockaddr_in sockAddr; - int size = sizeof(sockAddr); + unsigned size = sizeof(sockAddr); desc = accept(listener, (struct sockaddr*)&sockAddr, &size); if (desc == INVALID_SOCKET) diff --git a/Source/NSSocketPortNameServer.m b/Source/NSSocketPortNameServer.m index 7119ea368..98117e5c5 100644 --- a/Source/NSSocketPortNameServer.m +++ b/Source/NSSocketPortNameServer.m @@ -483,7 +483,7 @@ typedef enum { msg.ptype = GDO_TCP_GDO; /* Port is TCP port for GNU DO */ msg.port = 0; msg.nsize = [name cStringLength]; - [name getCString: msg.name]; + [name getCString: (char*)msg.name]; TEST_RELEASE(data); data = [NSMutableData dataWithBytes: (void*)&msg length: sizeof(msg)]; IF_NO_GC(RETAIN(data)); @@ -495,7 +495,7 @@ typedef enum { msg.rtype = GDO_REGISTER; /* Register a port. */ msg.ptype = GDO_TCP_GDO; /* Port is TCP port for GNU DO */ msg.nsize = [name cStringLength]; - [name getCString: msg.name]; + [name getCString: (char*)msg.name]; msg.port = GSSwapHostI32ToBig(portNumber); TEST_RELEASE(data); data = [NSMutableData dataWithBytes: (void*)&msg length: sizeof(msg)]; @@ -514,7 +514,7 @@ typedef enum { else { msg.nsize = [name cStringLength]; - [name getCString: msg.name]; + [name getCString: (char*)msg.name]; } msg.port = GSSwapHostI32ToBig(portNumber); TEST_RELEASE(data); diff --git a/Source/NSString.m b/Source/NSString.m index 9e43f187b..627bfe739 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -89,8 +89,16 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*); @class GSString; @class GSMutableString; @class GSPlaceholderString; +@interface GSPlaceholderString : NSObject // Help the compiler +@end @class GSMutableArray; @class GSMutableDictionary; +@class NSImmutableString; +@interface NSImmutableString : NSObject // Help the compiler +@end +@class GSImmutableString; +@interface GSImmutableString : NSObject // Help the compiler +@end /* @@ -1144,8 +1152,8 @@ handle_printf_atsign (FILE *stream, unichar *buf = 0; unsigned int l = 0; - if (GSToUnicode(&buf, &l, byteString, length, _DefaultStringEncoding, - [self zone], 0) == NO) + if (GSToUnicode(&buf, &l, (unsigned char*)byteString, length, + _DefaultStringEncoding, [self zone], 0) == NO) { DESTROY(self); } @@ -1279,8 +1287,8 @@ handle_printf_atsign (FILE *stream, unichar *u = 0; unsigned int l = 0; - if (GSToUnicode(&u, &l, bytes, length, NSUTF8StringEncoding, - GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, (unsigned char*)bytes, length, + NSUTF8StringEncoding, GSObjCZone(self), 0) == NO) { DESTROY(self); } @@ -1396,7 +1404,7 @@ handle_printf_atsign (FILE *stream, } else { - self = [self initWithCString: f._contents.c length: f._count]; + self = [self initWithCString: (char*)f._contents.c length: f._count]; } /* @@ -1475,7 +1483,7 @@ handle_printf_atsign (FILE *stream, if (i == len) { - self = [self initWithCString: bytes length: len]; + self = [self initWithCString: (char*)bytes length: len]; } else { @@ -3340,7 +3348,7 @@ handle_printf_atsign (FILE *stream, else { unsigned char *b = 0; - int l = 0; + unsigned l = 0; unichar *u; u = (unichar*)NSZoneMalloc(NSDefaultMallocZone(), len*sizeof(unichar)); @@ -4862,7 +4870,7 @@ static NSFileManager *fm = nil; else if (enc == NSASCIIStringEncoding || enc == _DefaultStringEncoding) { - unsigned char *chars; + char *chars; chars = NSZoneMalloc(zone, count+1); [aCoder decodeArrayOfObjCType: @encode(unsigned char) @@ -4881,7 +4889,7 @@ static NSFileManager *fm = nil; count: count at: chars]; chars[count] = '\0'; - self = [self initWithUTF8String: chars]; + self = [self initWithUTF8String: (char*)chars]; NSZoneFree(zone, chars); } else @@ -5041,7 +5049,7 @@ static NSFileManager *fm = nil; /** * Constructs an empty string. */ -+ (NSMutableString*) string ++ (id) string { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCapacity: 0]); @@ -5060,8 +5068,8 @@ static NSFileManager *fm = nil; * Create a string of unicode characters. */ // Inefficient implementation. -+ (NSString*) stringWithCharacters: (const unichar*)characters - length: (unsigned int)length ++ (id) stringWithCharacters: (const unichar*)characters + length: (unsigned int)length { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCharacters: characters length: length]); @@ -5083,7 +5091,7 @@ static NSFileManager *fm = nil; * null-terminated and encoded in the default C string encoding. (Characters * will be converted to unicode representation internally.) */ -+ (NSString*) stringWithCString: (const char*)byteString ++ (id) stringWithCString: (const char*)byteString { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCString: byteString]); @@ -5094,8 +5102,8 @@ static NSFileManager *fm = nil; * null bytes and should be encoded in the default C string encoding. * (Characters will be converted to unicode representation internally.) */ -+ (NSString*) stringWithCString: (const char*)byteString - length: (unsigned int)length ++ (id) stringWithCString: (const char*)byteString + length: (unsigned int)length { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCString: byteString length: length]); @@ -5106,7 +5114,7 @@ static NSFileManager *fm = nil; * be a constant format string, like '@"float val = %f"', remaining * arguments should be the variables to print the values of, comma-separated. */ -+ (NSString*) stringWithFormat: (NSString*)format, ... ++ (id) stringWithFormat: (NSString*)format, ... { va_list ap; va_start(ap, format); @@ -5305,8 +5313,6 @@ static NSFileManager *fm = nil; * The methods in this category are not available in MacOS-X */ @implementation NSMutableString (GNUstep) -@class NSImmutableString; -@class GSImmutableString; /** * Returns a proxy to the receiver which will allow access to the diff --git a/Source/NSThread.m b/Source/NSThread.m index dcafc2068..385c6da2f 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -53,13 +53,55 @@ #include "Foundation/NSConnection.h" #include "Foundation/NSInvocation.h" -@class GSPerformHolder; typedef struct { @defs(NSThread) } NSThread_ivars; static Class threadClass = Nil; static NSNotificationCenter *nc = nil; +/** + * This class performs a dual function ... + *

+ * As a class, it is responsible for handling incoming events from + * the main runloop on a special inputFd. This consumes any bytes + * written to wake the main runloop.
+ * During initialisation, the default runloop is set up to watch + * for data arriving on inputFd. + *

+ *

+ * As instances, each instance retains perform receiver and argument + * values as long as they are needed, and handles locking to support + * mthods which want to block until an action has been performed. + *

+ *

+ * The initialize method of this class is called before any new threads + * run. + *

+ */ +@interface GSPerformHolder : NSObject +{ + id receiver; + id argument; + SEL selector; + NSArray *modes; + NSConditionLock *lock; // Not retained. +} ++ (BOOL) isValid; ++ (GSPerformHolder*) newForReceiver: (id)r + argument: (id)a + selector: (SEL)s + modes: (NSArray*)m + lock: (NSConditionLock*)l; ++ (void) receivedEvent: (void*)data + type: (RunLoopEventType)type + extra: (void*)extra + forMode: (NSString*)mode; ++ (NSDate*) timedOutEvent: (void*)data + type: (RunLoopEventType)type + forMode: (NSString*)mode; +- (void) fire; +@end + /** * Sleep until the current date/time is the specified time interval * past the reference date/time.
@@ -748,49 +790,6 @@ gnustep_base_thread_callback(void) -/** - * This class performs a dual function ... - *

- * As a class, it is responsible for handling incoming events from - * the main runloop on a special inputFd. This consumes any bytes - * written to wake the main runloop.
- * During initialisation, the default runloop is set up to watch - * for data arriving on inputFd. - *

- *

- * As instances, each instance retains perform receiver and argument - * values as long as they are needed, and handles locking to support - * mthods which want to block until an action has been performed. - *

- *

- * The initialize method of this class is called before any new threads - * run. - *

- */ -@interface GSPerformHolder : NSObject -{ - id receiver; - id argument; - SEL selector; - NSArray *modes; - NSConditionLock *lock; // Not retained. -} -+ (BOOL) isValid; -+ (GSPerformHolder*) newForReceiver: (id)r - argument: (id)a - selector: (SEL)s - modes: (NSArray*)m - lock: (NSConditionLock*)l; -+ (void) receivedEvent: (void*)data - type: (RunLoopEventType)type - extra: (void*)extra - forMode: (NSString*)mode; -+ (NSDate*) timedOutEvent: (void*)data - type: (RunLoopEventType)type - forMode: (NSString*)mode; -- (void) fire; -@end - @implementation GSPerformHolder static NSLock *subthreadsLock = nil; diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index c4481c673..ad4b26f1c 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -2250,7 +2250,7 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type) types[i].offset = decode(ptr->offset); pos += sizeof(struct ttinfo); } - abbr = (char*)(bytes + pos); + abbr = (unsigned char*)(bytes + pos); { id abbrevs[charcnt]; @@ -2261,7 +2261,8 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type) if (abbrevs[loc] == nil) { - abbrevs[loc] = [[NSString alloc] initWithCString: abbr + loc]; + abbrevs[loc] + = [[NSString alloc] initWithCString: (char*)abbr + loc]; } else { diff --git a/Source/NSTimer.m b/Source/NSTimer.m index 76d822fac..7bd79d789 100644 --- a/Source/NSTimer.m +++ b/Source/NSTimer.m @@ -34,6 +34,8 @@ #include "Foundation/NSInvocation.h" @class NSGDate; +@interface NSGDate : NSObject // Help the compiler +@end static Class NSDate_class; /** @@ -329,7 +331,7 @@ static Class NSDate_class; /** * Compares timers based on the date at which they should next fire. */ -- (NSComparisonResult) compare: (NSTimer*)anotherTimer +- (NSComparisonResult) compare: (id)anotherTimer { if (anotherTimer == self) { @@ -342,7 +344,7 @@ static Class NSDate_class; } else { - return [_date compare: anotherTimer->_date]; + return [_date compare: ((NSTimer*)anotherTimer)->_date]; } return 0; } diff --git a/Source/NSURLHandle.m b/Source/NSURLHandle.m index 636b636cf..0f621a502 100644 --- a/Source/NSURLHandle.m +++ b/Source/NSURLHandle.m @@ -38,9 +38,20 @@ #include "Foundation/NSRunLoop.h" #include "Foundation/NSFileManager.h" -@class GSFileURLHandle; + @class GSFTPURLHandle; +@interface GSFTPURLHandle : NSObject // Help the compiler +@end @class GSHTTPURLHandle; +@interface GSHTTPURLHandle : NSObject // Help the compiler +@end + +@interface GSFileURLHandle : NSURLHandle +{ + NSString *_path; + NSMutableDictionary *_attributes; +} +@end /* * Keys for NSURLHandle @@ -593,13 +604,6 @@ static Class NSURLHandleClass = 0; @end -@interface GSFileURLHandle : NSURLHandle -{ - NSString *_path; - NSMutableDictionary *_attributes; -} -@end - /** *

* This is a PRIVATE subclass of NSURLHandle. diff --git a/Source/NSUnarchiver.m b/Source/NSUnarchiver.m index df5c0fdab..8de3b3bfd 100644 --- a/Source/NSUnarchiver.m +++ b/Source/NSUnarchiver.m @@ -51,6 +51,10 @@ #include "Foundation/NSString.h" #include "Foundation/NSArray.h" +@class NSDataMalloc; +@interface NSDataMalloc : NSObject // Help the compiler +@end + static const char* typeToName1(char type) { @@ -341,7 +345,6 @@ mapClassName(NSUnarchiverObjectInfo *info) */ @implementation NSUnarchiver -@class NSDataMalloc; static Class NSDataMallocClass; + (void) initialize @@ -803,8 +806,8 @@ static Class NSDataMallocClass; objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - int offset; - int align; + unsigned offset; + unsigned align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 09ae8254d..138be2a0c 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -36,6 +36,7 @@ #include "Foundation/NSArchiver.h" #include "Foundation/NSArray.h" #include "Foundation/NSBundle.h" +#include "Foundation/NSData.h" #include "Foundation/NSDate.h" #include "Foundation/NSDictionary.h" #include "Foundation/NSDistributedLock.h" diff --git a/Source/NSValue.m b/Source/NSValue.m index eeaa093b5..30bdb19ef 100644 --- a/Source/NSValue.m +++ b/Source/NSValue.m @@ -42,12 +42,30 @@ @end @class GSValue; +@interface GSValue : NSObject // Help the compiler +@end @class GSNonretainedObjectValue; +@interface GSNonretainedObjectValue : NSObject // Help the compiler +@end @class GSPointValue; +@interface GSPointValue : NSObject // Help the compiler +@end @class GSPointerValue; +@interface GSPointerValue : NSObject // Help the compiler +@end @class GSRangeValue; +@interface GSRangeValue : NSObject // Help the compiler +@end @class GSRectValue; +@interface GSRectValue : NSObject // Help the compiler +@end @class GSSizeValue; +@interface GSSizeValue : NSObject // Help the compiler +@end +@class NSDataStatic; // Needed for decoding. +@interface NSDataStatic : NSObject // Help the compiler +@end + static Class abstractClass; static Class concreteClass; @@ -386,8 +404,6 @@ static NSLock *placeholderLock; RELEASE(d); } -@class NSDataStatic; // Neede for decoding. - - (id) initWithCoder: (NSCoder *)coder { char type[64]; diff --git a/Source/mframe.m b/Source/mframe.m index c729f42d8..4faa5290b 100644 --- a/Source/mframe.m +++ b/Source/mframe.m @@ -1573,7 +1573,7 @@ mframe_destroy_argframe(const char *types, arglist_t argframe) BOOL mframe_decode_return (const char *type, void* buffer, void* retframe) { - int size = 0; + unsigned int size = 0; type = objc_skip_type_qualifiers(type); NSGetSizeAndAlignment(type, &size, 0); diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index dc27d95a1..be4b8bf02 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -399,13 +399,15 @@ static NSString *mainFont = nil; else if (classname != nil && category == nil) { NSArray *catNames; + NSDictionary *d; /* * For a class, we want to list methods in any associated * categories as well as those of the class itself. */ - catNames = [[[refs objectForKey: @"categories"] - objectForKey: classname] allKeys]; + d = [refs objectForKey: @"categories"]; + d = [d objectForKey: classname]; + catNames = [d allKeys]; if ((c = [catNames count]) > 0) { NSMutableDictionary *m = [dict mutableCopy]; diff --git a/Tools/AGSIndex.m b/Tools/AGSIndex.m index 2ce9c666c..fcf3f9d2f 100644 --- a/Tools/AGSIndex.m +++ b/Tools/AGSIndex.m @@ -487,10 +487,14 @@ setDirectory(NSMutableDictionary *dict, NSString *path) //PENDING, should we worry about not overriding entries? while ((name = [pnames nextObject]) != nil) { - file = [[refs objectForKey: @"category"] objectForKey: name]; + NSMutableDictionary *d; + + d = [refs objectForKey: @"category"]; + file = [d objectForKey: name]; if (file != nil) { - [[refs objectForKey: @"protocol"] setObject: file forKey: name]; + d = [refs objectForKey: @"protocol"]; + [d setObject: file forKey: name]; } else { @@ -661,7 +665,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path) /** * Return a list of source files for the header. */ -- (NSArray*) sourcesForHeader: (NSString*)h +- (NSMutableArray*) sourcesForHeader: (NSString*)h { NSDictionary *dict = [refs objectForKey: @"source"]; NSArray *array = [dict objectForKey: h]; diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 94763693d..d1eebfdbe 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -756,8 +756,11 @@ static BOOL snuggleStart(NSString *t) while (i-- > 0) { - NSString *n = [[aa objectAtIndex: i] objectForKey: @"Name"]; + NSString *n; + NSDictionary *d; + d = [aa objectAtIndex: i]; + n = [d objectForKey: @"Name"]; if (n != nil) { [tmp addObject: n]; diff --git a/Tools/gdomap.c b/Tools/gdomap.c index 7a7f03462..2bddb86db 100644 --- a/Tools/gdomap.c +++ b/Tools/gdomap.c @@ -179,7 +179,7 @@ static void init_iface(); static void load_iface(const char* from); static void init_ports(); static void init_probe(); -static void queue_msg(struct sockaddr_in* a, uptr d, int l); +static void queue_msg(struct sockaddr_in* a, uptr d, unsigned l); static void queue_pop(); static void queue_probe(struct in_addr* to, struct in_addr *from, int num_extras, struct in_addr* extra, int is_reply); @@ -575,7 +575,7 @@ static int udp_pending = 0; * on the UDP socket. */ static void -queue_msg(struct sockaddr_in* a, uptr d, int l) +queue_msg(struct sockaddr_in* a, uptr d, unsigned l) { struct u_data* entry = (struct u_data*)malloc(sizeof(struct u_data)); @@ -657,7 +657,7 @@ map_add(uptr n, unsigned char l, unsigned int p, unsigned char t) int i; m->port = p; - m->name = (char*)malloc(l); + m->name = (unsigned char*)malloc(l); m->size = l; m->net = (t & GDO_NET_MASK); m->svc = (t & GDO_SVC_MASK); @@ -1258,7 +1258,7 @@ init_iface() if (addr != 0) free(addr); addr = (struct in_addr*)malloc((MAX_IFACE+1)*IASIZE); if (bcok != 0) free(bcok); - bcok = (char*)malloc((MAX_IFACE+1)*sizeof(char)); + bcok = (unsigned char*)malloc((MAX_IFACE+1)*sizeof(char)); if (bcst != 0) free(bcst); bcst = (struct in_addr*)malloc((MAX_IFACE+1)*IASIZE); if (mask != 0) free(mask); @@ -1469,7 +1469,7 @@ load_iface(const char* from) num_iface++; addr = (struct in_addr*)malloc((num_iface+1)*IASIZE); mask = (struct in_addr*)malloc((num_iface+1)*IASIZE); - bcok = (char*)malloc((num_iface+1)*sizeof(char)); + bcok = (unsigned char*)malloc((num_iface+1)*sizeof(char)); bcst = (struct in_addr*)malloc((num_iface+1)*IASIZE); addr[interfaces].s_addr = inet_addr("127.0.0.1"); @@ -2151,7 +2151,7 @@ static void handle_accept() { struct sockaddr_in sa; - int len = sizeof(sa); + unsigned len = sizeof(sa); int desc; desc = accept(tcp_desc, (void*)&sa, &len); @@ -2478,7 +2478,7 @@ handle_recv() RInfo *ri; uptr ptr; struct sockaddr_in* addr; - int len = sizeof(struct sockaddr_in); + unsigned len = sizeof(struct sockaddr_in); int r; ri = getRInfo(udp_desc, 0); @@ -2543,7 +2543,7 @@ handle_request(int desc) size = ri->buf.r.nsize; ptype = ri->buf.r.ptype; port = ntohl(ri->buf.r.port); - buf = ri->buf.r.name; + buf = (unsigned char*)ri->buf.r.name; FD_CLR(desc, &read_fds); FD_SET(desc, &write_fds); @@ -3147,7 +3147,7 @@ handle_request(int desc) */ if (desc == udp_desc) { - queue_msg(&ri->addr, wi->buf, wi->len); + queue_msg(&ri->addr, (unsigned char*)wi->buf, wi->len); clear_chan(desc); } } @@ -3892,7 +3892,8 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd continue; } - if (tryHost(GDO_LOOKUP, len, name, ptype, &sin, &port, 0)==0) + if (tryHost(GDO_LOOKUP, len, (unsigned char*)name, + ptype, &sin, &port, 0)==0) { if (port != 0) { @@ -3923,7 +3924,7 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd { port = (unsigned short)pnum; } - rval = tryHost(op, len, name, ptype, &sin, &port, 0); + rval = tryHost(op, len, (unsigned char*)name, ptype, &sin, &port, 0); if (rval != 0 && host == local_hostname) { sprintf(ebuf, "failed to contact gdomap on %s(%s) - %s", diff --git a/Tools/gdomap.h b/Tools/gdomap.h index 46c908176..8c9a94d1c 100644 --- a/Tools/gdomap.h +++ b/Tools/gdomap.h @@ -212,7 +212,7 @@ typedef struct { unsigned char ptype; /* Type of port registered. */ unsigned char dummy; unsigned int port; - char name[GDO_NAME_MAX_LEN+1]; + unsigned char name[GDO_NAME_MAX_LEN+1]; } gdo_req; #define GDO_REQ_SIZE sizeof(gdo_req) /* Size of a request packet. */ diff --git a/Tools/make_strings/make_strings.m b/Tools/make_strings/make_strings.m index 0b919c57b..27f3b40e3 100644 --- a/Tools/make_strings/make_strings.m +++ b/Tools/make_strings/make_strings.m @@ -347,17 +347,17 @@ static int ParseFile(const char *filename,NSMutableDictionary *tables) NSString *key,*comment,*table; /* TODO: let user specify source file encoding */ - key=[NSString stringWithCString: args[lf->key_index]]; + key=[NSString stringWithCString: (char*)args[lf->key_index]]; if (lf->comment_index==-1 || !arg_len[lf->comment_index]) comment=nil; else - comment=[NSString stringWithCString: args[lf->comment_index]]; + comment=[NSString stringWithCString: (char*)args[lf->comment_index]]; if (lf->table_index==-1) table=@"Localizable"; /* TODO: customizable? */ else - table=[NSString stringWithCString: args[lf->table_index]]; + table=[NSString stringWithCString: (char*)args[lf->table_index]]; e=[[SourceEntry alloc] initWithKey: key comment: comment file: filenamestr line: cur_line]; [tables addEntry: e toTable: table];