64 bit fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29871 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-03-08 06:43:14 +00:00
parent bd80e23aa8
commit 22f8bdb8c4
6 changed files with 53 additions and 42 deletions

View file

@ -1,3 +1,14 @@
2010-03-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSArray.m: Re-remove [GSMutableArray count] (GSMutableArray
uses the GSArray implementation).
* Source/GSDictionary.m:
* Source/GSCountedSet.m:
* Source/GSSet.m:
Add the same sort of NSUInteger fixups that Fred added to GSArray.m
* Headers/Additions/GNUstepBase/GSUnion.h:
Add support for NSInteger and NSUInteger (so GSCountedSet can use them).
2010-03-07 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSArray.m: Re-add [GSMutableArray count]. Change all

View file

@ -29,8 +29,8 @@
/* These are not defined in older Mac OS X systems */
#ifndef NSINTEGER_DEFINED
typedef int NSInteger;
typedef unsigned int NSUInteger;
typedef intptr_t NSInteger;
typedef uintptr_t NSUInteger;
#define NSINTEGER_DEFINED 1
#endif
@ -51,8 +51,9 @@ typedef unsigned int NSUInteger;
#define GSUNION_16B 0x0200
#define GSUNION_32B 0x0400
#define GSUNION_64B 0x0800
#define GSUNION_NSINT 0x1000
#define GSUNION_ALL 0x0fff
#define GSUNION_ALL 0x1fff
#endif /* GSUNION_OBJ */
@ -96,6 +97,10 @@ typedef union {
long slng;
unsigned long ulng;
#endif
#if ((GSUNION_TYPES) & GSUNION_NSINT)
NSInteger nsi;
NSUInteger nsu;
#endif
#if ((GSUNION_TYPES) & GSUNION_PTR)
void *ptr;
const void *cptr;

View file

@ -473,11 +473,6 @@ static Class GSInlineArrayClass;
_version++;
}
- (NSUInteger) count
{
return _count;
}
/**
* Optimised code for copying
*/

View file

