64bit fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29872 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-03-08 07:06:47 +00:00
parent 22f8bdb8c4
commit 3132d54a5d
8 changed files with 105 additions and 78 deletions

View file

@ -25,10 +25,18 @@
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
#if defined(GNUSTEP_BASE_INTERNAL)
#import "Foundation/NSObject.h"
#import "Foundation/NSException.h"
#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSZone.h"
#else
#import <Foundation/NSObject.h>
#import <Foundation/NSException.h>
#import <Foundation/NSGarbageCollector.h>
#import <Foundation/NSZone.h>
#endif
/* To turn assertions on, define GSI_ARRAY_CHECKS */
#define GSI_ARRAY_CHECKS 1
@ -146,7 +154,11 @@ extern "C" {
/*
* Generate the union typedef
*/
#if defined(GNUSTEP_BASE_INTERNAL)
#include "GNUstepBase/GSUnion.h"
#else
#include <GNUstepBase/GSUnion.h>
#endif
#endif /* #ifndef GSIArrayItem */

View file

@ -27,10 +27,17 @@
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
#include <Foundation/NSObject.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSGarbageCollector.h>
#include <Foundation/NSZone.h>
#if defined(GNUSTEP_BASE_INTERNAL)
#import "Foundation/NSObject.h"
#import "Foundation/NSEnumerator.h"
#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSZone.h"
#else
#import <Foundation/NSObject.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSGarbageCollector.h>
#import <Foundation/NSZone.h>
#endif
#if defined(__cplusplus)
extern "C" {
@ -160,7 +167,11 @@ extern "C" {
/*
* Generate the union typedef
*/
#if defined(GNUSTEP_BASE_INTERNAL)
#include "GNUstepBase/GSUnion.h"
#else
#include <GNUstepBase/GSUnion.h>
#endif
#if (GSI_MAP_KTYPES) & GSUNION_OBJ
@ -209,7 +220,11 @@ extern "C" {
/*
* Generate the union typedef
*/
#if defined(GNUSTEP_BASE_INTERNAL)
#include "GNUstepBase/GSUnion.h"
#else
#include <GNUstepBase/GSUnion.h>
#endif
#if (GSI_MAP_VTYPES) & GSUNION_OBJ
#define GSI_MAP_CLEAR_VAL(node) node->value.obj = nil

View file

@ -58,7 +58,7 @@ static Class gcClass = 0;
{
GCArray *result;
id *objects;
unsigned i, c = [self count];
NSUInteger i, c = [self count];
if (NSShouldRetainWithZone(self, zone))
{
@ -248,7 +248,7 @@ static Class gcClass = 0;
{
GCArray *result;
id *objects;
unsigned i, c = [self count];
NSUInteger i, c = [self count];
objects = NSZoneMalloc(zone, c * sizeof(id));
/* FIXME: Check if malloc return 0 */
@ -342,7 +342,7 @@ static Class gcClass = 0;
if (_count == _maxCount)
{
unsigned old = _maxCount;
NSUInteger old = _maxCount;
BOOL *optr;
if (_maxCount > 0)

View file

@ -38,12 +38,12 @@
*/
- (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy
{
unsigned c = [array count];
NSUInteger c = [array count];
GS_BEGINIDBUF(objects, c);
if ([array isProxy])
{
unsigned i;
NSUInteger i;
for (i = 0; i < c; i++)
{
@ -56,7 +56,7 @@
}
if (shouldCopy == YES)
{
unsigned i;
NSUInteger i;
for (i = 0; i < c; i++)
{
@ -79,13 +79,13 @@
}
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context
{
unsigned count = [self count];
unsigned upper = count;
unsigned lower = 0;
unsigned index;
NSUInteger count = [self count];
NSUInteger upper = count;
NSUInteger lower = 0;
NSUInteger index;
SEL oaiSel;
IMP oai;
@ -136,12 +136,12 @@
}
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp
usingSelector: (SEL)comp
{
unsigned count = [self count];
unsigned upper = count;
unsigned lower = 0;
unsigned index;
NSUInteger count = [self count];
NSUInteger upper = count;
NSUInteger lower = 0;
NSUInteger index;
NSComparisonResult (*imp)(id, SEL, id);
SEL oaiSel;
IMP oai;

View file

@ -62,7 +62,7 @@ static Class GSInlineArrayClass;
@interface GSArrayEnumerator : NSEnumerator
{
GSArray *array;
unsigned pos;
NSUInteger pos;
}
- (id) initWithArray: (GSArray*)anArray;
@end
@ -71,12 +71,12 @@ static Class GSInlineArrayClass;
@end
@interface GSMutableArray (GSArrayBehavior)
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel;
- (void) _raiseRangeExceptionWithIndex: (NSUInteger)index from: (SEL)sel;
@end
@implementation GSArray
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel
- (void) _raiseRangeExceptionWithIndex: (NSUInteger)index from: (SEL)sel
{
NSDictionary *info;
NSException *exception;
@ -129,7 +129,7 @@ static Class GSInlineArrayClass;
if (_contents_array)
{
#if !GS_WITH_GC
unsigned i;
NSUInteger i;
for (i = 0; i < _count; i++)
{
@ -152,7 +152,7 @@ static Class GSInlineArrayClass;
{
if (count > 0)
{
unsigned i;
NSUInteger i;
#if GS_WITH_GC
_contents_array = NSAllocateCollectable(sizeof(id)*count,
@ -191,7 +191,7 @@ static Class GSInlineArrayClass;
{
/* For performace we encode directly ... must exactly match the
* superclass implemenation. */
[aCoder encodeValueOfObjCType: @encode(unsigned)
[aCoder encodeValueOfObjCType: @encode(NSUInteger)
at: &_count];
if (_count > 0)
{
@ -212,7 +212,7 @@ static Class GSInlineArrayClass;
{
/* for performance, we decode directly into memory rather than
* using the superclass method. Must exactly match superclass. */
[aCoder decodeValueOfObjCType: @encode(unsigned)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &_count];
if (_count > 0)
{
@ -255,7 +255,7 @@ static Class GSInlineArrayClass;
if (_count > 1)
{
BOOL (*imp)(id,SEL,id);
unsigned i;
NSUInteger i;
imp = (BOOL (*)(id,SEL,id))[anObject methodForSelector: eqSel];
@ -276,7 +276,7 @@ static Class GSInlineArrayClass;
- (NSUInteger) indexOfObjectIdenticalTo: anObject
{
unsigned i;
NSUInteger i;
for (i = 0; i < _count; i++)
{
@ -290,7 +290,7 @@ static Class GSInlineArrayClass;
- (BOOL) isEqualToArray: (NSArray*)otherArray
{
unsigned i;
NSUInteger i;
if (self == (id)otherArray)
{
@ -335,7 +335,7 @@ static Class GSInlineArrayClass;
- (void) makeObjectsPerformSelector: (SEL)aSelector
{
unsigned i;
NSUInteger i;
for (i = 0; i < _count; i++)
{
@ -345,7 +345,7 @@ static Class GSInlineArrayClass;
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)argument
{
unsigned i;
NSUInteger i;
for (i = 0; i < _count; i++)
{
@ -355,7 +355,7 @@ static Class GSInlineArrayClass;
- (void) getObjects: (id*)aBuffer
{
unsigned i;
NSUInteger i;
for (i = 0; i < _count; i++)
{
@ -365,7 +365,7 @@ static Class GSInlineArrayClass;
- (void) getObjects: (id*)aBuffer range: (NSRange)aRange
{
unsigned i, j = 0, e = aRange.location + aRange.length;
NSUInteger i, j = 0, e = aRange.location + aRange.length;
GS_RANGE_CHECK(aRange, _count);
@ -394,7 +394,7 @@ static Class GSInlineArrayClass;
{
if (_contents_array)
{
unsigned i;
NSUInteger i;
for (i = 0; i < _count; i++)
{
@ -415,7 +415,7 @@ static Class GSInlineArrayClass;
if (count > 0)
{
unsigned i;
NSUInteger i;
for (i = 0; i < count; i++)
{
@ -542,9 +542,9 @@ static Class GSInlineArrayClass;
}
else
{
unsigned count;
NSUInteger count;
[aCoder decodeValueOfObjCType: @encode(unsigned)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &count];
if ((self = [self initWithCapacity: count]) == nil)
{
@ -567,7 +567,7 @@ static Class GSInlineArrayClass;
self = [self initWithCapacity: count];
if (self != nil && count > 0)
{
unsigned i;
NSUInteger i;
for (i = 0; i < count; i++)
{
@ -661,7 +661,7 @@ static Class GSInlineArrayClass;
- (void) removeObject: (id)anObject
{
unsigned index;
NSUInteger index;
_version++;
if (anObject == nil)
@ -682,7 +682,7 @@ static Class GSInlineArrayClass;
{
if ((*imp)(anObject, eqSel, _contents_array[index]) == YES)
{
unsigned pos = index;
NSUInteger pos = index;
#if GS_WITH_GC == 0
id obj = _contents_array[index];
@ -735,7 +735,7 @@ static Class GSInlineArrayClass;
- (void) removeObjectIdenticalTo: (id)anObject
{
unsigned index;
NSUInteger index;
_version++;
if (anObject == nil)
@ -751,7 +751,7 @@ static Class GSInlineArrayClass;
#if GS_WITH_GC == 0
id obj = _contents_array[index];
#endif
unsigned pos = index;
NSUInteger pos = index;
while (++pos < _count)
{
@ -765,7 +765,7 @@ static Class GSInlineArrayClass;
_version++;
}
- (void) replaceObjectAtIndex: (unsigned)index withObject: (id)anObject
- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject
{
id obj;
@ -806,11 +806,11 @@ static Class GSInlineArrayClass;
/* Shell sort algorithm taken from SortingInAction - a NeXT example */
#define STRIDE_FACTOR 3 // good value for stride factor is not well-understood
// 3 is a fairly good choice (Sedgewick)
unsigned int c;
unsigned int d;
unsigned int stride = 1;
NSUInteger c;
NSUInteger d;
NSUInteger stride = 1;
BOOL found;
unsigned int count = _count;
NSUInteger count = _count;
#ifdef GSWARN
BOOL badComparison = NO;
#endif
@ -979,13 +979,13 @@ static Class GSInlineArrayClass;
* added is 'less than' the item in the array, NSOrderedDescending
* if it is greater, and NSOrderedSame if it is equal.
*/
- (unsigned) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context
- (NSUInteger) insertionPosition: (id)item
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter
context: (void *)context
{
unsigned upper = _count;
unsigned lower = 0;
unsigned index;
NSUInteger upper = _count;
NSUInteger lower = 0;
NSUInteger index;
if (item == nil)
{
@ -1031,12 +1031,12 @@ static Class GSInlineArrayClass;
return index;
}
- (unsigned) insertionPosition: (id)item
usingSelector: (SEL)comp
- (NSUInteger) insertionPosition: (id)item
usingSelector: (SEL)comp
{
unsigned upper = _count;
unsigned lower = 0;
unsigned index;
NSUInteger upper = _count;
NSUInteger lower = 0;
NSUInteger index;
NSComparisonResult (*imp)(id, SEL, id);
if (item == nil)
@ -1135,17 +1135,17 @@ static Class GSInlineArrayClass;
}
else
{
unsigned c;
NSUInteger c;
#if GS_WITH_GC
GSArray *a;
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &c];
[aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &c];
a = (id)NSAllocateObject(GSArrayClass, 0, [self zone]);
a->_contents_array = NSAllocateCollectable(sizeof(id)*c, NSScannedOption);
#else
GSInlineArray *a;
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &c];
[aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &c];
a = (id)NSAllocateObject(GSInlineArrayClass,
sizeof(id)*c, [self zone]);
a->_contents_array

View file

@ -167,12 +167,12 @@ static GC_descr nodeDesc; // Type descriptor for map node.
- (void) encodeWithCoder: (NSCoder*)aCoder
{
unsigned count = map.nodeCount;
NSUInteger count = map.nodeCount;
SEL sel1 = @selector(encodeObject:);
IMP imp1 = [aCoder methodForSelector: sel1];
SEL sel2 = @selector(encodeValueOfObjCType:at:);
IMP imp2 = [aCoder methodForSelector: sel2];
const char *type = @encode(unsigned);
const char *type = @encode(NSUInteger);
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
@ -206,12 +206,12 @@ static GC_descr nodeDesc; // Type descriptor for map node.
- (id) initWithCoder: (NSCoder*)aCoder
{
unsigned count;
NSUInteger count;
id value;
unsigned valcnt;
NSUInteger valcnt;
SEL sel = @selector(decodeValueOfObjCType:at:);
IMP imp = [aCoder methodForSelector: sel];
const char *utype = @encode(unsigned);
const char *utype = @encode(NSUInteger);
const char *otype = @encode(id);
(*imp)(aCoder, sel, utype, &count);

View file

@ -126,13 +126,13 @@ static SEL objSel;
}
else
{
unsigned count = map.nodeCount;
NSUInteger count = map.nodeCount;
SEL sel = @selector(encodeObject:);
IMP imp = [aCoder methodForSelector: sel];
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];
[aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &count];
while (node != 0)
{
(*imp)(aCoder, sel, node->key.obj);
@ -161,14 +161,14 @@ static SEL objSel;
}
else
{
unsigned count;
NSUInteger count;
id key;
id value;
SEL sel = @selector(decodeValueOfObjCType:at:);
IMP imp = [aCoder methodForSelector: sel];
const char *type = @encode(id);
[aCoder decodeValueOfObjCType: @encode(unsigned)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &count];
GSIMapInitWithZoneAndCapacity(&map, [self zone], count);

View file

@ -135,7 +135,7 @@ static Class mutableSetClass;
{
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
unsigned i = 0;
NSUInteger i = 0;
NSArray *result;
GS_BEGINIDBUF(objects, map.nodeCount);
@ -199,13 +199,13 @@ static Class mutableSetClass;
}
else
{
unsigned count = map.nodeCount;
NSUInteger count = map.nodeCount;
SEL sel = @selector(encodeObject:);
IMP imp = [aCoder methodForSelector: sel];
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];
[aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &count];
while (node != 0)
{
(*imp)(aCoder, sel, node->key.obj);
@ -233,13 +233,13 @@ static Class mutableSetClass;
}
else
{
unsigned count;
NSUInteger count;
id value;
SEL sel = @selector(decodeValueOfObjCType:at:);
IMP imp = [aCoder methodForSelector: sel];
const char *type = @encode(id);
(*imp)(aCoder, sel, @encode(unsigned), &count);
(*imp)(aCoder, sel, @encode(NSUInteger), &count);
GSIMapInitWithZoneAndCapacity(&map, [self zone], count);
while (count-- > 0)
@ -254,7 +254,7 @@ static Class mutableSetClass;
/* Designated initialiser */
- (id) initWithObjects: (id*)objs count: (NSUInteger)c
{
unsigned i;
NSUInteger i;
GSIMapInitWithZoneAndCapacity(&map, [self zone], c);
for (i = 0; i < c; i++)