* Changes so additions compiles on older Mac OS X 10.1.5

* Source/Additions/GCArray.m (-copyWithZone:): Use more standard
array initialization method.
(mutableCopyWithZone:,	[GCMutableArray -copyWithZone:],
[GCMutableArray -mutableCopyWithZone:]): Idem.

* Source/Additions/GSCategories.m ([NSData -hexadecimalRepresentation]):
Use identically functioning, but older, standard data initialization.
* Source/Additions/GSCategories.m ([NSMutableString
-replaceString:withString:]): Rewrite to use older, standard
methods.

* Tools/AGSHtml.m ([AGSHtml -outputNode:to:]): Use GNUstep addition
method to replace string.
* Tools/autogsdoc.m (main): Idem.
(Patch from Markus Hitter).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20448 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2004-12-13 04:53:01 +00:00
parent 066c26ca24
commit cf410d2149
5 changed files with 68 additions and 32 deletions

View file

@ -57,11 +57,26 @@ static Class gcClass = 0;
- (id) copyWithZone: (NSZone*)zone
{
GCArray *result;
id *objects;
unsigned i, c = [self count];
if (NSShouldRetainWithZone(self, zone))
{
return [self retain];
}
return [[GCArray allocWithZone: zone] initWithArray: self copyItems: YES];
objects = NSZoneMalloc(zone, c * sizeof(id));
/* FIXME: Check if malloc return 0 */
[self getObjects: objects];
for (i = 0; i < c; i++)
{
objects[i] = [objects[i] copy];
}
result = [[GCArray allocWithZone: zone] initWithObjects: objects count: c];
NSZoneFree(zone, objects);
return result;
}
- (unsigned int) count
@ -189,8 +204,7 @@ static Class gcClass = 0;
- (id) mutableCopyWithZone: (NSZone*)zone
{
return [[GCMutableArray allocWithZone: zone]
initWithArray: self copyItems: NO];
return [[GCMutableArray allocWithZone: zone] initWithArray: self];
}
- (id) objectAtIndex: (unsigned int)index
@ -233,8 +247,21 @@ static Class gcClass = 0;
- (id) copyWithZone: (NSZone*)zone
{
return [[GCArray allocWithZone: zone]
initWithArray: self copyItems: YES];
GCArray *result;
id *objects;
unsigned i, c = [self count];
objects = NSZoneMalloc(zone, c * sizeof(id));
/* FIXME: Check if malloc return 0 */
[self getObjects: objects];
for (i = 0; i < c; i++)
{
objects[i] = [objects[i] copy];
}
result = [[GCArray allocWithZone: zone] initWithObjects: objects count: c];
NSZoneFree(zone, objects);
return result;
}
- (id) init
@ -345,8 +372,7 @@ static Class gcClass = 0;
- (id) mutableCopyWithZone: (NSZone*)zone
{
return [[GCMutableArray allocWithZone: zone]
initWithArray: self copyItems: NO];
return [[GCMutableArray allocWithZone: zone] initWithArray: self];
}
- (void) removeAllObjects

View file

@ -135,7 +135,7 @@
dst[dpos++] = hexChars[c & 0x0f];
}
data = [NSData allocWithZone: NSDefaultMallocZone()];
data = [data initWithBytesNoCopy: dst length: dlen freeWhenDone: YES];
data = [data initWithBytesNoCopy: dst length: dlen];
string = [[NSString alloc] initWithData: data
encoding: NSASCIIStringEncoding];
RELEASE(data);
@ -1070,10 +1070,12 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
- (void) replaceString: (NSString*)replace
withString: (NSString*)by
{
[self replaceOccurrencesOfString: replace
withString: by
options: 0
range: NSMakeRange(0, [self length])];
NSRange range = [self rangeOfString: replace];
while (range.location != NSNotFound) {
[self replaceCharactersInRange: range withString: by];
range = [self rangeOfString: replace];
}
}
/**