@ -33,7 +33,7 @@
#define GSI_MAP_RETAIN_VAL(M, X)
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_KTYPES GSUNION_OBJ
#define GSI_MAP_VTYPES GSUNION_INT
#define GSI_MAP_VTYPES GSUNION_NSINT
#if GS_WITH_GC
#include <gc_typed.h>
@ -131,21 +131,21 @@ static GC_descr nodeDesc; // Type descriptor for map node.
node = GSIMapNodeForKey(&map, (GSIMapKey)anObject);
if (node == 0)
{
GSIMapAddPair(&map,(GSIMapKey)anObject,(GSIMapVal)(unsigned)1);
GSIMapAddPair(&map,(GSIMapKey)anObject,(GSIMapVal)(NSUInteger)1);
}
else
{
node->value.uint++;
node->value.nsu++;
}
_version++;
}
- (unsigned) count
- (NSUInteger) count
{
return map.nodeCount;
}
- (unsigned) countForObject: (id)anObject
- (NSUInteger) countForObject: (id)anObject
{
if (anObject)
{
@ -153,7 +153,7 @@ static GC_descr nodeDesc; // Type descriptor for map node.
if (node)
{
return node->value.uint;
return node->value.nsu;
}
}
return 0;
@ -181,13 +181,13 @@ static GC_descr nodeDesc; // Type descriptor for map node.
while (node != 0)
{
(*imp1)(aCoder, sel1, node->key.obj);
(*imp2)(aCoder, sel2, type, &node->value.uint);
(*imp2)(aCoder, sel2, type, &node->value.nsu);
node = GSIMapEnumeratorNextNode(&enumerator);
}
GSIMapEndEnumerator(&enumerator);
}
- (unsigned) hash
- (NSUInteger) hash
{
return map.nodeCount;
}
@ -198,7 +198,7 @@ static GC_descr nodeDesc; // Type descriptor for map node.
}
/* Designated initialiser */
- (id) initWithCapacity: (unsigned)cap
- (id) initWithCapacity: (NSUInteger)cap
{
GSIMapInitWithZoneAndCapacity(&map, [self zone], cap);
return self;
@ -227,9 +227,9 @@ static GC_descr nodeDesc; // Type descriptor for map node.
return self;
}
- (id) initWithObjects: (id*)objs count: (unsigned)c
- (id) initWithObjects: (id*)objs count: (NSUInteger)c
{
unsigned int i;
NSUInteger i;
self = [self initWithCapacity: c];
if (self == nil)
@ -249,11 +249,11 @@ static GC_descr nodeDesc; // Type descriptor for map node.
node = GSIMapNodeForKey(&map, (GSIMapKey)objs[i]);
if (node == 0)
{
GSIMapAddPair(&map,(GSIMapKey)objs[i],(GSIMapVal)(unsigned)1);
GSIMapAddPair(&map,(GSIMapKey)objs[i],(GSIMapVal)(NSUInteger)1);
}
else
{
node->value.uint++;
node->value.nsu++;
}
}
return self;
@ -286,7 +286,7 @@ static GC_descr nodeDesc; // Type descriptor for map node.
* of the GSIMap enumeration that, once enumerated, an object can be removed
* from the map. If GSIMap ever loses that characterstic, this will break.
*/
- (void) purge: (int)level
- (void) purge: (NSInteger)level
{
if (level > 0)
{
@ -296,12 +296,12 @@ static GC_descr nodeDesc; // Type descriptor for map node.
while (node != 0)
{
if (node->value.uint <= (unsigned int)level)
if (node->value.nsu <= (NSUInteger)level)
{
_version++;
_version++;
GSIMapRemoveNodeFromMap(&map, bucket, node);
GSIMapFreeNode(&map, node);
_version++;
_version++;
}
bucket = GSIMapEnumeratorBucket(&enumerator);
node = GSIMapEnumeratorNextNode(&enumerator);
@ -341,7 +341,7 @@ static GC_descr nodeDesc; // Type descriptor for map node.
node = GSIMapNodeForKeyInBucket(&map, bucket, (GSIMapKey)anObject);
if (node != 0)
{
if (--node->value.uint == 0)
if (--node->value.nsu == 0)
{
GSIMapRemoveNodeFromMap(&map, bucket, node);
GSIMapFreeNode(&map, node);
@ -367,12 +367,12 @@ static GC_descr nodeDesc; // Type descriptor for map node.
if (node == 0)
{
result = anObject;
GSIMapAddPair(&map,(GSIMapKey)anObject,(GSIMapVal)(unsigned)1);
GSIMapAddPair(&map,(GSIMapKey)anObject,(GSIMapVal)(NSUInteger)1);
}
else
{
result = node->key.obj;
node->value.uint++;
node->value.nsu++;
#if !GS_WITH_GC
if (result != anObject)
{

View file

@ -107,7 +107,7 @@ static SEL objSel;
return RETAIN(self);
}
- (unsigned) count
- (NSUInteger) count
{
return map.nodeCount;
}
@ -143,7 +143,7 @@ static SEL objSel;
}
}
- (unsigned) hash
- (NSUInteger) hash
{
return map.nodeCount;
}
@ -183,9 +183,9 @@ static SEL objSel;
}
/* Designated initialiser */
- (id) initWithObjects: (id*)objs forKeys: (id*)keys count: (unsigned)c
- (id) initWithObjects: (id*)objs forKeys: (id*)keys count: (NSUInteger)c
{
unsigned int i;
NSUInteger i;
GSIMapInitWithZoneAndCapacity(&map, [self zone], c);
for (i = 0; i < c; i++)
@ -227,7 +227,7 @@ static SEL objSel;
copyItems: (BOOL)shouldCopy
{
NSZone *z = [self zone];
unsigned c = [other count];
NSUInteger c = [other count];
GSIMapInitWithZoneAndCapacity(&map, z, c);
if (c > 0)
@ -236,7 +236,7 @@ static SEL objSel;
IMP nxtObj = [e methodForSelector: nxtSel];
IMP otherObj = [other methodForSelector: objSel];
BOOL isProxy = [other isProxy];
unsigned i;
NSUInteger i;
for (i = 0; i < c; i++)
{
@ -293,7 +293,7 @@ static SEL objSel;
- (BOOL) isEqualToDictionary: (NSDictionary*)other
{
unsigned count;
NSUInteger count;
if (other == self)
{
@ -386,7 +386,7 @@ static SEL objSel;
}
/* Designated initialiser */
- (id) initWithCapacity: (unsigned)cap
- (id) initWithCapacity: (NSUInteger)cap
{
GSIMapInitWithZoneAndCapacity(&map, [self zone], cap);
return self;

View file

@ -180,7 +180,7 @@ static Class mutableSetClass;
return RETAIN(self);
}
- (unsigned) count
- (NSUInteger) count
{
return map.nodeCount;
}
@ -215,7 +215,7 @@ static Class mutableSetClass;
}
}
- (unsigned) hash
- (NSUInteger) hash
{
return map.nodeCount;
}
@ -252,7 +252,7 @@ static Class mutableSetClass;
}
/* Designated initialiser */
- (id) initWithObjects: (id*)objs count: (unsigned)c
- (id) initWithObjects: (id*)objs count: (NSUInteger)c
{
unsigned i;
@ -559,7 +559,7 @@ static Class mutableSetClass;
- (void) addObjectsFromArray: (NSArray*)array
{
unsigned count = [array count];
NSUInteger count = [array count];
while (count-- > 0)
{
@ -598,14 +598,14 @@ static Class mutableSetClass;
}
/* Designated initialiser */
- (id) initWithCapacity: (unsigned)cap
- (id) initWithCapacity: (NSUInteger)cap
{
GSIMapInitWithZoneAndCapacity(&map, [self zone], cap);
return self;
}
- (id) initWithObjects: (id*)objects
count: (unsigned)count
count: (NSUInteger)count
{
self = [self initWithCapacity: count];