Path operation fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8724 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2001-01-21 16:03:22 +00:00
parent 5f770b32ae
commit 5cdfb3c620
2 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2001-01-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: Fixes for OPENSTEP compatibility in string path
operations - patch provided by Pierre-Yves Rivaille, plus another fix
by me.
2001-01-19 Nicola Pero <nicola@brainstorm.co.uk> 2001-01-19 Nicola Pero <nicola@brainstorm.co.uk>
* gnustep-base.spec.in: Updated copyright and attempt at improving * gnustep-base.spec.in: Updated copyright and attempt at improving

View file

@ -2289,7 +2289,7 @@ handle_printf_atsign (FILE *stream,
if (length > 0) if (length > 0)
{ {
aLength = length - 1; aLength = length - 1;
while (aLength > 1) while (aLength > 0)
{ {
if (pathSepMember(buf[aLength]) == YES) if (pathSepMember(buf[aLength]) == YES)
{ {
@ -2721,6 +2721,10 @@ handle_printf_atsign (FILE *stream,
NSMutableArray *a; NSMutableArray *a;
NSArray *r; NSArray *r;
if ([self length] == 0)
{
return [NSArray array];
}
a = [[self componentsSeparatedByString: pathSepString] mutableCopy]; a = [[self componentsSeparatedByString: pathSepString] mutableCopy];
if ([a count] > 0) if ([a count] > 0)
{ {
@ -2734,8 +2738,8 @@ handle_printf_atsign (FILE *stream,
{ {
[a replaceObjectAtIndex: 0 withObject: pathSepString]; [a replaceObjectAtIndex: 0 withObject: pathSepString];
} }
/* Any empty path components (except a trailing one) must be removed. */ /* Any empty path components must be removed. */
for (i = [a count] - 2; i > 0; i--) for (i = [a count] - 1; i > 0; i--)
{ {
if ([[a objectAtIndex: i] length] == 0) if ([[a objectAtIndex: i] length] == 0)
{ {