diff --git a/ChangeLog b/ChangeLog index db0bf84f7..b8eae2884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-01 Richard Frith-Macdonald + + * The last change passed regression tests etc, but one program + I have has stopped working, so there is a bug somewhere. + Reverted change until I can isolate the problem and fix it. + 2005-07-01 Richard Frith-Macdonald * Headers/Foundation/NSUserDefaults.h: Fix bad return type diff --git a/Headers/Foundation/NSUserDefaults.h b/Headers/Foundation/NSUserDefaults.h index 1a215742a..a56a35334 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 */ -- (NSArray*) searchList; +- (NSMutableArray*) 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 a6f08f9e0..6ad06cb9f 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((const char*)bytes, "begin ", 6) == 0) + else if (pos > 6 && strncmp(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((char*)buf, "begin %03o ", mode); - [encoded appendBytes: buf length: strlen((const char*)buf)]; + sprintf(buf, "begin %03o ", mode); + [encoded appendBytes: buf length: strlen(buf)]; [encoded appendData: [name dataUsingEncoding: NSASCIIStringEncoding]]; [encoded appendBytes: "\n" length: 1]; diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index 4d8cbd622..59f212d89 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 unsigned char *src) +decodebase64(unsigned char *dst, const 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(unsigned char *dst, const unsigned char *src, int length) +encodebase64(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((char*)buffer, "encoding") == 0) + if (strcasecmp(buffer, "encoding") == 0) { found = YES; } @@ -1615,7 +1615,7 @@ wordData(NSString *word) b[0] = '-'; b[1] = '-'; - [tmp getCString: (char*)&b[2]]; + [tmp getCString: &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: (const char *)tmp]; + s = [s initWithCString: tmp]; enc = [documentClass encodingFromCharset: s]; RELEASE(s); @@ -3318,8 +3318,8 @@ static NSCharacterSet *tokenSet = nil; { int length; int declen ; - const unsigned char *src; - const unsigned char *end; + const signed char *src; + const signed 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 unsigned char*)[source bytes]; + src = (const 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 433962ef1..3cf7c8764 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -55,6 +54,8 @@ #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 2a9e003cc..942f3aec9 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -107,11 +107,6 @@ 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) { @@ -349,7 +344,7 @@ static NSMapTable *attrNames = 0; */ + (GSXMLDocument*) documentWithVersion: (NSString*)version { - void *data = xmlNewDoc(UTF8STRING(version)); + void *data = xmlNewDoc([version UTF8String]); GSXMLDocument *document = nil; if (data == 0) @@ -453,7 +448,7 @@ static NSMapTable *attrNames = 0; GSXMLNode *n = [GSXMLNode alloc]; n = [n _initFrom: - xmlNewDocNode(lib, [ns lib], UTF8STRING(name), UTF8STRING(content)) + xmlNewDocNode(lib, [ns lib], [name UTF8String], [content UTF8String]) parent: self]; return AUTORELEASE(n); } @@ -1146,7 +1141,7 @@ static NSMapTable *nodeNames = 0; { void *l; - l = xmlNewProp((xmlNodePtr)[self lib], UTF8STRING(name), UTF8STRING(value)); + l = xmlNewProp((xmlNodePtr)[self lib], [name cString], [value cString]); return AUTORELEASE([[GSXMLAttribute alloc] _initFrom: l parent: self]); } @@ -1187,7 +1182,7 @@ static NSMapTable *nodeNames = 0; GSXMLNode *n = [GSXMLNode alloc]; n = [n _initFrom: - xmlNewTextChild(lib, [ns lib], UTF8STRING(name), UTF8STRING(content)) + xmlNewTextChild(lib, [ns lib], [name UTF8String], [content UTF8String]) parent: self]; return AUTORELEASE(n); } @@ -1209,7 +1204,7 @@ static NSMapTable *nodeNames = 0; GSXMLNode *n = [GSXMLNode alloc]; n = [n _initFrom: - xmlAddChild((xmlNodePtr)lib, xmlNewText(UTF8STRING(content))) + xmlAddChild((xmlNodePtr)lib, xmlNewText([content UTF8String])) parent: self]; return AUTORELEASE(n); } @@ -1231,7 +1226,7 @@ static NSMapTable *nodeNames = 0; GSXMLNode *n = [GSXMLNode alloc]; n = [n _initFrom: - xmlAddChild((xmlNodePtr)lib, xmlNewComment(UTF8STRING(content))) + xmlAddChild((xmlNodePtr)lib, xmlNewComment([content UTF8String])) parent: self]; return AUTORELEASE(n); } @@ -1244,7 +1239,7 @@ static NSMapTable *nodeNames = 0; { void *data; - data = xmlNewNs((xmlNodePtr)lib, UTF8STRING(href), UTF8STRING(prefix)); + data = xmlNewNs((xmlNodePtr)lib, [href UTF8String], [prefix UTF8String]); if (data == NULL) { NSLog(@"Can't create GSXMLNamespace object"); @@ -1271,8 +1266,8 @@ static NSMapTable *nodeNames = 0; GSXMLNode *n = [GSXMLNode alloc]; n = [n _initFrom: - xmlAddChild((xmlNodePtr)lib, xmlNewPI(UTF8STRING(name), - UTF8STRING(content))) parent: self]; + xmlAddChild((xmlNodePtr)lib, xmlNewPI([name UTF8String], + [content UTF8String])) parent: self]; return AUTORELEASE(n); } @@ -1528,7 +1523,7 @@ static NSMapTable *nodeNames = 0; */ - (void) setObject: (NSString*)value forKey: (NSString*)key { - xmlSetProp(lib, UTF8STRING(key), UTF8STRING(value)); + xmlSetProp(lib, [key UTF8String], [value UTF8String]); } /** @@ -1847,7 +1842,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 = (const unsigned char*)""; + if (ctxt->input != NULL) ctxt->input->cur = ""; } } @@ -2275,7 +2270,7 @@ static NSString *endMarker = @"At end of incremental parse"; - (BOOL) _initLibXML { - const char *file; + const unsigned char *file; if ([src isKindOfClass: NSString_class]) { @@ -2841,7 +2836,7 @@ processingInstructionFunction(void *ctx, const unsigned char *target, { NSCAssert(ctx,@"No Context"); [HANDLER processInstruction: UTF8Str(target) - data: UTF8Str((const unsigned char*)data)]; + data: UTF8Str(data)]; } static void @@ -3603,7 +3598,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) - (NSString *) stringValue { xmlChar *string = ((xmlXPathObject*)_lib)->stringval; - return [NSString_class stringWithUTF8String: (const char*)string]; + return [NSString_class stringWithUTF8String: string]; } - (NSString *) description { @@ -3717,7 +3712,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) xmlXPathObject *res; GSXPathObject *result; - comp = xmlXPathCompile (UTF8STRING(XPathExpression)); + comp = xmlXPathCompile ([XPathExpression UTF8String]); if (comp == NULL) { /* Maybe an exception would be better ? */ diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index acbb64149..302eb7790 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -1031,8 +1031,7 @@ int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl, BOOL result; unsigned int old = dl; - result = GSToUnicode(&dst, (unsigned int*)&dl, (unsigned char*)src, - sl, enc, 0, 0); + result = GSToUnicode(&dst, &dl, src, sl, enc, 0, 0); if (result == NO) { return 0; diff --git a/Source/DocMakefile b/Source/DocMakefile index 3dd725a60..437145810 100644 --- a/Source/DocMakefile +++ b/Source/DocMakefile @@ -67,6 +67,7 @@ NSIndexSet.h \ NSInvocation.h \ NSKeyedArchiver.h \ NSKeyValueCoding.h \ +NSKeyValueObserving.h \ NSLock.h \ NSMapTable.h \ NSMethodSignature.h \ diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 447be8e78..3f1925b1b 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -192,6 +192,7 @@ NSInvocation.m \ NSKeyedArchiver.m \ NSKeyedUnarchiver.m \ NSKeyValueCoding.m \ +NSKeyValueObserving.m \ NSLock.m \ NSLog.m \ NSMapTable.m \ @@ -310,6 +311,7 @@ NSIndexSet.h \ NSInvocation.h \ NSKeyedArchiver.h \ NSKeyValueCoding.h \ +NSKeyValueObserving.h \ NSLock.h \ NSMapTable.h \ NSMethodSignature.h \ diff --git a/Source/GSArray.m b/Source/GSArray.m index 4184ee8e5..33d288525 100644 --- a/Source/GSArray.m +++ b/Source/GSArray.m @@ -40,19 +40,8 @@ static SEL oaiSel; static Class GSInlineArrayClass; -@class GSArray; - -@interface GSArrayEnumerator : NSEnumerator -{ - GSArray *array; - unsigned pos; -} -- (id) initWithArray: (GSArray*)anArray; -@end - -@interface GSArrayEnumeratorReverse : GSArrayEnumerator -@end - +@class GSArrayEnumerator; +@class GSArrayEnumeratorReverse; @interface GSArray : NSArray { @@ -824,24 +813,28 @@ static Class GSInlineArrayClass; - (NSEnumerator*) objectEnumerator { - GSArrayEnumerator *enumerator; - - enumerator = [GSArrayEnumerator allocWithZone: NSDefaultMallocZone()]; - return AUTORELEASE([enumerator initWithArray: (GSArray*)self]); + return AUTORELEASE([[GSArrayEnumerator allocWithZone: NSDefaultMallocZone()] + initWithArray: self]); } - (NSEnumerator*) reverseObjectEnumerator { - GSArrayEnumeratorReverse *enumerator; - - enumerator = [GSArrayEnumeratorReverse allocWithZone: NSDefaultMallocZone()]; - return AUTORELEASE([enumerator initWithArray: (GSArray*)self]); + return AUTORELEASE([[GSArrayEnumeratorReverse allocWithZone: + NSDefaultMallocZone()] initWithArray: self]); } @end +@interface GSArrayEnumerator : NSEnumerator +{ + GSArray *array; + unsigned pos; +} +- (id) initWithArray: (GSArray*)anArray; +@end + @implementation GSArrayEnumerator - (id) initWithArray: (GSArray*)anArray @@ -868,6 +861,9 @@ 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 800eeb74e..20b63f254 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: (id)anObject +- (void) addObject: (NSObject*)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: (id)anObject +- (void) removeObject: (NSObject*)anObject { GSIMapBucket bucket; diff --git a/Source/GSFileHandle.m b/Source/GSFileHandle.m index e905405a8..18af1e544 100644 --- a/Source/GSFileHandle.m +++ b/Source/GSFileHandle.m @@ -926,7 +926,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; #endif SOCKET net; struct sockaddr_in sin; - unsigned int size = sizeof(sin); + int size = sizeof(sin); if (getAddr(a, s, p, &sin) == NO) { @@ -2120,7 +2120,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; #else int desc; #endif - unsigned int blen = sizeof(buf); + 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; - unsigned int size = sizeof(sin); + int size = sizeof(sin); int status; /* @@ -2238,7 +2238,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; || operation == GSSOCKSConnect) { // Connection attempt completed. int result; - unsigned len = sizeof(result); + int 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; - unsigned size = sizeof(sin); + int 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; - unsigned size = sizeof(sin); + int size = sizeof(sin); if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) { diff --git a/Source/GSSet.m b/Source/GSSet.m index f4978142c..8754dad40 100644 --- a/Source/GSSet.m +++ b/Source/GSSet.m @@ -517,7 +517,7 @@ static Class mutableSetClass; } } -- (void) addObject: (id)anObject +- (void) addObject: (NSObject*)anObject { GSIMapNode node; @@ -665,7 +665,7 @@ static Class mutableSetClass; GSIMapCleanMap(&map); } -- (void) removeObject: (id)anObject +- (void) removeObject: (NSObject *)anObject { if (anObject == nil) { diff --git a/Source/GSString.m b/Source/GSString.m index 613c18bb5..2512b9611 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -410,8 +410,7 @@ setup(void) unichar *u = 0; unsigned l = 0; - if (GSToUnicode(&u, &l, (const unsigned char*)chars, length, defEnc, - GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO) { return nil; } @@ -445,8 +444,7 @@ setup(void) unichar *u = 0; unsigned l = 0; - if (GSToUnicode(&u, &l, (const unsigned char*)chars, length, defEnc, - GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO) { self = nil; } @@ -694,7 +692,7 @@ UTF8String_c(GSStr self) NSZoneFree(NSDefaultMallocZone(), u); } - return (char*)r; + return r; } static inline char* @@ -717,7 +715,7 @@ UTF8String_u(GSStr self) [NSException raise: NSCharacterConversionException format: @"Can't get UTF8 from Unicode string."]; } - return (char*)r; + return r; } } @@ -753,7 +751,7 @@ boolValue_c(GSStr self) memcpy(buf, self->_contents.c, len); buf[len] = '\0'; - return atoi((const char*)buf); + return atoi(buf); } } } @@ -789,7 +787,7 @@ boolValue_u(GSStr self) } else { - return atoi((const char*)buf); + return atoi(buf); } } } @@ -985,7 +983,7 @@ cString_c(GSStr self, NSStringEncoding enc) NSZoneFree(NSDefaultMallocZone(), u); } - return (char*)r; + return r; } static inline char* @@ -1017,7 +1015,7 @@ cString_u(GSStr self, NSStringEncoding enc) [NSException raise: NSCharacterConversionException format: @"Can't get cString from Unicode string."]; } - return (char*)r; + return r; } } @@ -1397,7 +1395,7 @@ intValue_c(GSStr self) memcpy(buf, self->_contents.c, len); buf[len] = '\0'; - return atol((const char*)buf); + return atol(buf); } } @@ -1415,7 +1413,7 @@ intValue_u(GSStr self) unsigned char *b = buf; GSFromUnicode(&b, &l, self->_contents.u, l, intEnc, 0, GSUniTerminate); - return atol((const char*)buf); + return atol(buf); } } @@ -1688,7 +1686,7 @@ static void GSStrMakeSpace(GSStr s, unsigned size) static void GSStrWiden(GSStr s) { unichar *tmp = 0; - unsigned len = 0; + int len = 0; NSCAssert(s->_flags.wide == 0, @"string is not wide"); @@ -1949,7 +1947,7 @@ substring_c(GSStr self, NSRange aRange) if (self->_flags.free == 1) { sub = NSAllocateObject(GSCSubStringClass, 0, NSDefaultMallocZone()); - sub = [sub initWithCString: (char*)self->_contents.c + aRange.location + sub = [sub initWithCString: self->_contents.c + aRange.location length: aRange.length fromParent: (GSCString *)self]; } @@ -1957,7 +1955,7 @@ substring_c(GSStr self, NSRange aRange) { sub = NSAllocateObject(GSCInlineStringClass, aRange.length, NSDefaultMallocZone()); - sub = [sub initWithCString: (char*)self->_contents.c + aRange.location + sub = [sub initWithCString: self->_contents.c + aRange.location length: aRange.length]; } AUTORELEASE(sub); @@ -2281,7 +2279,7 @@ transmute(GSStr self, NSString *aString) obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, NSDefaultMallocZone()); - obj = [obj initWithCString: (char*)_contents.c length: _count]; + obj = [obj initWithCString: _contents.c length: _count]; return obj; } @@ -2290,7 +2288,7 @@ transmute(GSStr self, NSString *aString) GSMutableString *obj; obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z); - obj = [obj initWithCString: (char*)_contents.c length: _count]; + obj = [obj initWithCString: _contents.c length: _count]; return obj; } @@ -2348,7 +2346,7 @@ agree, create a new GSCInlineString otherwise. NSString *obj; obj = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z); - obj = [obj initWithCString: (char*)_contents.c length: _count]; + obj = [obj initWithCString: _contents.c length: _count]; return obj; } else @@ -2372,7 +2370,7 @@ agree, create a new GSCInlineString otherwise. format: @"re-initialisation of string"]; } _count = length; - _contents.c = (unsigned char*)chars; + _contents.c = chars; _flags.wide = 0; if (flag == YES) { @@ -2444,7 +2442,7 @@ agree, create a new GSCInlineString otherwise. NSString *obj; obj = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z); - obj = [obj initWithCString: (char*)_contents.c length: _count]; + obj = [obj initWithCString: _contents.c length: _count]; return obj; } @@ -2904,7 +2902,7 @@ agree, create a new GSUnicodeInlineString otherwise. else { copy = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z); - copy = [copy initWithCString: (char*)_contents.c length: _count]; + copy = [copy initWithCString: _contents.c length: _count]; } return copy; } @@ -3132,8 +3130,7 @@ agree, create a new GSUnicodeInlineString otherwise. unichar *u = 0; unsigned l = 0; - if (GSToUnicode(&u, &l, (unsigned char*)chars, length, defEnc, - GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO) { DESTROY(self); } @@ -3163,7 +3160,7 @@ agree, create a new GSUnicodeInlineString otherwise. } _count = length; _capacity = length; - _contents.c = (unsigned char*)chars; + _contents.c = chars; _flags.wide = 0; return self; @@ -3273,7 +3270,7 @@ agree, create a new GSUnicodeInlineString otherwise. if (_flags.wide == 1) obj = [obj initWithCharacters: _contents.u length: _count]; else - obj = [obj initWithCString: (char*)_contents.c length: _count]; + obj = [obj initWithCString: _contents.c length: _count]; return obj; } @@ -3286,7 +3283,7 @@ agree, create a new GSUnicodeInlineString otherwise. if (_flags.wide == 1) obj = [obj initWithCharacters: _contents.u length: _count]; else - obj = [obj initWithCString: (char*)_contents.c length: _count]; + obj = [obj initWithCString: _contents.c length: _count]; return obj; } @@ -3396,7 +3393,7 @@ agree, create a new GSUnicodeInlineString otherwise. { unsigned char tmp = _contents.c[aRange.location + length]; - [aString getCString: (char*)&_contents.c[aRange.location] + [aString getCString: &_contents.c[aRange.location] maxLength: length]; _contents.c[aRange.location + length] = tmp; } @@ -3409,7 +3406,7 @@ agree, create a new GSUnicodeInlineString otherwise. if (l > 0) { - [aString getCString: (char*)&_contents.c[aRange.location] + [aString getCString: &_contents.c[aRange.location] maxLength: l]; } u = [aString characterAtIndex: l]; @@ -3478,7 +3475,7 @@ agree, create a new GSUnicodeInlineString otherwise. l = len - 1; if (l > 0) { - [aString getCString: (char*)_contents.c maxLength: l]; + [aString getCString: _contents.c maxLength: l]; } _contents.c[l] = encode_unitochar([aString characterAtIndex: l], intEnc); @@ -3517,7 +3514,7 @@ agree, create a new GSUnicodeInlineString otherwise. { sub = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, NSDefaultMallocZone()); - sub = [sub initWithCString: (char*)self->_contents.c + aRange.location + sub = [sub initWithCString: self->_contents.c + aRange.location length: aRange.length]; } AUTORELEASE(sub); @@ -3543,7 +3540,7 @@ agree, create a new GSUnicodeInlineString otherwise. sub = (NSString*)NSAllocateObject(GSCInlineStringClass, aRange.length, NSDefaultMallocZone()); - sub = [sub initWithCString: (char*)self->_contents.c + aRange.location + sub = [sub initWithCString: self->_contents.c + aRange.location length: aRange.length]; } AUTORELEASE(sub); @@ -4008,7 +4005,7 @@ agree, create a new GSUnicodeInlineString otherwise. - (const char*) cString { - return (char*)_self->_contents.c; + return _self->_contents.c; } - (id) retain @@ -4215,13 +4212,13 @@ agree, create a new GSUnicodeInlineString otherwise. [aCoder decodeArrayOfObjCType: @encode(unsigned char) count: count at: chars]; - self = [self initWithCStringNoCopy: (char*)chars + self = [self initWithCStringNoCopy: chars length: count freeWhenDone: YES]; } else { - self = [self initWithCStringNoCopy: (char*)0 length: 0 freeWhenDone: NO]; + self = [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO]; } return self; } @@ -4246,13 +4243,13 @@ agree, create a new GSUnicodeInlineString otherwise. [aCoder decodeArrayOfObjCType: @encode(unsigned char) count: count at: chars]; - self = [self initWithCStringNoCopy: (char*)chars + self = [self initWithCStringNoCopy: chars length: count freeWhenDone: YES]; } else { - self = [self initWithCStringNoCopy: (char*)0 length: 0 freeWhenDone: NO]; + self = [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO]; } return self; } diff --git a/Source/GSeq.h b/Source/GSeq.h index 8450a9dee..19e5a8c4b 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 - unsigned char *sBuf; + 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 - unsigned char *oBuf; + char *oBuf; #endif #endif diff --git a/Source/NSArchiver.m b/Source/NSArchiver.m index 3a0963b0c..5cf2fe28d 100644 --- a/Source/NSArchiver.m +++ b/Source/NSArchiver.m @@ -56,17 +56,6 @@ 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 @@ -79,6 +68,15 @@ static Class NSMutableDataMallocClass; */ @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]) @@ -329,8 +327,8 @@ static Class NSMutableDataMallocClass; objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - unsigned offset; - unsigned align; + int offset; + int align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSArray.m b/Source/NSArray.m index 6dcd192e7..82a86bc88 100644 --- a/Source/NSArray.m +++ b/Source/NSArray.m @@ -53,32 +53,13 @@ extern BOOL GSMacOSXCompatiblePropertyLists(void); extern void GSPropertyListMake(id,NSDictionary*,BOOL,BOOL,unsigned,id*); -@interface NSArrayEnumerator : NSEnumerator -{ - NSArray *array; - unsigned pos; - IMP get; - unsigned (*cnt)(NSArray*, SEL); -} -- (id) initWithArray: (NSArray*)anArray; -@end -@interface NSArrayEnumeratorReverse : NSArrayEnumerator -@end - - +@class NSArrayEnumerator; +@class NSArrayEnumeratorReverse; @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; @@ -1917,6 +1898,16 @@ 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 @@ -1954,6 +1945,9 @@ 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 5a4332d85..4b53a7e21 100644 --- a/Source/NSAttributedString.m +++ b/Source/NSAttributedString.m @@ -57,14 +57,8 @@ #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 0a1d00469..d10286a2c 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -60,15 +60,7 @@ #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"; @@ -284,6 +276,8 @@ 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 @@ -1769,8 +1763,8 @@ static void Grow(DescriptionInfo *info, unsigned size) unsigned char tmp[16]; int idx = 0; - sprintf((char*)tmp, "%d", v); - Grow(info, strlen((char*)tmp)); + sprintf(tmp, "%d", v); + Grow(info, strlen(tmp)); while (tmp[idx] != '\0') { info->t[info->offset++] = tmp[idx++]; diff --git a/Source/NSCharacterSet.m b/Source/NSCharacterSet.m index cd03c5c70..62f129f47 100644 --- a/Source/NSCharacterSet.m +++ b/Source/NSCharacterSet.m @@ -53,8 +53,6 @@ #endif @class NSDataStatic; -@interface NSDataStatic : NSObject // Help the compiler -@end @interface NSBitmapCharSet : NSCharacterSet { diff --git a/Source/NSConnection.m b/Source/NSConnection.m index cccb98b03..750cb6b5c 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: (int*)&ctxt.seq reply: YES]; + ctxt.encoder = [self _makeOutRmc: 0 generate: &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: (int*)&ctxt.seq reply: YES]; + op = [self _makeOutRmc: 0 generate: &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. */ -- (NSPortCoder*) _getReplyRmc: (int)sn +- _getReplyRmc: (int)sn { NSPortCoder *rmc; GSIMapNode node = 0; diff --git a/Source/NSCountedSet.m b/Source/NSCountedSet.m index 04ae4f170..6f39ef407 100644 --- a/Source/NSCountedSet.m +++ b/Source/NSCountedSet.m @@ -37,8 +37,6 @@ #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 5d7a3211e..48f5c9dc6 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)) { - unsigned offset; - unsigned align; + int offset; + int 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)) { - unsigned offset; - unsigned align; + int offset; + int 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)) { - unsigned offset; - unsigned align; + int offset; + int 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)) { - unsigned offset; - unsigned align; + int offset; + int align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index 0e0fe3b57..3c16100db 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -43,30 +43,6 @@ #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 @@ -91,6 +67,26 @@ static SEL appSel; */ @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 c44b2578a..f9feafc41 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. */ -+ (NSNotificationCenter*) defaultCenter ++ (id) 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. */ -+ (NSNotificationCenter*) notificationCenterForType: (NSString*)type ++ (id) notificationCenterForType: (NSString*)type { if ([type isEqual: NSLocalNotificationCenterType] == YES) { diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index 910965892..b69975410 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -3075,7 +3075,7 @@ static NSSet *fileKeys = nil; return [GSAttrDictionaryEnumerator enumeratorFor: self]; } -- (id) objectForKey: (id)key +- (id) objectForKey: (NSString*)key { int count = 0; diff --git a/Source/NSMessagePort.m b/Source/NSMessagePort.m index f7a692f1d..f3e9c621b 100644 --- a/Source/NSMessagePort.m +++ b/Source/NSMessagePort.m @@ -170,8 +170,8 @@ typedef struct { } GSPortMsgHeader; typedef struct { - unsigned char version; - unsigned char addr[0]; /* name of the socket in the port directory */ + char version; + 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((char*)name); + plen = 2 + strlen(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((char*)pi->addr, (char*)name); + strcpy(pi->addr, 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, (char*)name, sizeof(sockAddr.sun_path)); + strncpy(sockAddr.sun_path, 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; - unsigned len = sizeof(res); + int res = 0; + int 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: - (unsigned char*)[path fileSystemRepresentation] listener: YES]); + return RETAIN([self _portWithName: [path fileSystemRepresentation] + listener: YES]); } /* @@ -1233,7 +1233,7 @@ static int unique_index = 0; NSData *theName; theName = [[NSData alloc] initWithBytes: socketName - length: strlen((char*)socketName)+1]; + length: strlen(socketName)+1]; M_LOCK(messagePortLock); @@ -1263,8 +1263,7 @@ static int unique_index = 0; */ memset(&sockaddr, '\0', sizeof(sockaddr)); sockaddr.sun_family = AF_LOCAL; - strncpy(sockaddr.sun_path, (char*)socketName, - sizeof(sockaddr.sun_path)); + strncpy(sockaddr.sun_path, socketName, sizeof(sockaddr.sun_path)); /* * Need size of buffer for getsockbyname() later. @@ -1626,7 +1625,7 @@ static int unique_index = 0; if (desc == listener) { struct sockaddr_un sockAddr; - unsigned size = sizeof(sockAddr); + int size = sizeof(sockAddr); desc = accept(listener, (struct sockaddr*)&sockAddr, &size); if (desc < 0) diff --git a/Source/NSMessagePortNameServer.m b/Source/NSMessagePortNameServer.m index f126e970d..3e3472d97 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: (unsigned char*)socket_path + return [NSMessagePort _portWithName: socket_path listener: NO]; } @@ -290,10 +290,10 @@ static void clean_up_names(void) socket_name = [(NSMessagePort *)port _name]; - write(fd, (char*)socket_name, strlen((char*)socket_name)); + write(fd, socket_name, strlen(socket_name)); write(fd, "\n", 1); - sprintf((char*)buf, "%i\n", getpid()); - write(fd, (char*)buf, strlen((char*)buf)); + sprintf(buf, "%i\n", getpid()); + write(fd, buf, strlen(buf)); close(fd); @@ -376,7 +376,7 @@ static void clean_up_names(void) port_path = [(NSMessagePort *)port _name]; - if (!strcmp((char*)socket_path, (char*)port_path)) + if (!strcmp(socket_path, port_path)) { unlink([path fileSystemRepresentation]); } diff --git a/Source/NSMethodSignature.m b/Source/NSMethodSignature.m index 8a2a33641..11f529d62 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, (int*)&newMs->_argFrameLength, - (int*)&newMs->_numArgs, 0); + newMs->_methodTypes = mframe_build_signature(t, &newMs->_argFrameLength, + &newMs->_numArgs, 0); return newMs; } diff --git a/Source/NSNotification.m b/Source/NSNotification.m index 28051341a..e690fa8c1 100644 --- a/Source/NSNotification.m +++ b/Source/NSNotification.m @@ -29,10 +29,6 @@ #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 @@ -47,7 +43,9 @@ static Class abstractClass = 0; static Class concreteClass = 0; -+ (id) allocWithZone: (NSZone*)z +@class GSNotification; + ++ (NSNotification*) allocWithZone: (NSZone*)z { if (self == abstractClass) { diff --git a/Source/NSObject.m b/Source/NSObject.m index d45b906aa..91d5d86fe 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -31,7 +31,6 @@ #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" @@ -76,16 +75,6 @@ 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. @@ -1524,7 +1513,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 implementation calls -doesNotRecognizeSelector: + * The default implemnentation calls -doesNotRecognizeSelector: */ - (void) forwardInvocation: (NSInvocation*)anInvocation { @@ -2432,11 +2421,13 @@ 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 4cf079a22..f1f37ab60 100644 --- a/Source/NSPipe.m +++ b/Source/NSPipe.m @@ -103,7 +103,7 @@ /** * Returns the file handle for reading from the pipe. */ -- (NSFileHandle*) fileHandleForReading +- (id) fileHandleForReading { return readHandle; } @@ -111,7 +111,7 @@ /** * Returns the file handle for writing to the pipe. */ -- (NSFileHandle*) fileHandleForWriting +- (id) fileHandleForWriting { return writeHandle; } diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index 3768eb0be..f54ad62db 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -46,10 +46,6 @@ #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. */ @@ -299,6 +295,8 @@ typeCheck(char t1, char t2) @implementation NSPortCoder +@class NSMutableDataMalloc; + static Class connectionClass; static Class mutableArrayClass; static Class mutableDataClass; @@ -744,8 +742,8 @@ static IMP _xRefImp; /* Serialize a crossref. */ objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - unsigned offset; - unsigned align; + int offset; + int align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); @@ -1349,8 +1347,8 @@ static IMP _xRefImp; /* Serialize a crossref. */ objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - unsigned offset; - unsigned align; + int offset; + int align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 4382c6f53..45abc7a79 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -49,12 +49,10 @@ 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 { @@ -2752,8 +2750,8 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, else if ((next >= 0x50) && (next < 0x5F)) { // Short string - unsigned len = next - 0x50; - char buffer[len+1]; + unsigned len = next - 0x50; + unsigned 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 0957dc488..f91f39e15 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, (int*)&range.location) + && (*scanIntImp)(scanner, scanIntSel, &range.location) && (*scanStringImp)(scanner, scanStringSel, @",", NULL) && (*scanStringImp)(scanner, scanStringSel, @"length", NULL) && (*scanStringImp)(scanner, scanStringSel, @"=", NULL) - && (*scanIntImp)(scanner, scanIntSel, (int*)&range.length) + && (*scanIntImp)(scanner, scanIntSel, &range.length) && (*scanStringImp)(scanner, scanStringSel, @"}", NULL)) return range; else diff --git a/Source/NSScanner.m b/Source/NSScanner.m index 9ac816a2d..72079fc22 100644 --- a/Source/NSScanner.m +++ b/Source/NSScanner.m @@ -51,17 +51,26 @@ #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; @@ -97,22 +106,6 @@ 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]) @@ -202,9 +195,8 @@ typedef struct { else { _isUnicode = NO; - _string = [_holder initWithCString: - (char*)((ivars)aString)->_contents.c - length: ((ivars)aString)->_count]; + _string = [_holder initWithCString: ((ivars)aString)->_contents.c + length: ((ivars)aString)->_count]; } } else if (c == NSConstantStringClass) diff --git a/Source/NSSerializer.m b/Source/NSSerializer.m index 520458ea3..3321b2ab0 100644 --- a/Source/NSSerializer.m +++ b/Source/NSSerializer.m @@ -43,25 +43,13 @@ @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 18c6e1277..9ace1d0dd 100644 --- a/Source/NSSet.m +++ b/Source/NSSet.m @@ -39,11 +39,7 @@ #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 7b092af97..7580fcada 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; - unsigned len = sizeof(res); + int 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; - unsigned size = sizeof(sockAddr); + int 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 98117e5c5..7119ea368 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: (char*)msg.name]; + [name getCString: 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: (char*)msg.name]; + [name getCString: 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: (char*)msg.name]; + [name getCString: msg.name]; } msg.port = GSSwapHostI32ToBig(portNumber); TEST_RELEASE(data); diff --git a/Source/NSString.m b/Source/NSString.m index 627bfe739..9e43f187b 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -89,16 +89,8 @@ 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 /* @@ -1152,8 +1144,8 @@ handle_printf_atsign (FILE *stream, unichar *buf = 0; unsigned int l = 0; - if (GSToUnicode(&buf, &l, (unsigned char*)byteString, length, - _DefaultStringEncoding, [self zone], 0) == NO) + if (GSToUnicode(&buf, &l, byteString, length, _DefaultStringEncoding, + [self zone], 0) == NO) { DESTROY(self); } @@ -1287,8 +1279,8 @@ handle_printf_atsign (FILE *stream, unichar *u = 0; unsigned int l = 0; - if (GSToUnicode(&u, &l, (unsigned char*)bytes, length, - NSUTF8StringEncoding, GSObjCZone(self), 0) == NO) + if (GSToUnicode(&u, &l, bytes, length, NSUTF8StringEncoding, + GSObjCZone(self), 0) == NO) { DESTROY(self); } @@ -1404,7 +1396,7 @@ handle_printf_atsign (FILE *stream, } else { - self = [self initWithCString: (char*)f._contents.c length: f._count]; + self = [self initWithCString: f._contents.c length: f._count]; } /* @@ -1483,7 +1475,7 @@ handle_printf_atsign (FILE *stream, if (i == len) { - self = [self initWithCString: (char*)bytes length: len]; + self = [self initWithCString: bytes length: len]; } else { @@ -3348,7 +3340,7 @@ handle_printf_atsign (FILE *stream, else { unsigned char *b = 0; - unsigned l = 0; + int l = 0; unichar *u; u = (unichar*)NSZoneMalloc(NSDefaultMallocZone(), len*sizeof(unichar)); @@ -4870,7 +4862,7 @@ static NSFileManager *fm = nil; else if (enc == NSASCIIStringEncoding || enc == _DefaultStringEncoding) { - char *chars; + unsigned char *chars; chars = NSZoneMalloc(zone, count+1); [aCoder decodeArrayOfObjCType: @encode(unsigned char) @@ -4889,7 +4881,7 @@ static NSFileManager *fm = nil; count: count at: chars]; chars[count] = '\0'; - self = [self initWithUTF8String: (char*)chars]; + self = [self initWithUTF8String: chars]; NSZoneFree(zone, chars); } else @@ -5049,7 +5041,7 @@ static NSFileManager *fm = nil; /** * Constructs an empty string. */ -+ (id) string ++ (NSMutableString*) string { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCapacity: 0]); @@ -5068,8 +5060,8 @@ static NSFileManager *fm = nil; * Create a string of unicode characters. */ // Inefficient implementation. -+ (id) stringWithCharacters: (const unichar*)characters - length: (unsigned int)length ++ (NSString*) stringWithCharacters: (const unichar*)characters + length: (unsigned int)length { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCharacters: characters length: length]); @@ -5091,7 +5083,7 @@ static NSFileManager *fm = nil; * null-terminated and encoded in the default C string encoding. (Characters * will be converted to unicode representation internally.) */ -+ (id) stringWithCString: (const char*)byteString ++ (NSString*) stringWithCString: (const char*)byteString { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCString: byteString]); @@ -5102,8 +5094,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.) */ -+ (id) stringWithCString: (const char*)byteString - length: (unsigned int)length ++ (NSString*) stringWithCString: (const char*)byteString + length: (unsigned int)length { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCString: byteString length: length]); @@ -5114,7 +5106,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. */ -+ (id) stringWithFormat: (NSString*)format, ... ++ (NSString*) stringWithFormat: (NSString*)format, ... { va_list ap; va_start(ap, format); @@ -5313,6 +5305,8 @@ 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 385c6da2f..dcafc2068 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -53,55 +53,13 @@ #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.
@@ -790,6 +748,49 @@ 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 ad4b26f1c..c4481c673 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 = (unsigned char*)(bytes + pos); + abbr = (char*)(bytes + pos); { id abbrevs[charcnt]; @@ -2261,8 +2261,7 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type) if (abbrevs[loc] == nil) { - abbrevs[loc] - = [[NSString alloc] initWithCString: (char*)abbr + loc]; + abbrevs[loc] = [[NSString alloc] initWithCString: abbr + loc]; } else { diff --git a/Source/NSTimer.m b/Source/NSTimer.m index 7bd79d789..76d822fac 100644 --- a/Source/NSTimer.m +++ b/Source/NSTimer.m @@ -34,8 +34,6 @@ #include "Foundation/NSInvocation.h" @class NSGDate; -@interface NSGDate : NSObject // Help the compiler -@end static Class NSDate_class; /** @@ -331,7 +329,7 @@ static Class NSDate_class; /** * Compares timers based on the date at which they should next fire. */ -- (NSComparisonResult) compare: (id)anotherTimer +- (NSComparisonResult) compare: (NSTimer*)anotherTimer { if (anotherTimer == self) { @@ -344,7 +342,7 @@ static Class NSDate_class; } else { - return [_date compare: ((NSTimer*)anotherTimer)->_date]; + return [_date compare: anotherTimer->_date]; } return 0; } diff --git a/Source/NSURLHandle.m b/Source/NSURLHandle.m index 0f621a502..636b636cf 100644 --- a/Source/NSURLHandle.m +++ b/Source/NSURLHandle.m @@ -38,20 +38,9 @@ #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 @@ -604,6 +593,13 @@ 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 8de3b3bfd..df5c0fdab 100644 --- a/Source/NSUnarchiver.m +++ b/Source/NSUnarchiver.m @@ -51,10 +51,6 @@ #include "Foundation/NSString.h" #include "Foundation/NSArray.h" -@class NSDataMalloc; -@interface NSDataMalloc : NSObject // Help the compiler -@end - static const char* typeToName1(char type) { @@ -345,6 +341,7 @@ mapClassName(NSUnarchiverObjectInfo *info) */ @implementation NSUnarchiver +@class NSDataMalloc; static Class NSDataMallocClass; + (void) initialize @@ -806,8 +803,8 @@ static Class NSDataMallocClass; objc_layout_structure (type, &layout); while (objc_layout_structure_next_member (&layout)) { - unsigned offset; - unsigned align; + int offset; + int align; const char *ftype; objc_layout_structure_get_info (&layout, &offset, &align, &ftype); diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 138be2a0c..09ae8254d 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -36,7 +36,6 @@ #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 30bdb19ef..eeaa093b5 100644 --- a/Source/NSValue.m +++ b/Source/NSValue.m @@ -42,30 +42,12 @@ @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; @@ -404,6 +386,8 @@ 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 4faa5290b..c729f42d8 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) { - unsigned int size = 0; + int size = 0; type = objc_skip_type_qualifiers(type); NSGetSizeAndAlignment(type, &size, 0); diff --git a/Testing/GNUmakefile b/Testing/GNUmakefile index be129a8aa..ea19f5bd8 100644 --- a/Testing/GNUmakefile +++ b/Testing/GNUmakefile @@ -54,6 +54,7 @@ CHECKABLE_TOOLS = \ nshost \ nsindexset \ nsinvocation \ + nskvo \ nsmaptable \ nsmethodsignature \ nsnotification \ @@ -113,6 +114,7 @@ nshashtable_OBJC_FILES = nshashtable.m nshost_OBJC_FILES = nshost.m nsindexset_OBJC_FILES = nsindexset.m nsinvocation_OBJC_FILES = nsinvocation.m +nskvo_OBJC_FILES = nskvo.m nsmaptable_OBJC_FILES = nsmaptable.m nsmethodsignature_OBJC_FILES = nsmethodsignature.m nsnotification_OBJC_FILES = nsnotification.m diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index be4b8bf02..dc27d95a1 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -399,15 +399,13 @@ 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. */ - d = [refs objectForKey: @"categories"]; - d = [d objectForKey: classname]; - catNames = [d allKeys]; + catNames = [[[refs objectForKey: @"categories"] + objectForKey: classname] allKeys]; if ((c = [catNames count]) > 0) { NSMutableDictionary *m = [dict mutableCopy]; diff --git a/Tools/AGSIndex.m b/Tools/AGSIndex.m index fcf3f9d2f..2ce9c666c 100644 --- a/Tools/AGSIndex.m +++ b/Tools/AGSIndex.m @@ -487,14 +487,10 @@ setDirectory(NSMutableDictionary *dict, NSString *path) //PENDING, should we worry about not overriding entries? while ((name = [pnames nextObject]) != nil) { - NSMutableDictionary *d; - - d = [refs objectForKey: @"category"]; - file = [d objectForKey: name]; + file = [[refs objectForKey: @"category"] objectForKey: name]; if (file != nil) { - d = [refs objectForKey: @"protocol"]; - [d setObject: file forKey: name]; + [[refs objectForKey: @"protocol"] setObject: file forKey: name]; } else { @@ -665,7 +661,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path) /** * Return a list of source files for the header. */ -- (NSMutableArray*) sourcesForHeader: (NSString*)h +- (NSArray*) sourcesForHeader: (NSString*)h { NSDictionary *dict = [refs objectForKey: @"source"]; NSArray *array = [dict objectForKey: h]; diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index d1eebfdbe..94763693d 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -756,11 +756,8 @@ static BOOL snuggleStart(NSString *t) while (i-- > 0) { - NSString *n; - NSDictionary *d; + NSString *n = [[aa objectAtIndex: i] objectForKey: @"Name"]; - 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 2bddb86db..7a7f03462 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, unsigned l); +static void queue_msg(struct sockaddr_in* a, uptr d, int 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, unsigned l) +queue_msg(struct sockaddr_in* a, uptr d, int 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 = (unsigned char*)malloc(l); + m->name = (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 = (unsigned char*)malloc((MAX_IFACE+1)*sizeof(char)); + bcok = (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 = (unsigned char*)malloc((num_iface+1)*sizeof(char)); + bcok = (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; - unsigned len = sizeof(sa); + int 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; - unsigned len = sizeof(struct sockaddr_in); + int 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 = (unsigned char*)ri->buf.r.name; + buf = 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, (unsigned char*)wi->buf, wi->len); + queue_msg(&ri->addr, wi->buf, wi->len); clear_chan(desc); } } @@ -3892,8 +3892,7 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd continue; } - if (tryHost(GDO_LOOKUP, len, (unsigned char*)name, - ptype, &sin, &port, 0)==0) + if (tryHost(GDO_LOOKUP, len, name, ptype, &sin, &port, 0)==0) { if (port != 0) { @@ -3924,7 +3923,7 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd { port = (unsigned short)pnum; } - rval = tryHost(op, len, (unsigned char*)name, ptype, &sin, &port, 0); + rval = tryHost(op, len, 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 8c9a94d1c..46c908176 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; - unsigned char name[GDO_NAME_MAX_LEN+1]; + 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 27f3b40e3..0b919c57b 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: (char*)args[lf->key_index]]; + key=[NSString stringWithCString: args[lf->key_index]]; if (lf->comment_index==-1 || !arg_len[lf->comment_index]) comment=nil; else - comment=[NSString stringWithCString: (char*)args[lf->comment_index]]; + comment=[NSString stringWithCString: args[lf->comment_index]]; if (lf->table_index==-1) table=@"Localizable"; /* TODO: customizable? */ else - table=[NSString stringWithCString: (char*)args[lf->table_index]]; + table=[NSString stringWithCString: args[lf->table_index]]; e=[[SourceEntry alloc] initWithKey: key comment: comment file: filenamestr line: cur_line]; [tables addEntry: e toTable: table];