* 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

@ -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>
* 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
{
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];
}
}
/**

View file

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

View file

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