From 52fa3a2c075d371a5ac28b306f4f56ea6fb8164d Mon Sep 17 00:00:00 2001 From: Quentin Mathe Date: Thu, 5 Dec 2013 13:16:36 +0000 Subject: [PATCH] Changed keys argument type to (const id []) 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 --- ChangeLog | 11 +++++++++++ Headers/Foundation/NSDictionary.h | 4 ++-- Source/Additions/GCDictionary.m | 4 ++-- Source/Additions/GSInsensitiveDictionary.m | 6 +++--- Source/GSDictionary.m | 6 +++--- Source/NSDictionary.m | 6 +++--- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0210abac..7025e36b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-12-05 Quentin Mathe + + * 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 []) in + -initWithObjects:forKeys:count: and +dictionaryWithObjects:forKeys:count:, + to follow the current Cocoa API. + 2013-12-04 Richard Frith-Macdonald * Source/NSURLCredential.m: ([-isEqual:]) needs to take the password diff --git a/Headers/Foundation/NSDictionary.h b/Headers/Foundation/NSDictionary.h index 2aab8f160..a0147d6c9 100644 --- a/Headers/Foundation/NSDictionary.h +++ b/Headers/Foundation/NSDictionary.h @@ -45,7 +45,7 @@ extern "C" { + (id) dictionaryWithObject: (id)object forKey: (id)key; + (id) dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys; + (id) dictionaryWithObjects: (const id[])objects - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)count; + (id) dictionaryWithObjectsAndKeys: (id)firstObject, ...; @@ -81,7 +81,7 @@ DEFINE_BLOCK_TYPE(GSKeysAndObjectsEnumeratorBlock, void, id, id, BOOL*); - (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys; - (id) initWithObjectsAndKeys: (id)firstObject, ...; - (id) initWithObjects: (const id[])objects - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)count; // Primitive - (BOOL) isEqualToDictionary: (NSDictionary*)other; diff --git a/Source/Additions/GCDictionary.m b/Source/Additions/GCDictionary.m index 092393c67..e7e07778d 100644 --- a/Source/Additions/GCDictionary.m +++ b/Source/Additions/GCDictionary.m @@ -261,7 +261,7 @@ static Class gcClass = 0; } - (id) initWithObjects: (const id[])objects - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)count { NSUInteger size = (count * 4) / 3; @@ -284,7 +284,7 @@ static Class gcClass = 0; keyStruct = NSZoneMalloc(z, sizeof(GCInfo)); valueStruct = NSZoneMalloc(z, sizeof(GCInfo)); keyStruct->object = keys[count]; - keyStruct->isGCObject = [keys[count] isKindOfClass: gcClass]; + keyStruct->isGCObject = [(id )keys[count] isKindOfClass: gcClass]; valueStruct->object = objects[count]; valueStruct->isGCObject = [objects[count] isKindOfClass: gcClass]; diff --git a/Source/Additions/GSInsensitiveDictionary.m b/Source/Additions/GSInsensitiveDictionary.m index 022523620..aeb17cc1a 100644 --- a/Source/Additions/GSInsensitiveDictionary.m +++ b/Source/Additions/GSInsensitiveDictionary.m @@ -170,7 +170,7 @@ static SEL objSel; } /* Designated initialiser */ -- (id) initWithObjects: (const id[])objs forKeys: (const id[])keys count: (NSUInteger)c +- (id) initWithObjects: (const id[])objs forKeys: (const id [])keys count: (NSUInteger)c { NSUInteger i; @@ -192,7 +192,7 @@ static SEL objSel; format: @"Tried to init dictionary with nil value"]; } - node = GSIMapNodeForKey(&map, (GSIMapKey)keys[i]); + node = GSIMapNodeForKey(&map, (GSIMapKey)(id)keys[i]); if (node) { IF_NO_GC(RETAIN(objs[i])); @@ -201,7 +201,7 @@ static SEL objSel; } else { - GSIMapAddPair(&map, (GSIMapKey)keys[i], (GSIMapVal)objs[i]); + GSIMapAddPair(&map, (GSIMapKey)(id)keys[i], (GSIMapVal)objs[i]); } } return self; diff --git a/Source/GSDictionary.m b/Source/GSDictionary.m index e1d326063..f974e14fd 100644 --- a/Source/GSDictionary.m +++ b/Source/GSDictionary.m @@ -185,7 +185,7 @@ static SEL objSel; /* Designated initialiser */ - (id) initWithObjects: (const id[])objs - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)c { NSUInteger i; @@ -208,7 +208,7 @@ static SEL objSel; format: @"Tried to init dictionary with nil value"]; } - node = GSIMapNodeForKey(&map, (GSIMapKey)keys[i]); + node = GSIMapNodeForKey(&map, (GSIMapKey)(id)keys[i]); if (node) { IF_NO_GC(RETAIN(objs[i])); @@ -217,7 +217,7 @@ static SEL objSel; } else { - GSIMapAddPair(&map, (GSIMapKey)keys[i], (GSIMapVal)objs[i]); + GSIMapAddPair(&map, (GSIMapKey)(id)keys[i], (GSIMapVal)objs[i]); } } return self; diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index bb7d8b402..6bb127e90 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -225,7 +225,7 @@ static SEL appSel; * other initialisers work. */ - (id) initWithObjects: (const id[])objects - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)count { self = [self init]; @@ -444,7 +444,7 @@ static SEL appSel; * element of the keys array. */ + (id) dictionaryWithObjects: (const id[])objects - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)count { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] @@ -1357,7 +1357,7 @@ compareIt(id o1, id o2, void* context) * element of the keys array. */ - (id) initWithObjects: (const id[])objects - forKeys: (const id[])keys + forKeys: (const id [])keys count: (NSUInteger)count { self = [self initWithCapacity: count];