Changed keys argument type to (const id <NSCopying>[]) in

-[NSDictionary initWithObjects:forKeys:count:] and 
+dictionaryWithObjects:forKeys:count:, to follow the current Cocoa API.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37431 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
qmathe 2013-12-05 13:16:36 +00:00
parent 027b437d5a
commit cf71a18895
6 changed files with 24 additions and 13 deletions

View file

@ -1,3 +1,14 @@
2013-12-05 Quentin Mathe <quentin.mathe@gmail.com>
* Headers/Foundation/NSDictionary.h:
* Source/NSDictionary.m:
* Source/Additions/GCDictionary.m:
* Source/Additions/GSInsensitiveDictionary.m:
* Source/GSDictionary.m:
Changed keys argument type to (const id <NSCopying>[]) in
-initWithObjects:forKeys:count: and +dictionaryWithObjects:forKeys:count:,
to follow the current Cocoa API.
2013-12-04 Richard Frith-Macdonald <rfm@gnu.org> 2013-12-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURLCredential.m: ([-isEqual:]) needs to take the password * Source/NSURLCredential.m: ([-isEqual:]) needs to take the password

View file

@ -45,7 +45,7 @@ extern "C" {
+ (id) dictionaryWithObject: (id)object forKey: (id)key; + (id) dictionaryWithObject: (id)object forKey: (id)key;
+ (id) dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys; + (id) dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
+ (id) dictionaryWithObjects: (const id[])objects + (id) dictionaryWithObjects: (const id[])objects
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)count; count: (NSUInteger)count;
+ (id) dictionaryWithObjectsAndKeys: (id)firstObject, ...; + (id) dictionaryWithObjectsAndKeys: (id)firstObject, ...;
@ -81,7 +81,7 @@ DEFINE_BLOCK_TYPE(GSKeysAndObjectsEnumeratorBlock, void, id, id, BOOL*);
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys; - (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
- (id) initWithObjectsAndKeys: (id)firstObject, ...; - (id) initWithObjectsAndKeys: (id)firstObject, ...;
- (id) initWithObjects: (const id[])objects - (id) initWithObjects: (const id[])objects
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)count; // Primitive count: (NSUInteger)count; // Primitive
- (BOOL) isEqualToDictionary: (NSDictionary*)other; - (BOOL) isEqualToDictionary: (NSDictionary*)other;

View file

@ -261,7 +261,7 @@ static Class gcClass = 0;
} }
- (id) initWithObjects: (const id[])objects - (id) initWithObjects: (const id[])objects
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)count count: (NSUInteger)count
{ {
NSUInteger size = (count * 4) / 3; NSUInteger size = (count * 4) / 3;
@ -284,7 +284,7 @@ static Class gcClass = 0;
keyStruct = NSZoneMalloc(z, sizeof(GCInfo)); keyStruct = NSZoneMalloc(z, sizeof(GCInfo));
valueStruct = NSZoneMalloc(z, sizeof(GCInfo)); valueStruct = NSZoneMalloc(z, sizeof(GCInfo));
keyStruct->object = keys[count]; keyStruct->object = keys[count];
keyStruct->isGCObject = [keys[count] isKindOfClass: gcClass]; keyStruct->isGCObject = [(id <NSObject>)keys[count] isKindOfClass: gcClass];
valueStruct->object = objects[count]; valueStruct->object = objects[count];
valueStruct->isGCObject valueStruct->isGCObject
= [objects[count] isKindOfClass: gcClass]; = [objects[count] isKindOfClass: gcClass];

View file

@ -170,7 +170,7 @@ static SEL objSel;
} }
/* Designated initialiser */ /* Designated initialiser */
- (id) initWithObjects: (const id[])objs forKeys: (const id[])keys count: (NSUInteger)c - (id) initWithObjects: (const id[])objs forKeys: (const id <NSCopying>[])keys count: (NSUInteger)c
{ {
NSUInteger i; NSUInteger i;
@ -192,7 +192,7 @@ static SEL objSel;
format: @"Tried to init dictionary with nil value"]; format: @"Tried to init dictionary with nil value"];
} }
node = GSIMapNodeForKey(&map, (GSIMapKey)keys[i]); node = GSIMapNodeForKey(&map, (GSIMapKey)(id)keys[i]);
if (node) if (node)
{ {
IF_NO_GC(RETAIN(objs[i])); IF_NO_GC(RETAIN(objs[i]));
@ -201,7 +201,7 @@ static SEL objSel;
} }
else else
{ {
GSIMapAddPair(&map, (GSIMapKey)keys[i], (GSIMapVal)objs[i]); GSIMapAddPair(&map, (GSIMapKey)(id)keys[i], (GSIMapVal)objs[i]);
} }
} }
return self; return self;

View file

@ -185,7 +185,7 @@ static SEL objSel;
/* Designated initialiser */ /* Designated initialiser */
- (id) initWithObjects: (const id[])objs - (id) initWithObjects: (const id[])objs
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)c count: (NSUInteger)c
{ {
NSUInteger i; NSUInteger i;
@ -208,7 +208,7 @@ static SEL objSel;
format: @"Tried to init dictionary with nil value"]; format: @"Tried to init dictionary with nil value"];
} }
node = GSIMapNodeForKey(&map, (GSIMapKey)keys[i]); node = GSIMapNodeForKey(&map, (GSIMapKey)(id)keys[i]);
if (node) if (node)
{ {
IF_NO_GC(RETAIN(objs[i])); IF_NO_GC(RETAIN(objs[i]));
@ -217,7 +217,7 @@ static SEL objSel;
} }
else else
{ {
GSIMapAddPair(&map, (GSIMapKey)keys[i], (GSIMapVal)objs[i]); GSIMapAddPair(&map, (GSIMapKey)(id)keys[i], (GSIMapVal)objs[i]);
} }
} }
return self; return self;

View file

@ -225,7 +225,7 @@ static SEL appSel;
* other initialisers work. * other initialisers work.
*/ */
- (id) initWithObjects: (const id[])objects - (id) initWithObjects: (const id[])objects
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)count count: (NSUInteger)count
{ {
self = [self init]; self = [self init];
@ -444,7 +444,7 @@ static SEL appSel;
* element of the keys array. * element of the keys array.
*/ */
+ (id) dictionaryWithObjects: (const id[])objects + (id) dictionaryWithObjects: (const id[])objects
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)count count: (NSUInteger)count
{ {
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
@ -1357,7 +1357,7 @@ compareIt(id o1, id o2, void* context)
* element of the keys array. * element of the keys array.
*/ */
- (id) initWithObjects: (const id[])objects - (id) initWithObjects: (const id[])objects
forKeys: (const id[])keys forKeys: (const id <NSCopying>[])keys
count: (NSUInteger)count count: (NSUInteger)count
{ {
self = [self initWithCapacity: count]; self = [self initWithCapacity: count];