* 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:
fedor 2004-12-13 04:53:01 +00:00
parent bedca778cd
commit 531dd954e2
5 changed files with 68 additions and 32 deletions

View file

@ -1,3 +1,22 @@
2004-12-12 Adam Fedor <fedor@gnu.org>
* 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).
2004-12-12 Adam Fedor <fedor@gnu.org> 2004-12-12 Adam Fedor <fedor@gnu.org>
* configure.ac: Avoid improper use of -fXXX-runtime. Add -x objective-c * configure.ac: Avoid improper use of -fXXX-runtime. Add -x objective-c

View file

@ -57,11 +57,26 @@ static Class gcClass = 0;
- (id) copyWithZone: (NSZone*)zone - (id) copyWithZone: (NSZone*)zone
{ {
GCArray *result;
id *objects;
unsigned i, c = [self count];
if (NSShouldRetainWithZone(self, zone)) if (NSShouldRetainWithZone(self, zone))
{ {
return [self retain]; 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 - (unsigned int) count
@ -189,8 +204,7 @@ static Class gcClass = 0;
- (id) mutableCopyWithZone: (NSZone*)zone - (id) mutableCopyWithZone: (NSZone*)zone
{ {
return [[GCMutableArray allocWithZone: zone] return [[GCMutableArray allocWithZone: zone] initWithArray: self];
initWithArray: self copyItems: NO];
} }
- (id) objectAtIndex: (unsigned int)index - (id) objectAtIndex: (unsigned int)index
@ -233,8 +247,21 @@ static Class gcClass = 0;
- (id) copyWithZone: (NSZone*)zone - (id) copyWithZone: (NSZone*)zone
{ {
return [[GCArray allocWithZone: zone] GCArray *result;
initWithArray: self copyItems: YES]; 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 - (id) init
@ -345,8 +372,7 @@ static Class gcClass = 0;
- (id) mutableCopyWithZone: (NSZone*)zone - (id) mutableCopyWithZone: (NSZone*)zone
{ {
return [[GCMutableArray allocWithZone: zone] return [[GCMutableArray allocWithZone: zone] initWithArray: self];
initWithArray: self copyItems: NO];
} }
- (void) removeAllObjects - (void) removeAllObjects

View file

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

View file

@ -1561,8 +1561,8 @@ static NSString *mainFont = nil;
// get rid of nbsps put in for readability above // get rid of nbsps put in for readability above
linkRef = [NSMutableString stringWithCapacity: [sel length]]; linkRef = [NSMutableString stringWithCapacity: [sel length]];
[linkRef setString:sel]; [linkRef setString:sel];
[linkRef replaceOccurrencesOfString:@"&nbsp;" withString:@"" [linkRef replaceString: @"&nbsp;" withString: @""];
options: 0 range: NSMakeRange(0, [sel length])];
s = [self makeLink: linkRef ofType: @"method" inUnit: nil isRef: NO]; s = [self makeLink: linkRef ofType: @"method" inUnit: nil isRef: NO];
if (s != nil) if (s != nil)
{ {

View file

@ -1779,10 +1779,8 @@ main(int argc, char **argv, char **env)
@" </chapter>\n" @" </chapter>\n"
@" </body>\n" @" </body>\n"
@"</gsdoc>\n"]; @"</gsdoc>\n"];
[tocSkel replaceOccurrencesOfString: @"[prjName]" withString: project [tocSkel replaceString: @"[prjName]" withString: project];
options: 0
range: NSMakeRange(0, [tocSkel length])];
// file for top-left frame (header only; rest appended below) // file for top-left frame (header only; rest appended below)
idxIndexFile = [@"MainIndex" stringByAppendingPathExtension: @"html"]; idxIndexFile = [@"MainIndex" stringByAppendingPathExtension: @"html"];
[idxIndex setString: @"<HTML>\n <BODY>\n" [idxIndex setString: @"<HTML>\n <BODY>\n"
@ -1806,10 +1804,8 @@ main(int argc, char **argv, char **env)
@" <FRAME src=\"[prjName].html\" name=\"mainFrame\">\n" @" <FRAME src=\"[prjName].html\" name=\"mainFrame\">\n"
@" </FRAMESET>\n" @" </FRAMESET>\n"
@"</HTML>\n"]; @"</HTML>\n"];
[frameset replaceOccurrencesOfString: @"[prjName]" withString: project [frameset replaceString: @"[prjName]" withString: project];
options: 0
range: NSMakeRange(0, [frameset length])];
// generate the table of contents gsdoc files // generate the table of contents gsdoc files
for (i = 0; i < [idxTypes count]; i++) for (i = 0; i < [idxTypes count]; i++)
{ {
@ -1824,12 +1820,8 @@ main(int argc, char **argv, char **env)
typeU = [@"Class" isEqualToString: typeU] ? typeU = [@"Class" isEqualToString: typeU] ?
[typeU stringByAppendingString: @"es"] : [typeU stringByAppendingString: @"es"] :
[typeU stringByAppendingString: @"s"]; [typeU stringByAppendingString: @"s"];
[contents replaceOccurrencesOfString: @"[typeL]" withString: typeL [contents replaceString: @"[typeL]" withString: typeL];
options: 0 [contents replaceString: @"[typeU]" withString: typeU];
range: NSMakeRange(0,[contents length])];
[contents replaceOccurrencesOfString: @"[typeU]" withString: typeU
options: 0
range: NSMakeRange(0,[contents length])];
gsdocFile = [[typeU stringByAppendingString: @"TOC"] gsdocFile = [[typeU stringByAppendingString: @"TOC"]
stringByAppendingPathExtension: @"gsdoc"]; stringByAppendingPathExtension: @"gsdoc"];
htmlFile = [[typeU stringByAppendingString: @"TOC"] htmlFile = [[typeU stringByAppendingString: @"TOC"]
@ -1894,10 +1886,7 @@ main(int argc, char **argv, char **env)
@" </chapter>\n" @" </chapter>\n"
@" </body>\n" @" </body>\n"
@"</gsdoc>\n"]; @"</gsdoc>\n"];
[prjFileContents replaceOccurrencesOfString: @"[prjName]" [prjFileContents replaceString: @"[prjName]" withString: project];
withString: project
options: 0
range: NSMakeRange(0, [prjFileContents length])];
[prjFileContents writeToFile: [prjFileContents writeToFile:
[documentationDirectory stringByAppendingPathComponent: prjFile] [documentationDirectory stringByAppendingPathComponent: prjFile]
atomically: YES]; atomically: YES];