Lots of little fixes to make -base compile with -Werror (now builds without warnings).

Richard: I'm unsure about three of these, which were fixes in memset() calls in:
- NSConcreteMapTable.m
- NSConcreteHashTable.m
- Additions/NSData+GNUstepBase.m

Please can you check them?  I think they are intended to zero the entire object
(rather than the first word), but the lack of comments makes me unsure.

Most changes were just tweaks to variable types.  I've also removed some dead code from NSInvocation.  This was small group of things that were marked for internal use only, but not actually referenced in the code anywhere.

Other improvements:

- NSArray / NSDictionary fixed up to use the 10.7 (ARC-friendly) prototypes.
- getObjects:andKeys: implemented for NSDictionary (10.5 method)
- NSPointerArray and NSHashTable now properly support weak objects.
- Tests for weak objects in collections.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33621 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2011-07-24 13:09:22 +00:00
parent ee75164747
commit ceba92a265
39 changed files with 196 additions and 155 deletions

View file

@ -41,6 +41,7 @@
#import "Foundation/NSKeyedArchiver.h"
#import "GNUstepBase/NSObject+GNUstepBase.h"
#import "GSPrivate.h"
#import "GSFastEnumeration.h"
static BOOL GSMacOSXCompatiblePropertyLists(void)
{
@ -165,8 +166,8 @@ static SEL appSel;
* and needs to be re-implemented in subclasses in order to have all
* other initialisers work.
*/
- (id) initWithObjects: (id*)objects
forKeys: (id*)keys
- (id) initWithObjects: (const id[])objects
forKeys: (const id[])keys
count: (NSUInteger)count
{
self = [self init];
@ -396,8 +397,8 @@ static SEL appSel;
* The n th element of the objects array is associated with the n th
* element of the keys array.
*/
+ (id) dictionaryWithObjects: (id*)objects
forKeys: (id*)keys
+ (id) dictionaryWithObjects: (const id[])objects
forKeys: (const id[])keys
count: (NSUInteger)count
{
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
@ -814,6 +815,15 @@ static SEL appSel;
return AUTORELEASE(result);
}
}
- (void)getObjects: (__unsafe_unretained id[])objects
andKeys: (__unsafe_unretained id[])keys
{
int i=0;
FOR_IN(id, key, self)
keys[i] = key;
objects[i] = [self objectForKey: key];
END_FOR_IN(self)
}
/**
* Returns an array containing all the dictionary's keys that are
@ -1103,7 +1113,7 @@ compareIt(id o1, id o2, void* context)
return o;
}
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
objects: (id*)stackbuf
objects: (__unsafe_unretained id[])stackbuf
count: (NSUInteger)len
{
[self subclassResponsibility: _cmd];
@ -1231,8 +1241,8 @@ compareIt(id o1, id o2, void* context)
* The n th element of the objects array is associated with the n th
* element of the keys array.
*/
- (id) initWithObjects: (id*)objects
forKeys: (id*)keys
- (id) initWithObjects: (const id[])objects
forKeys: (const id[])keys
count: (NSUInteger)count
{
self = [self initWithCapacity: count];