Updates for 10.5 API changes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27962 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-02-23 20:42:32 +00:00
parent 0b528e776c
commit 30cf8bf35b
138 changed files with 2094 additions and 1536 deletions

View file

@ -44,9 +44,9 @@ static void sanity(GSIArray array)
{
if (array != 0)
{
unsigned c = GSIArrayCount(array);
unsigned i;
unsigned last = 0;
NSUInteger c = GSIArrayCount(array);
NSUInteger i;
NSUInteger last = 0;
for (i = 0; i < c; i++)
{
@ -70,11 +70,11 @@ static void sanity(GSIArray array)
* index greater than the argument (or a position beyond the end of the
* array).
*/
static unsigned posForIndex(GSIArray array, unsigned index)
static NSUInteger posForIndex(GSIArray array, NSUInteger index)
{
unsigned int upper = GSIArrayCount(array);
unsigned int lower = 0;
unsigned int pos;
NSUInteger upper = GSIArrayCount(array);
NSUInteger lower = 0;
NSUInteger pos;
/*
* Binary search for an item equal to the one to be inserted.
@ -116,7 +116,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return AUTORELEASE(o);
}
+ (id) indexSetWithIndex: (unsigned int)anIndex
+ (id) indexSetWithIndex: (NSUInteger)anIndex
{
id o = [self allocWithZone: NSDefaultMallocZone()];
@ -132,9 +132,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return AUTORELEASE(o);
}
- (BOOL) containsIndex: (unsigned int)anIndex
- (BOOL) containsIndex: (NSUInteger)anIndex
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (_array == 0 || GSIArrayCount(_array) == 0
@ -148,11 +148,11 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (BOOL) containsIndexes: (NSIndexSet*)aSet
{
unsigned count = _other ? GSIArrayCount(_other) : 0;
NSUInteger count = _other ? GSIArrayCount(_other) : 0;
if (count > 0)
{
unsigned i;
NSUInteger i;
for (i = 0; i < count; i++)
{
@ -169,7 +169,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (BOOL) containsIndexesInRange: (NSRange)aRange
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (NSNotFound - aRange.length < aRange.location)
@ -210,7 +210,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
}
- (unsigned int) count
- (NSUInteger) count
{
if (_array == 0 || GSIArrayCount(_array) == 0)
{
@ -218,9 +218,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
unsigned count = GSIArrayCount(_array);
unsigned total = 0;
unsigned i = 0;
NSUInteger count = GSIArrayCount(_array);
NSUInteger total = 0;
NSUInteger i = 0;
while (i < count)
{
@ -239,9 +239,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
unsigned count = GSIArrayCount(_array);
unsigned total = 0;
unsigned i = 0;
NSUInteger count = GSIArrayCount(_array);
NSUInteger total = 0;
NSUInteger i = 0;
while (i < count)
{
@ -269,8 +269,8 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (NSString*) description
{
NSMutableString *m;
unsigned c = (_array == 0) ? 0 : GSIArrayCount(_array);
unsigned i;
NSUInteger c = (_array == 0) ? 0 : GSIArrayCount(_array);
NSUInteger i;
if (c == 0)
{
@ -299,7 +299,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (void) encodeWithCoder: (NSCoder*)aCoder
{
unsigned rangeCount = 0;
NSUInteger rangeCount = 0;
if (_array != 0)
{
@ -312,7 +312,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
[aCoder encodeValueOfObjCType: @encode(unsigned int)
[aCoder encodeValueOfObjCType: @encode(NSUInteger)
at: &rangeCount];
}
@ -332,21 +332,21 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
[aCoder encodeValueOfObjCType: @encode(unsigned int)
[aCoder encodeValueOfObjCType: @encode(NSUInteger)
at: &r.location];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
[aCoder encodeValueOfObjCType: @encode(NSUInteger)
at: &r.length];
}
}
else
{
NSMutableData *m = [NSMutableData dataWithCapacity: rangeCount*2];
unsigned i;
NSUInteger i;
for (i = 0; i < rangeCount; i++)
{
NSRange r;
unsigned v;
NSUInteger v;
uint8_t b;
r = GSIArrayItemAtIndex(_array, i).ext;
@ -392,7 +392,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
}
- (unsigned int) firstIndex
- (NSUInteger) firstIndex
{
if (_array == 0 || GSIArrayCount(_array) == 0)
{
@ -401,12 +401,12 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return GSIArrayItemAtIndex(_array, 0).ext.location;
}
- (unsigned int) getIndexes: (unsigned int*)aBuffer
maxCount: (unsigned int)aCount
inIndexRange: (NSRangePointer)aRange
- (NSUInteger) getIndexes: (NSUInteger*)aBuffer
maxCount: (NSUInteger)aCount
inIndexRange: (NSRangePointer)aRange
{
unsigned pos;
unsigned i = 0;
NSUInteger pos;
NSUInteger i = 0;
NSRange r;
NSRange fullRange;
@ -439,7 +439,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
r = GSIArrayItemAtIndex(_array, pos).ext;
if (aRange->location < r.location)
{
unsigned skip = r.location - aRange->location;
NSUInteger skip = r.location - aRange->location;
if (skip > aRange->length)
{
@ -465,14 +465,14 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return i;
}
- (unsigned int) hash
- (NSUInteger) hash
{
return [self count];
}
- (unsigned int) indexGreaterThanIndex: (unsigned int)anIndex
- (NSUInteger) indexGreaterThanIndex: (NSUInteger)anIndex
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (anIndex++ == NSNotFound)
@ -492,9 +492,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return r.location;
}
- (unsigned int) indexGreaterThanOrEqualToIndex: (unsigned int)anIndex
- (NSUInteger) indexGreaterThanOrEqualToIndex: (NSUInteger)anIndex
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (anIndex == NSNotFound)
@ -514,9 +514,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return r.location;
}
- (unsigned int) indexLessThanIndex: (unsigned int)anIndex
- (NSUInteger) indexLessThanIndex: (NSUInteger)anIndex
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (anIndex-- == 0)
@ -541,9 +541,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return NSMaxRange(r) - 1;
}
- (unsigned int) indexLessThanOrEqualToIndex: (unsigned int)anIndex
- (NSUInteger) indexLessThanOrEqualToIndex: (NSUInteger)anIndex
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (_array == 0 || GSIArrayCount(_array) == 0
@ -571,7 +571,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (id) initWithCoder: (NSCoder*)aCoder
{
unsigned rangeCount = 0;
NSUInteger rangeCount = 0;
if ([aCoder allowsKeyedCoding])
{
@ -582,7 +582,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
[aCoder decodeValueOfObjCType: @encode(unsigned int)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &rangeCount];
}
@ -592,8 +592,8 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else if (rangeCount == 1)
{
unsigned len = 0;
unsigned loc = 0;
NSUInteger len = 0;
NSUInteger loc = 0;
if ([aCoder allowsKeyedCoding])
{
@ -608,9 +608,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
[aCoder decodeValueOfObjCType: @encode(unsigned int)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &loc];
[aCoder decodeValueOfObjCType: @encode(unsigned int)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &len];
}
self = [self initWithIndexesInRange: NSMakeRange(loc, len)];
@ -620,8 +620,8 @@ static unsigned posForIndex(GSIArray array, unsigned index)
NSMutableIndexSet *other = [NSMutableIndexSet new];
NSData *data = nil;
const uint8_t *bytes;
unsigned length;
unsigned index = 0;
NSUInteger length;
NSUInteger index = 0;
if ([aCoder allowsKeyedCoding])
{
@ -639,9 +639,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
while (index < length)
{
NSRange range;
unsigned offset;
unsigned value;
unsigned next;
NSUInteger offset;
NSUInteger value;
NSUInteger next;
for (offset = 0; index + offset < length; offset++)
{
@ -697,7 +697,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return self;
}
- (id) initWithIndex: (unsigned int)anIndex
- (id) initWithIndex: (NSUInteger)anIndex
{
if (anIndex == NSNotFound)
{
@ -742,11 +742,11 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
else
{
unsigned count = _other ? GSIArrayCount(_other) : 0;
NSUInteger count = _other ? GSIArrayCount(_other) : 0;
if (count > 0)
{
unsigned i;
NSUInteger i;
#if GS_WITH_GC
_data = (GSIArray)NSAllocateCollectable(sizeof(GSIArray_t),
@ -767,8 +767,8 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (BOOL) intersectsIndexesInRange: (NSRange)aRange
{
unsigned p1;
unsigned p2;
NSUInteger p1;
NSUInteger p2;
if (NSNotFound - aRange.length < aRange.location)
{
@ -813,7 +813,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (BOOL) isEqualToIndexSet: (NSIndexSet*)aSet
{
unsigned count = _other ? GSIArrayCount(_other) : 0;
NSUInteger count = _other ? GSIArrayCount(_other) : 0;
if (count != (_array ? GSIArrayCount(_array) : 0))
{
@ -821,7 +821,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
if (count > 0)
{
unsigned i;
NSUInteger i;
for (i = 0; i < count; i++)
{
@ -837,7 +837,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
return YES;
}
- (unsigned int) lastIndex
- (NSUInteger) lastIndex
{
if (_array == 0 || GSIArrayCount(_array) == 0)
{
@ -861,18 +861,18 @@ static unsigned posForIndex(GSIArray array, unsigned index)
#undef _other
#define _other ((GSIArray)(((NSMutableIndexSet*)aSet)->_data))
- (void) addIndex: (unsigned int)anIndex
- (void) addIndex: (NSUInteger)anIndex
{
[self addIndexesInRange: NSMakeRange(anIndex, 1)];
}
- (void) addIndexes: (NSIndexSet*)aSet
{
unsigned count = _other ? GSIArrayCount(_other) : 0;
NSUInteger count = _other ? GSIArrayCount(_other) : 0;
if (count > 0)
{
unsigned i;
NSUInteger i;
for (i = 0; i < count; i++)
{
@ -885,7 +885,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (void) addIndexesInRange: (NSRange)aRange
{
unsigned pos;
NSUInteger pos;
if (NSNotFound - aRange.length < aRange.location)
{
@ -991,18 +991,18 @@ static unsigned posForIndex(GSIArray array, unsigned index)
}
}
- (void) removeIndex: (unsigned int)anIndex
- (void) removeIndex: (NSUInteger)anIndex
{
[self removeIndexesInRange: NSMakeRange(anIndex, 1)];
}
- (void) removeIndexes: (NSIndexSet*)aSet
{
unsigned count = _other ? GSIArrayCount(_other) : 0;
NSUInteger count = _other ? GSIArrayCount(_other) : 0;
if (count > 0)
{
unsigned i;
NSUInteger i;
for (i = 0; i < count; i++)
{
@ -1015,7 +1015,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (void) removeIndexesInRange: (NSRange)aRange
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (NSNotFound - aRange.length < aRange.location)
@ -1126,12 +1126,12 @@ static unsigned posForIndex(GSIArray array, unsigned index)
SANITY();
}
- (void) shiftIndexesStartingAtIndex: (unsigned int)anIndex by: (int)amount
- (void) shiftIndexesStartingAtIndex: (NSUInteger)anIndex by: (NSInteger)amount
{
if (amount != 0 && _array != 0 && GSIArrayCount(_array) > 0)
{
unsigned c;
unsigned pos;
NSUInteger c;
NSUInteger pos;
if (amount > 0)
{
@ -1238,9 +1238,9 @@ static unsigned posForIndex(GSIArray array, unsigned index)
@implementation NSIndexSet (NSCharacterSet)
/* Extra method to let NSCharacterSet play with index sets more efficiently.
*/
- (unsigned int) _gapGreaterThanIndex: (unsigned int)anIndex
- (NSUInteger) _gapGreaterThanIndex: (NSUInteger)anIndex
{
unsigned pos;
NSUInteger pos;
NSRange r;
if (anIndex++ == NSNotFound)
@ -1290,7 +1290,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
[super dealloc];
}
- (id) _initWithBytes: (const void*)bytes length: (unsigned)length
- (id) _initWithBytes: (const void*)bytes length: (NSUInteger)length
{
NSAssert(length % sizeof(NSRange) == 0, NSInvalidArgumentException);
length /= sizeof(NSRange);