mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 02:01:03 +00:00
* Source/GSArray.m: Re-add [GSMutableArray count]. Change all
method parameters from int or unsigned to NSUInteger to match super classes. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29867 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
026d6fc751
commit
bd80e23aa8
2 changed files with 31 additions and 20 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2010-03-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/GSArray.m: Re-add [GSMutableArray count]. Change all
|
||||||
|
method parameters from int or unsigned to NSUInteger to match
|
||||||
|
super classes.
|
||||||
|
|
||||||
2010-03-07 Richard Frith-Macdonald <rfm@gnu.org>
|
2010-03-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Additions/GSObjCRuntime.m:
|
* Source/Additions/GSObjCRuntime.m:
|
||||||
|
|
|
@ -49,7 +49,7 @@ static Class GSInlineArrayClass;
|
||||||
* However, when GC is enabled the object data is typed, and all data after
|
* However, when GC is enabled the object data is typed, and all data after
|
||||||
* the end of the class is ignored by the garbage collector (which would
|
* the end of the class is ignored by the garbage collector (which would
|
||||||
* mean that objects in the array could be collected).
|
* mean that objects in the array could be collected).
|
||||||
* We therefore do not provide the class ewhan GC is being used.
|
* We therefore do not provide the class when GC is being used.
|
||||||
*/
|
*/
|
||||||
@interface GSInlineArray : GSArray
|
@interface GSInlineArray : GSArray
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the designated initializer for NSArray. */
|
/* This is the designated initializer for NSArray. */
|
||||||
- (id) initWithObjects: (id*)objects count: (unsigned)count
|
- (id) initWithObjects: (id*)objects count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
@ -235,17 +235,17 @@ static Class GSInlineArrayClass;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned) count
|
- (NSUInteger) count
|
||||||
{
|
{
|
||||||
return _count;
|
return _count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned) hash
|
- (NSUInteger) hash
|
||||||
{
|
{
|
||||||
return _count;
|
return _count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned) indexOfObject: anObject
|
- (NSUInteger) indexOfObject: anObject
|
||||||
{
|
{
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
return NSNotFound;
|
return NSNotFound;
|
||||||
|
@ -274,7 +274,7 @@ static Class GSInlineArrayClass;
|
||||||
return NSNotFound;
|
return NSNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned) indexOfObjectIdenticalTo: anObject
|
- (NSUInteger) indexOfObjectIdenticalTo: anObject
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ static Class GSInlineArrayClass;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectAtIndex: (unsigned)index
|
- (id) objectAtIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
if (index >= _count)
|
if (index >= _count)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: argument
|
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)argument
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ static Class GSInlineArrayClass;
|
||||||
{
|
{
|
||||||
return [self initWithObjects: 0 count: 0];
|
return [self initWithObjects: 0 count: 0];
|
||||||
}
|
}
|
||||||
- (id) initWithObjects: (id*)objects count: (unsigned)count
|
- (id) initWithObjects: (id*)objects count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
_contents_array
|
_contents_array
|
||||||
= (id*)(((void*)self) + class_getInstanceSize([self class]));
|
= (id*)(((void*)self) + class_getInstanceSize([self class]));
|
||||||
|
@ -473,6 +473,11 @@ static Class GSInlineArrayClass;
|
||||||
_version++;
|
_version++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSUInteger) count
|
||||||
|
{
|
||||||
|
return _count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optimised code for copying
|
* Optimised code for copying
|
||||||
*/
|
*/
|
||||||
|
@ -488,8 +493,8 @@ static Class GSInlineArrayClass;
|
||||||
return [copy initWithObjects: _contents_array count: _count];
|
return [copy initWithObjects: _contents_array count: _count];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) exchangeObjectAtIndex: (unsigned int)i1
|
- (void) exchangeObjectAtIndex: (NSUInteger)i1
|
||||||
withObjectAtIndex: (unsigned int)i2
|
withObjectAtIndex: (NSUInteger)i2
|
||||||
{
|
{
|
||||||
_version++;
|
_version++;
|
||||||
if (i1 >= _count)
|
if (i1 >= _count)
|
||||||
|
@ -515,7 +520,7 @@ static Class GSInlineArrayClass;
|
||||||
return [self initWithCapacity: 0];
|
return [self initWithCapacity: 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCapacity: (unsigned)cap
|
- (id) initWithCapacity: (NSUInteger)cap
|
||||||
{
|
{
|
||||||
if (cap == 0)
|
if (cap == 0)
|
||||||
{
|
{
|
||||||
|
@ -562,7 +567,7 @@ static Class GSInlineArrayClass;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithObjects: (id*)objects count: (unsigned)count
|
- (id) initWithObjects: (id*)objects count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
self = [self initWithCapacity: count];
|
self = [self initWithCapacity: count];
|
||||||
if (self != nil && count > 0)
|
if (self != nil && count > 0)
|
||||||
|
@ -584,7 +589,7 @@ static Class GSInlineArrayClass;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) insertObject: (id)anObject atIndex: (unsigned)index
|
- (void) insertObject: (id)anObject atIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
_version++;
|
_version++;
|
||||||
if (!anObject)
|
if (!anObject)
|
||||||
|
@ -712,7 +717,7 @@ static Class GSInlineArrayClass;
|
||||||
_version++;
|
_version++;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObjectAtIndex: (unsigned)index
|
- (void) removeObjectAtIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
id obj;
|
id obj;
|
||||||
|
|
||||||
|
@ -1107,7 +1112,7 @@ static Class GSInlineArrayClass;
|
||||||
return self; // placeholders never get released.
|
return self; // placeholders never get released.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectAtIndex: (unsigned)index
|
- (id) objectAtIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Attempt to use uninitialised array"];
|
format: @"Attempt to use uninitialised array"];
|
||||||
|
@ -1162,7 +1167,7 @@ static Class GSInlineArrayClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithObjects: (id*)objects count: (unsigned)count
|
- (id) initWithObjects: (id*)objects count: (NSUInteger)count
|
||||||
{
|
{
|
||||||
#if GS_WITH_GC
|
#if GS_WITH_GC
|
||||||
self = (id)NSAllocateObject(GSArrayClass, 0, [self zone]);
|
self = (id)NSAllocateObject(GSArrayClass, 0, [self zone]);
|
||||||
|
@ -1173,7 +1178,7 @@ static Class GSInlineArrayClass;
|
||||||
return [self initWithObjects: objects count: count];
|
return [self initWithObjects: objects count: count];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned) count
|
- (NSUInteger) count
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Attempt to use uninitialised array"];
|
format: @"Attempt to use uninitialised array"];
|
||||||
|
|
Loading…
Reference in a new issue