mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-13 01:20:57 +00:00
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:
parent
ee75164747
commit
ceba92a265
39 changed files with 196 additions and 155 deletions
|
@ -55,8 +55,8 @@ extern "C" {
|
||||||
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray;
|
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray;
|
||||||
- (BOOL) containsObject: anObject;
|
- (BOOL) containsObject: anObject;
|
||||||
- (NSUInteger) count; // Primitive
|
- (NSUInteger) count; // Primitive
|
||||||
- (void) getObjects: (id[])aBuffer;
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer;
|
||||||
- (void) getObjects: (id[])aBuffer range: (NSRange)aRange;
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer range: (NSRange)aRange;
|
||||||
- (NSUInteger) indexOfObject: (id)anObject;
|
- (NSUInteger) indexOfObject: (id)anObject;
|
||||||
- (NSUInteger) indexOfObject: (id)anObject inRange: (NSRange)aRange;
|
- (NSUInteger) indexOfObject: (id)anObject inRange: (NSRange)aRange;
|
||||||
- (NSUInteger) indexOfObjectIdenticalTo: (id)anObject;
|
- (NSUInteger) indexOfObjectIdenticalTo: (id)anObject;
|
||||||
|
|
|
@ -44,8 +44,8 @@ extern "C" {
|
||||||
+ (id) dictionaryWithDictionary: (NSDictionary*)otherDictionary;
|
+ (id) dictionaryWithDictionary: (NSDictionary*)otherDictionary;
|
||||||
+ (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: (id*)objects
|
+ (id) dictionaryWithObjects: (const id[])objects
|
||||||
forKeys: (id*)keys
|
forKeys: (const id[])keys
|
||||||
count: (NSUInteger)count;
|
count: (NSUInteger)count;
|
||||||
+ (id) dictionaryWithObjectsAndKeys: (id)firstObject, ...;
|
+ (id) dictionaryWithObjectsAndKeys: (id)firstObject, ...;
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ extern "C" {
|
||||||
- (id) initWithDictionary: (NSDictionary*)other copyItems: (BOOL)shouldCopy;
|
- (id) initWithDictionary: (NSDictionary*)other copyItems: (BOOL)shouldCopy;
|
||||||
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
||||||
- (id) initWithObjectsAndKeys: (id)firstObject, ...;
|
- (id) initWithObjectsAndKeys: (id)firstObject, ...;
|
||||||
- (id) initWithObjects: (id*)objects
|
- (id) initWithObjects: (const id[])objects
|
||||||
forKeys: (id*)keys
|
forKeys: (const id[])keys
|
||||||
count: (NSUInteger)count; // Primitive
|
count: (NSUInteger)count; // Primitive
|
||||||
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
|
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
|
||||||
|
|
||||||
|
@ -78,6 +78,8 @@ extern "C" {
|
||||||
- (NSEnumerator*) objectEnumerator; // Primitive
|
- (NSEnumerator*) objectEnumerator; // Primitive
|
||||||
- (id) objectForKey: (id)aKey; // Primitive
|
- (id) objectForKey: (id)aKey; // Primitive
|
||||||
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)marker;
|
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)marker;
|
||||||
|
- (void)getObjects: (__unsafe_unretained id[])objects
|
||||||
|
andKeys: (__unsafe_unretained id[])keys;
|
||||||
|
|
||||||
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile;
|
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile;
|
||||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||||
|
|
|
@ -44,7 +44,7 @@ typedef struct
|
||||||
|
|
||||||
@protocol NSFastEnumeration
|
@protocol NSFastEnumeration
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState *)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState *)state
|
||||||
objects: (id *)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len;
|
count: (NSUInteger)len;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -121,14 +121,6 @@ extern "C" {
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Do NOT use these methods ... internal use only ... not public API */
|
|
||||||
@interface NSInvocation (MacroSetup)
|
|
||||||
+ (id) _newProxyForInvocation: (id)target;
|
|
||||||
+ (id) _newProxyForMessage: (id)target;
|
|
||||||
+ (NSInvocation*) _returnInvocationAndDestroyProxy: (id)proxy;
|
|
||||||
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns an autoreleased invocation containing a
|
* Creates and returns an autoreleased invocation containing a
|
||||||
* message to an instance of the class. The 'message' consists
|
* message to an instance of the class. The 'message' consists
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct sockaddr_in;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DO NOT USE ... this header is here only for the SSL file handle support
|
* DO NOT USE ... this header is here only for the SSL file handle support
|
||||||
|
|
|
@ -481,6 +481,33 @@ GSIMapRemoveAndFreeNode(GSIMapTable map, uintptr_t bkt, GSIMapNode node)
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INLINE void
|
||||||
|
GSIMapRemoveWeak(GSIMapTable map)
|
||||||
|
{
|
||||||
|
uintptr_t bucketCount = map->bucketCount;
|
||||||
|
GSIMapBucket bucket = map->buckets;
|
||||||
|
if (GSI_MAP_ZEROED(map))
|
||||||
|
{
|
||||||
|
while (bucketCount-- > 0)
|
||||||
|
{
|
||||||
|
GSIMapNode node = bucket->firstNode;
|
||||||
|
|
||||||
|
while (node != 0)
|
||||||
|
{
|
||||||
|
GSIMapNode next = node->nextInBucket;
|
||||||
|
if (GSI_MAP_NODE_IS_EMPTY(map, node))
|
||||||
|
{
|
||||||
|
GSIMapRemoveNodeFromMap(map, bucket, node);
|
||||||
|
GSIMapFreeNode(map, node);
|
||||||
|
}
|
||||||
|
node = next;
|
||||||
|
}
|
||||||
|
bucket++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static INLINE void
|
static INLINE void
|
||||||
GSIMapRemangleBuckets(GSIMapTable map,
|
GSIMapRemangleBuckets(GSIMapTable map,
|
||||||
GSIMapBucket old_buckets, uintptr_t old_bucketCount,
|
GSIMapBucket old_buckets, uintptr_t old_bucketCount,
|
||||||
|
|
|
@ -49,6 +49,9 @@
|
||||||
#ifndef __has_feature
|
#ifndef __has_feature
|
||||||
# define __has_feature(x) 0
|
# define __has_feature(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __has_builtin
|
||||||
|
# define __has_builtin(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
#include <w32api.h>
|
#include <w32api.h>
|
||||||
|
@ -268,5 +271,10 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __has_builtin(__builtin_unreachable)
|
||||||
|
# define GS_UNREACHABLE() __builtin_unreachable()
|
||||||
|
#else
|
||||||
|
# define GS_UNREACHABLE() abort()
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __preface_h_OBJECTS_INCLUDE */
|
#endif /* __preface_h_OBJECTS_INCLUDE */
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct {
|
||||||
BOOL isGCObject;
|
BOOL isGCObject;
|
||||||
} GCInfo;
|
} GCInfo;
|
||||||
|
|
||||||
@interface _GCDictionaryKeyEnumerator : NSObject
|
@interface _GCDictionaryKeyEnumerator : NSEnumerator
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
GCDictionary *dict;
|
GCDictionary *dict;
|
||||||
|
@ -260,8 +260,8 @@ static Class gcClass = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithObjects: (id*)objects
|
- (id) initWithObjects: (const id[])objects
|
||||||
forKeys: (id*)keys
|
forKeys: (const id[])keys
|
||||||
count: (NSUInteger)count
|
count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
NSUInteger size = (count * 4) / 3;
|
NSUInteger size = (count * 4) / 3;
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
_GSInsensitiveDictionary *dictionary;
|
_GSInsensitiveDictionary *dictionary;
|
||||||
GSIMapEnumerator_t enumerator;
|
GSIMapEnumerator_t enumerator;
|
||||||
}
|
}
|
||||||
|
- (id) initWithDictionary: (NSDictionary*)d;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface _GSInsensitiveDictionaryObjectEnumerator : _GSInsensitiveDictionaryKeyEnumerator
|
@interface _GSInsensitiveDictionaryObjectEnumerator : _GSInsensitiveDictionaryKeyEnumerator
|
||||||
|
@ -169,7 +170,7 @@ static SEL objSel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Designated initialiser */
|
/* Designated initialiser */
|
||||||
- (id) initWithObjects: (id*)objs forKeys: (id*)keys count: (NSUInteger)c
|
- (id) initWithObjects: (const id[])objs forKeys: (const id[])keys count: (NSUInteger)c
|
||||||
{
|
{
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
if ([NSThread isMultiThreaded] == YES)
|
if ([NSThread isMultiThreaded] == YES)
|
||||||
{
|
{
|
||||||
DESTROY(self);
|
DESTROY(self);
|
||||||
self = [NSLock new];
|
return (GSLazyLock*)[NSLock new];
|
||||||
}
|
}
|
||||||
else if (self != nil)
|
else if (self != nil)
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,7 @@
|
||||||
if ([NSThread isMultiThreaded] == YES)
|
if ([NSThread isMultiThreaded] == YES)
|
||||||
{
|
{
|
||||||
DESTROY(self);
|
DESTROY(self);
|
||||||
self = [NSRecursiveLock new];
|
return (GSLazyRecursiveLock*)[NSRecursiveLock new];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -331,7 +331,7 @@ static void MD5Final (unsigned char digest[16], struct MD5Context *ctx)
|
||||||
MD5Transform (ctx->buf, (uint32_t *) ctx->in);
|
MD5Transform (ctx->buf, (uint32_t *) ctx->in);
|
||||||
littleEndian ((unsigned char *) ctx->buf, 4);
|
littleEndian ((unsigned char *) ctx->buf, 4);
|
||||||
memcpy (digest, ctx->buf, 16);
|
memcpy (digest, ctx->buf, 16);
|
||||||
memset (ctx, 0, sizeof (ctx)); /* In case it's sensitive */
|
memset (ctx, 0, sizeof (*ctx)); /* In case it's sensitive */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The four core functions - F1 is optimized somewhat */
|
/* The four core functions - F1 is optimized somewhat */
|
||||||
|
|
|
@ -353,7 +353,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) getObjects: (id[])aBuffer
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer
|
||||||
{
|
{
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) getObjects: (id[])aBuffer range: (NSRange)aRange
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer range: (NSRange)aRange
|
||||||
{
|
{
|
||||||
NSUInteger i, j = 0, e = aRange.location + aRange.length;
|
NSUInteger i, j = 0, e = aRange.location + aRange.length;
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||||
objects: (id*)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len
|
count: (NSUInteger)len
|
||||||
{
|
{
|
||||||
/* For immutable arrays we can return the contents pointer directly. */
|
/* For immutable arrays we can return the contents pointer directly. */
|
||||||
|
@ -886,7 +886,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||||
objects: (id*)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len
|
count: (NSUInteger)len
|
||||||
{
|
{
|
||||||
NSInteger count;
|
NSInteger count;
|
||||||
|
|
|
@ -74,6 +74,7 @@ static GC_descr nodeDesc; // Type descriptor for map node.
|
||||||
GSDictionary *dictionary;
|
GSDictionary *dictionary;
|
||||||
GSIMapEnumerator_t enumerator;
|
GSIMapEnumerator_t enumerator;
|
||||||
}
|
}
|
||||||
|
- (id) initWithDictionary: (NSDictionary*)d;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GSDictionaryObjectEnumerator : GSDictionaryKeyEnumerator
|
@interface GSDictionaryObjectEnumerator : GSDictionaryKeyEnumerator
|
||||||
|
@ -183,7 +184,9 @@ static SEL objSel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Designated initialiser */
|
/* Designated initialiser */
|
||||||
- (id) initWithObjects: (id*)objs forKeys: (id*)keys count: (NSUInteger)c
|
- (id) initWithObjects: (const id[])objs
|
||||||
|
forKeys: (const id[])keys
|
||||||
|
count: (NSUInteger)c
|
||||||
{
|
{
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
||||||
|
@ -354,7 +357,7 @@ static SEL objSel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||||
objects: (id*)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len
|
count: (NSUInteger)len
|
||||||
{
|
{
|
||||||
state->mutationsPtr = (unsigned long *)self;
|
state->mutationsPtr = (unsigned long *)self;
|
||||||
|
@ -458,7 +461,7 @@ static SEL objSel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||||
objects: (id*)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len
|
count: (NSUInteger)len
|
||||||
{
|
{
|
||||||
state->mutationsPtr = (unsigned long *)&_version;
|
state->mutationsPtr = (unsigned long *)&_version;
|
||||||
|
|
|
@ -39,6 +39,11 @@ typedef struct {
|
||||||
BOOL isReg;
|
BOOL isReg;
|
||||||
} NSArgumentInfo;
|
} NSArgumentInfo;
|
||||||
|
|
||||||
|
@interface NSInvocation (MacroSetup)
|
||||||
|
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface GSFFIInvocation : NSInvocation
|
@interface GSFFIInvocation : NSInvocation
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
|
|
|
@ -389,7 +389,7 @@ static SEL rlSel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||||
objects: (id*)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len
|
count: (NSUInteger)len
|
||||||
{
|
{
|
||||||
NSUInteger size = [self count];
|
NSUInteger size = [self count];
|
||||||
|
@ -479,7 +479,7 @@ static SEL rlSel;
|
||||||
* Copies the objects from the receiver to aBuffer, which must be
|
* Copies the objects from the receiver to aBuffer, which must be
|
||||||
* an area of memory large enough to hold them.
|
* an area of memory large enough to hold them.
|
||||||
*/
|
*/
|
||||||
- (void) getObjects: (id[])aBuffer
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer
|
||||||
{
|
{
|
||||||
unsigned i, c = [self count];
|
unsigned i, c = [self count];
|
||||||
IMP get = [self methodForSelector: oaiSel];
|
IMP get = [self methodForSelector: oaiSel];
|
||||||
|
@ -492,7 +492,7 @@ static SEL rlSel;
|
||||||
* Copies the objects from the range aRange of the receiver to aBuffer,
|
* Copies the objects from the range aRange of the receiver to aBuffer,
|
||||||
* which must be an area of memory large enough to hold them.
|
* which must be an area of memory large enough to hold them.
|
||||||
*/
|
*/
|
||||||
- (void) getObjects: (id[])aBuffer range: (NSRange)aRange
|
- (void) getObjects: (__unsafe_unretained id[])aBuffer range: (NSRange)aRange
|
||||||
{
|
{
|
||||||
unsigned i, j = 0, c = [self count], e = aRange.location + aRange.length;
|
unsigned i, j = 0, c = [self count], e = aRange.location + aRange.length;
|
||||||
IMP get = [self methodForSelector: oaiSel];
|
IMP get = [self methodForSelector: oaiSel];
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
#import "GNUstepBase/preface.h"
|
||||||
#import "Foundation/NSException.h"
|
#import "Foundation/NSException.h"
|
||||||
#import "Foundation/NSDictionary.h"
|
#import "Foundation/NSDictionary.h"
|
||||||
#import "Foundation/NSThread.h"
|
#import "Foundation/NSThread.h"
|
||||||
|
@ -103,6 +104,7 @@ NSString *const NSAssertionHandlerKey = @"NSAssertionHandler";
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: message arguments: ap];
|
format: message arguments: ap];
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
GS_UNREACHABLE();
|
||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +135,7 @@ NSString *const NSAssertionHandlerKey = @"NSAssertionHandler";
|
||||||
format: message arguments: ap];
|
format: message arguments: ap];
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
|
GS_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSDataStatic : NSObject // Help the compiler
|
@interface NSDataStatic : NSData // Help the compiler
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* Private class from NSIndexSet.m
|
/* Private class from NSIndexSet.m
|
||||||
|
@ -620,7 +620,7 @@ static Class concreteMutableClass = nil;
|
||||||
|
|
||||||
- (id) initWithBitmap: (NSData*)bitmap number: (int)number
|
- (id) initWithBitmap: (NSData*)bitmap number: (int)number
|
||||||
{
|
{
|
||||||
if ((self = [(NSBitmapCharSet*)self initWithBitmap: bitmap]) != nil)
|
if ((self = (_GSStaticCharSet*)[(NSBitmapCharSet*)self initWithBitmap: bitmap]) != nil)
|
||||||
{
|
{
|
||||||
_index = number;
|
_index = number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,18 @@ typedef GSIMapNode_t *GSIMapNode;
|
||||||
(M->legacy ? 0 \
|
(M->legacy ? 0 \
|
||||||
: ((M->cb.pf.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
|
: ((M->cb.pf.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
|
||||||
|
|
||||||
|
#define GSI_MAP_WRITE_KEY(M, addr, x) \
|
||||||
|
if (M->legacy) \
|
||||||
|
*(addr) = x;\
|
||||||
|
else\
|
||||||
|
pointerFunctionsAssign(&M->cb.pf, (void**)addr, (x).obj);
|
||||||
|
#define GSI_MAP_READ_KEY(M,addr) \
|
||||||
|
(M->legacy ? *(addr) :\
|
||||||
|
(typeof(*addr))pointerFunctionsRead(&M->cb.pf, (void**)addr))
|
||||||
|
#define GSI_MAP_ZEROED(M)\
|
||||||
|
(M->legacy ? 0 \
|
||||||
|
: ((M->cb.pf.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
|
||||||
|
|
||||||
#define GSI_MAP_ENUMERATOR NSHashEnumerator
|
#define GSI_MAP_ENUMERATOR NSHashEnumerator
|
||||||
|
|
||||||
#if GS_WITH_GC
|
#if GS_WITH_GC
|
||||||
|
@ -353,7 +365,7 @@ NSEndHashTableEnumeration(NSHashEnumerator *enumerator)
|
||||||
* in the 'node' field.
|
* in the 'node' field.
|
||||||
*/
|
*/
|
||||||
[(id)enumerator->node release];
|
[(id)enumerator->node release];
|
||||||
memset(enumerator, '\0', sizeof(GSIMapEnumerator));
|
memset(enumerator, '\0', sizeof(NSHashEnumerator));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,6 +926,7 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
||||||
|
|
||||||
- (NSUInteger) count
|
- (NSUInteger) count
|
||||||
{
|
{
|
||||||
|
GSIMapRemoveWeak(self);
|
||||||
return (NSUInteger)nodeCount;
|
return (NSUInteger)nodeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,8 @@ typedef GSIMapNode_t *GSIMapNode;
|
||||||
(typeof(*addr))pointerFunctionsRead(&M->cb.pf.v, (void**)addr))
|
(typeof(*addr))pointerFunctionsRead(&M->cb.pf.v, (void**)addr))
|
||||||
#define GSI_MAP_ZEROED(M)\
|
#define GSI_MAP_ZEROED(M)\
|
||||||
(M->legacy ? 0 \
|
(M->legacy ? 0 \
|
||||||
: ((M->cb.pf.k.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
|
: (((M->cb.pf.k.options | M->cb.pf.v.options) & NSPointerFunctionsZeroingWeakMemory) ?\
|
||||||
|
YES : NO))
|
||||||
|
|
||||||
|
|
||||||
#define GSI_MAP_ENUMERATOR NSMapEnumerator
|
#define GSI_MAP_ENUMERATOR NSMapEnumerator
|
||||||
|
@ -518,7 +519,7 @@ NSEndMapTableEnumeration(NSMapEnumerator *enumerator)
|
||||||
* 'bucket' field.
|
* 'bucket' field.
|
||||||
*/
|
*/
|
||||||
[(id)enumerator->node release];
|
[(id)enumerator->node release];
|
||||||
memset(enumerator, '\0', sizeof(GSIMapEnumerator));
|
memset(enumerator, '\0', sizeof(NSMapEnumerator));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,10 +1202,7 @@ const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
|
||||||
|
|
||||||
- (NSUInteger) count
|
- (NSUInteger) count
|
||||||
{
|
{
|
||||||
if (!legacy && (cb.pf.k.options | cb.pf.v.options) & NSPointerFunctionsZeroingWeakMemory)
|
GSIMapRemoveWeak(self);
|
||||||
{
|
|
||||||
GSIMapCleanMap(self);
|
|
||||||
}
|
|
||||||
return (NSUInteger)nodeCount;
|
return (NSUInteger)nodeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,17 +94,6 @@ typedef struct
|
||||||
/* Wrapper functions to make use of the pointer functions.
|
/* Wrapper functions to make use of the pointer functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Acquire the pointer value to store for the specified item.
|
|
||||||
*/
|
|
||||||
static inline void *
|
|
||||||
pointerFunctionsAcquire(PFInfo *PF, void **dst, void *src)
|
|
||||||
{
|
|
||||||
if (PF->acquireFunction != 0)
|
|
||||||
src = (*PF->acquireFunction)(src, PF->sizeFunction,
|
|
||||||
PF->options & NSPointerFunctionsCopyIn ? YES : NO);
|
|
||||||
return src;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the pointer from the specified address, inserting a read barrier if
|
* Reads the pointer from the specified address, inserting a read barrier if
|
||||||
* required.
|
* required.
|
||||||
|
@ -115,6 +104,8 @@ static inline void *pointerFunctionsRead(PFInfo *PF, void **addr)
|
||||||
{
|
{
|
||||||
return WEAK_READ((id*)addr);
|
return WEAK_READ((id*)addr);
|
||||||
}
|
}
|
||||||
|
NSLog(@"Reading from %p", addr);
|
||||||
|
NSLog(@"Value: %p", *addr);
|
||||||
return *addr;
|
return *addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +128,23 @@ static inline void pointerFunctionsAssign(PFInfo *PF, void **addr, void *value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Acquire the pointer value to store for the specified item.
|
||||||
|
*/
|
||||||
|
static inline void *
|
||||||
|
pointerFunctionsAcquire(PFInfo *PF, void **dst, void *src)
|
||||||
|
{
|
||||||
|
if (PF->acquireFunction != 0)
|
||||||
|
src = (*PF->acquireFunction)(src, PF->sizeFunction,
|
||||||
|
PF->options & NSPointerFunctionsCopyIn ? YES : NO);
|
||||||
|
// FIXME: This shouldn't be here. Acquire and assign are separate
|
||||||
|
// operations. Acquire is for copy-in operations (i.e. retain / copy),
|
||||||
|
// assign is for move operations of already-owned pointers. Combining them
|
||||||
|
// like this is Just Plain Wrong™
|
||||||
|
pointerFunctionsAssign(PF, dst, src);
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a pointer from location to another.
|
* Moves a pointer from location to another.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -365,7 +365,7 @@ static BOOL cacheCoders = NO;
|
||||||
static int debug_connection = 0;
|
static int debug_connection = 0;
|
||||||
|
|
||||||
static NSHashTable *connection_table;
|
static NSHashTable *connection_table;
|
||||||
static NSLock *connection_table_gate = nil;
|
static GSLazyRecursiveLock *connection_table_gate = nil;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate an existing connection with the specified send and receive ports.
|
* Locate an existing connection with the specified send and receive ports.
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
/*
|
/*
|
||||||
* Class variables for uniquing objects;
|
* Class variables for uniquing objects;
|
||||||
*/
|
*/
|
||||||
static NSRecursiveLock *uniqueLock = nil;
|
static GSLazyRecursiveLock *uniqueLock = nil;
|
||||||
static NSCountedSet *uniqueSet = nil;
|
static NSCountedSet *uniqueSet = nil;
|
||||||
static IMP uniqueImp = 0;
|
static IMP uniqueImp = 0;
|
||||||
static IMP lockImp = 0;
|
static IMP lockImp = 0;
|
||||||
|
@ -73,7 +73,7 @@ static Class NSCountedSet_concrete_class;
|
||||||
{
|
{
|
||||||
NSCountedSet_abstract_class = self;
|
NSCountedSet_abstract_class = self;
|
||||||
NSCountedSet_concrete_class = [GSCountedSet class];
|
NSCountedSet_concrete_class = [GSCountedSet class];
|
||||||
uniqueLock = [GSLazyLock new];
|
uniqueLock = [GSLazyRecursiveLock new];
|
||||||
lockImp = [uniqueLock methodForSelector: @selector(lock)];
|
lockImp = [uniqueLock methodForSelector: @selector(lock)];
|
||||||
unlockImp = [uniqueLock methodForSelector: @selector(unlock)];
|
unlockImp = [uniqueLock methodForSelector: @selector(unlock)];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2389,7 +2389,7 @@ failure:
|
||||||
+ (id) dataWithShmID: (int)anID length: (NSUInteger)length
|
+ (id) dataWithShmID: (int)anID length: (NSUInteger)length
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SHMCTL
|
#ifdef HAVE_SHMCTL
|
||||||
NSDataShared *d;
|
NSMutableDataShared *d;
|
||||||
|
|
||||||
d = [NSMutableDataShared allocWithZone: NSDefaultMallocZone()];
|
d = [NSMutableDataShared allocWithZone: NSDefaultMallocZone()];
|
||||||
d = [d initWithShmID: anID length: length];
|
d = [d initWithShmID: anID length: length];
|
||||||
|
@ -2502,7 +2502,7 @@ failure:
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return (NSData*)NSAllocateObject(self, 0, z);
|
return NSAllocateObject(self, 0, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creation and Destruction of objects. */
|
/* Creation and Destruction of objects. */
|
||||||
|
@ -2979,7 +2979,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
||||||
@implementation NSDataMappedFile
|
@implementation NSDataMappedFile
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return (NSData*)NSAllocateObject([NSDataMappedFile class], 0, z);
|
return NSAllocateObject([NSDataMappedFile class], 0, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -3070,7 +3070,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
||||||
@implementation NSDataShared
|
@implementation NSDataShared
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return (NSData*)NSAllocateObject([NSDataShared class], 0, z);
|
return NSAllocateObject([NSDataShared class], 0, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -3184,7 +3184,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return (NSData*)NSAllocateObject(mutableDataMalloc, 0, z);
|
return NSAllocateObject(mutableDataMalloc, 0, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Class) classForCoder
|
- (Class) classForCoder
|
||||||
|
@ -3797,7 +3797,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
||||||
@implementation NSMutableDataShared
|
@implementation NSMutableDataShared
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return (NSData*)NSAllocateObject([NSMutableDataShared class], 0, z);
|
return NSAllocateObject([NSMutableDataShared class], 0, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
|
|
@ -78,8 +78,8 @@ static Class calendarClass = nil;
|
||||||
@interface GSDateFuture : GSDateSingle
|
@interface GSDateFuture : GSDateSingle
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static NSDate *_distantPast = nil;
|
static id _distantPast = nil;
|
||||||
static NSDate *_distantFuture = nil;
|
static id _distantFuture = nil;
|
||||||
|
|
||||||
|
|
||||||
static NSString*
|
static NSString*
|
||||||
|
|
|
@ -66,7 +66,7 @@ static table_entry* the_table = 0;
|
||||||
|
|
||||||
static BOOL debug_allocation = NO;
|
static BOOL debug_allocation = NO;
|
||||||
|
|
||||||
static NSLock *uniqueLock = nil;
|
static GSLazyRecursiveLock *uniqueLock = nil;
|
||||||
|
|
||||||
static const char* _GSDebugAllocationList(BOOL difference);
|
static const char* _GSDebugAllocationList(BOOL difference);
|
||||||
static const char* _GSDebugAllocationListAll(void);
|
static const char* _GSDebugAllocationListAll(void);
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#import "Foundation/NSKeyedArchiver.h"
|
#import "Foundation/NSKeyedArchiver.h"
|
||||||
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
||||||
#import "GSPrivate.h"
|
#import "GSPrivate.h"
|
||||||
|
#import "GSFastEnumeration.h"
|
||||||
|
|
||||||
static BOOL GSMacOSXCompatiblePropertyLists(void)
|
static BOOL GSMacOSXCompatiblePropertyLists(void)
|
||||||
{
|
{
|
||||||
|
@ -165,8 +166,8 @@ static SEL appSel;
|
||||||
* and needs to be re-implemented in subclasses in order to have all
|
* and needs to be re-implemented in subclasses in order to have all
|
||||||
* other initialisers work.
|
* other initialisers work.
|
||||||
*/
|
*/
|
||||||
- (id) initWithObjects: (id*)objects
|
- (id) initWithObjects: (const id[])objects
|
||||||
forKeys: (id*)keys
|
forKeys: (const id[])keys
|
||||||
count: (NSUInteger)count
|
count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
self = [self init];
|
self = [self init];
|
||||||
|
@ -396,8 +397,8 @@ static SEL appSel;
|
||||||
* The n th element of the objects array is associated with the n th
|
* The n th element of the objects array is associated with the n th
|
||||||
* element of the keys array.
|
* element of the keys array.
|
||||||
*/
|
*/
|
||||||
+ (id) dictionaryWithObjects: (id*)objects
|
+ (id) dictionaryWithObjects: (const id[])objects
|
||||||
forKeys: (id*)keys
|
forKeys: (const id[])keys
|
||||||
count: (NSUInteger)count
|
count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||||
|
@ -814,6 +815,15 @@ static SEL appSel;
|
||||||
return AUTORELEASE(result);
|
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
|
* Returns an array containing all the dictionary's keys that are
|
||||||
|
@ -1103,7 +1113,7 @@ compareIt(id o1, id o2, void* context)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||||
objects: (id*)stackbuf
|
objects: (__unsafe_unretained id[])stackbuf
|
||||||
count: (NSUInteger)len
|
count: (NSUInteger)len
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[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
|
* The n th element of the objects array is associated with the n th
|
||||||
* element of the keys array.
|
* element of the keys array.
|
||||||
*/
|
*/
|
||||||
- (id) initWithObjects: (id*)objects
|
- (id) initWithObjects: (const id[])objects
|
||||||
forKeys: (id*)keys
|
forKeys: (const id[])keys
|
||||||
count: (NSUInteger)count
|
count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
self = [self initWithCapacity: count];
|
self = [self initWithCapacity: count];
|
||||||
|
|
|
@ -407,7 +407,7 @@ enum proxyLocation
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return placeHolder;
|
return (NSDistantObject*)placeHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
static NSString *localHostName = @"GNUstep local host";
|
static NSString *localHostName = @"GNUstep local host";
|
||||||
static Class hostClass;
|
static Class hostClass;
|
||||||
static NSLock *_hostCacheLock = nil;
|
static NSRecursiveLock *_hostCacheLock = nil;
|
||||||
static BOOL _hostCacheEnabled = YES;
|
static BOOL _hostCacheEnabled = YES;
|
||||||
static NSMutableDictionary *_hostCache = nil;
|
static NSMutableDictionary *_hostCache = nil;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#import "Foundation/NSLock.h"
|
#import "Foundation/NSLock.h"
|
||||||
#import "GNUstepBase/GSLock.h"
|
#import "GNUstepBase/GSLock.h"
|
||||||
|
|
||||||
static NSLock *lock = nil;
|
static GSLazyRecursiveLock *lock = nil;
|
||||||
static NSHashTable *shared = 0;
|
static NSHashTable *shared = 0;
|
||||||
static Class myClass = 0;
|
static Class myClass = 0;
|
||||||
static NSIndexPath *empty = nil;
|
static NSIndexPath *empty = nil;
|
||||||
|
|
|
@ -153,20 +153,6 @@
|
||||||
static Class NSInvocation_abstract_class;
|
static Class NSInvocation_abstract_class;
|
||||||
static Class NSInvocation_concrete_class;
|
static Class NSInvocation_concrete_class;
|
||||||
|
|
||||||
@interface GSInvocationProxy
|
|
||||||
{
|
|
||||||
@public
|
|
||||||
Class isa;
|
|
||||||
id target;
|
|
||||||
NSInvocation *invocation;
|
|
||||||
}
|
|
||||||
+ (id) _newWithTarget: (id)t;
|
|
||||||
- (NSInvocation*) _invocation;
|
|
||||||
- (void) forwardInvocation: (NSInvocation*)anInvocation;
|
|
||||||
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector;
|
|
||||||
@end
|
|
||||||
@interface GSMessageProxy : GSInvocationProxy
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -788,26 +774,6 @@ _arg_addr(NSInvocation *inv, int index)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal use.<br />
|
|
||||||
* Provides a return frame that the ObjectiveC runtime can use to
|
|
||||||
* return the result of an invocation to a calling function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
+ (id) _newProxyForInvocation: (id)target
|
|
||||||
{
|
|
||||||
return [GSInvocationProxy _newWithTarget: target];
|
|
||||||
}
|
|
||||||
+ (id) _newProxyForMessage: (id)target
|
|
||||||
{
|
|
||||||
return [GSMessageProxy _newWithTarget: target];
|
|
||||||
}
|
|
||||||
+ (NSInvocation*) _returnInvocationAndDestroyProxy: (id)proxy
|
|
||||||
{
|
|
||||||
NSInvocation *inv = [proxy _invocation];
|
|
||||||
NSDeallocateObject(proxy);
|
|
||||||
return inv;
|
|
||||||
}
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSInvocation (BackwardCompatibility)
|
@implementation NSInvocation (BackwardCompatibility)
|
||||||
|
@ -849,34 +815,3 @@ _arg_addr(NSInvocation *inv, int index)
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@implementation GSInvocationProxy
|
|
||||||
+ (id) _newWithTarget: (id)t
|
|
||||||
{
|
|
||||||
GSInvocationProxy *o;
|
|
||||||
o = (GSInvocationProxy*) NSAllocateObject(self, 0, NSDefaultMallocZone());
|
|
||||||
o->target = RETAIN(t);
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
- (NSInvocation*) _invocation
|
|
||||||
{
|
|
||||||
return invocation;
|
|
||||||
}
|
|
||||||
- (void) forwardInvocation: (NSInvocation*)anInvocation
|
|
||||||
{
|
|
||||||
invocation = anInvocation;
|
|
||||||
}
|
|
||||||
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
|
|
||||||
{
|
|
||||||
return [target methodSignatureForSelector: aSelector];
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation GSMessageProxy
|
|
||||||
- (NSInvocation*) _invocation
|
|
||||||
{
|
|
||||||
[invocation setTarget: target];
|
|
||||||
return invocation;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ setup()
|
||||||
@interface GSKVOInfo : NSObject
|
@interface GSKVOInfo : NSObject
|
||||||
{
|
{
|
||||||
NSObject *instance; // Not retained.
|
NSObject *instance; // Not retained.
|
||||||
NSLock *iLock;
|
GSLazyRecursiveLock *iLock;
|
||||||
NSMapTable *paths;
|
NSMapTable *paths;
|
||||||
}
|
}
|
||||||
- (GSKVOPathInfo *) lockReturningPathInfoForKey: (NSString *)key;
|
- (GSKVOPathInfo *) lockReturningPathInfoForKey: (NSString *)key;
|
||||||
|
|
|
@ -240,7 +240,7 @@ static Class concreteClass = Nil;
|
||||||
|
|
||||||
for (i = 0; i < _count; i++)
|
for (i = 0; i < _count; i++)
|
||||||
{
|
{
|
||||||
if (pointerFunctionsRead(&_pf, _contents[i]) != 0)
|
if (pointerFunctionsRead(&_pf, &_contents[i]) != 0)
|
||||||
{
|
{
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ static Class concreteClass = Nil;
|
||||||
|
|
||||||
for (i = 0; i < _count; i++)
|
for (i = 0; i < _count; i++)
|
||||||
{
|
{
|
||||||
id obj = pointerFunctionsRead(&_pf, _contents[i]);
|
id obj = pointerFunctionsRead(&_pf, &_contents[i]);
|
||||||
if (obj != 0)
|
if (obj != 0)
|
||||||
{
|
{
|
||||||
[a addObject: obj];
|
[a addObject: obj];
|
||||||
|
@ -309,8 +309,9 @@ static Class concreteClass = Nil;
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < _count; i++)
|
for (i = 0; i < _count; i++)
|
||||||
{
|
{
|
||||||
|
NSLog(@"Copying %d, %p", i, _contents[i]);
|
||||||
pointerFunctionsAcquire(&_pf, &c->_contents[i],
|
pointerFunctionsAcquire(&_pf, &c->_contents[i],
|
||||||
pointerFunctionsRead(&_pf, _contents[i]));
|
pointerFunctionsRead(&_pf, &_contents[i]));
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -433,6 +434,7 @@ static Class concreteClass = Nil;
|
||||||
{
|
{
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
||||||
|
|
||||||
if (index > _count)
|
if (index > _count)
|
||||||
{
|
{
|
||||||
[self _raiseRangeExceptionWithIndex: index from: _cmd];
|
[self _raiseRangeExceptionWithIndex: index from: _cmd];
|
||||||
|
@ -467,7 +469,7 @@ static Class concreteClass = Nil;
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
if (pointerFunctionsEqual(&_pf,
|
if (pointerFunctionsEqual(&_pf,
|
||||||
pointerFunctionsRead(&_pf, _contents[count]),
|
pointerFunctionsRead(&_pf, &_contents[count]),
|
||||||
[other pointerAtIndex: count]) == NO)
|
[other pointerAtIndex: count]) == NO)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ static NSString *_gnu_processName = nil;
|
||||||
static NSArray *_gnu_arguments = nil;
|
static NSArray *_gnu_arguments = nil;
|
||||||
|
|
||||||
// Dictionary of environment vars and their values
|
// Dictionary of environment vars and their values
|
||||||
static NSMutableDictionary *_gnu_environment = nil;
|
static NSDictionary *_gnu_environment = nil;
|
||||||
|
|
||||||
// The operating system we are using.
|
// The operating system we are using.
|
||||||
static unsigned int _operatingSystem = 0;
|
static unsigned int _operatingSystem = 0;
|
||||||
|
|
|
@ -86,7 +86,7 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*);
|
||||||
NSXMLParser *theParser;
|
NSXMLParser *theParser;
|
||||||
NSMutableString *value;
|
NSMutableString *value;
|
||||||
NSMutableArray *stack;
|
NSMutableArray *stack;
|
||||||
NSString *key;
|
id key;
|
||||||
BOOL inArray;
|
BOOL inArray;
|
||||||
BOOL inDictionary;
|
BOOL inDictionary;
|
||||||
BOOL inString;
|
BOOL inString;
|
||||||
|
|
|
@ -408,7 +408,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
||||||
{
|
{
|
||||||
zone = RETAIN(localTimeZone);
|
zone = RETAIN(localTimeZone);
|
||||||
DESTROY(self);
|
DESTROY(self);
|
||||||
return zone;
|
return (GSPlaceholderTimeZone*)zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -557,7 +557,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DESTROY(self);
|
DESTROY(self);
|
||||||
return zone;
|
return (GSPlaceholderTimeZone*)zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) release
|
- (void) release
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
@interface GSSizeValue : NSObject // Help the compiler
|
@interface GSSizeValue : NSObject // Help the compiler
|
||||||
@end
|
@end
|
||||||
@class NSDataStatic; // Needed for decoding.
|
@class NSDataStatic; // Needed for decoding.
|
||||||
@interface NSDataStatic : NSObject // Help the compiler
|
@interface NSDataStatic : NSData // Help the compiler
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -354,8 +354,8 @@
|
||||||
outputStream: (NSOutputStream **)outputStream
|
outputStream: (NSOutputStream **)outputStream
|
||||||
{
|
{
|
||||||
NSString *address = host ? (id)[host address] : (id)@"127.0.0.1";
|
NSString *address = host ? (id)[host address] : (id)@"127.0.0.1";
|
||||||
GSSocketStream *ins = nil;
|
id ins = nil;
|
||||||
GSSocketStream *outs = nil;
|
id outs = nil;
|
||||||
|
|
||||||
// try ipv4 first
|
// try ipv4 first
|
||||||
ins = AUTORELEASE([[GSInetInputStream alloc]
|
ins = AUTORELEASE([[GSInetInputStream alloc]
|
||||||
|
@ -388,8 +388,8 @@
|
||||||
inputStream: (NSInputStream **)inputStream
|
inputStream: (NSInputStream **)inputStream
|
||||||
outputStream: (NSOutputStream **)outputStream
|
outputStream: (NSOutputStream **)outputStream
|
||||||
{
|
{
|
||||||
GSSocketStream *ins = nil;
|
id ins = nil;
|
||||||
GSSocketStream *outs = nil;
|
id outs = nil;
|
||||||
|
|
||||||
ins = AUTORELEASE([[GSLocalInputStream alloc] initToAddr: path]);
|
ins = AUTORELEASE([[GSLocalInputStream alloc] initToAddr: path]);
|
||||||
outs = AUTORELEASE([[GSLocalOutputStream alloc] initToAddr: path]);
|
outs = AUTORELEASE([[GSLocalOutputStream alloc] initToAddr: path]);
|
||||||
|
@ -409,8 +409,8 @@
|
||||||
+ (void) pipeWithInputStream: (NSInputStream **)inputStream
|
+ (void) pipeWithInputStream: (NSInputStream **)inputStream
|
||||||
outputStream: (NSOutputStream **)outputStream
|
outputStream: (NSOutputStream **)outputStream
|
||||||
{
|
{
|
||||||
GSSocketStream *ins = nil;
|
id ins = nil;
|
||||||
GSSocketStream *outs = nil;
|
id outs = nil;
|
||||||
int fds[2];
|
int fds[2];
|
||||||
int pipeReturn;
|
int pipeReturn;
|
||||||
|
|
||||||
|
|
18
Tests/base/NSHashTable/weak.m
Normal file
18
Tests/base/NSHashTable/weak.m
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#import "ObjectTesting.h"
|
||||||
|
#import <Foundation/NSAutoreleasePool.h>
|
||||||
|
#import <Foundation/NSHashTable.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
[NSAutoreleasePool new];
|
||||||
|
NSHashTable *ht = [NSHashTable hashTableWithWeakObjects];
|
||||||
|
id obj = [NSObject new];
|
||||||
|
[ht addObject: obj];
|
||||||
|
PASS([ht containsObject: obj], "Added object to weak hash table");
|
||||||
|
PASS(1 == [ht count], "Weak hash table contains one object");
|
||||||
|
PASS([ht containsObject: obj], "Added object to weak hash table");
|
||||||
|
[obj release];
|
||||||
|
PASS(0 == [ht count], "Weak hash table contains no objects");
|
||||||
|
PASS(0 == [[ht allObjects] count], "Weak hash table contains no objects");
|
||||||
|
return 0;
|
||||||
|
}
|
15
Tests/base/NSPointerArray/weak.m
Normal file
15
Tests/base/NSPointerArray/weak.m
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#import "ObjectTesting.h"
|
||||||
|
#import <Foundation/NSPointerArray.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
[NSAutoreleasePool new];
|
||||||
|
NSPointerArray *pa = [NSPointerArray pointerArrayWithWeakObjects];
|
||||||
|
id obj = [NSObject new];
|
||||||
|
[pa addPointer: obj];
|
||||||
|
PASS([pa count] == 1, "Added object to weak array");
|
||||||
|
[obj release];
|
||||||
|
[pa compact];
|
||||||
|
PASS([pa count] == 0, "Removed object to weak array");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue