Document -getCString*. Use file system representation methods instead of cstring methods in -stringByResolvingSymlinksInPath.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19112 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2004-04-15 12:43:28 +00:00
parent 505a890ec2
commit ad14f40c97
2 changed files with 27 additions and 7 deletions

View file

@ -1,3 +1,12 @@
2004-04-15 14:39 Alexander Malmberg <alexander@malmberg.org>
* Source/NSString.m (-stringByResolvingSymlinksInPath): Use
-fileSystemRepresentation and -stringWithFileSystemRepresentation:
instead of cstring methods.
(-getCString:maxLength:range:remainingRange:): Document.
(-getCString:, -getCString:maxLength:): Documentation fixes.
2004-04-14 18:20 Alexander Malmberg <alexander@malmberg.org>
* Source/Additions/Unicode.m (GSToUnicode): In an utf8 sequence,

View file

@ -2686,7 +2686,7 @@ handle_printf_atsign (FILE *stream,
/**
* Retrieve the contents of the receiver into the buffer.<br />
* The buffer must be large enought to contain the CString representation
* of the characters in the receiver, plus a null terminator which this
* of the characters in the receiver, plus a nul terminator which this
* method adds.
*/
- (void) getCString: (char*)buffer
@ -2697,9 +2697,9 @@ handle_printf_atsign (FILE *stream,
}
/**
* Retrieve up to maxLength characters from the receiver into the buffer.<br />
* The buffer must be at least maxLength characters long, so that it has
* room for the null terminator that this method adds.
* Retrieve up to maxLength bytes from the receiver into the buffer.<br />
* The buffer must be at least maxLength + 1 bytes long, so that it has
* room for the nul terminator that this method adds.
*/
- (void) getCString: (char*)buffer
maxLength: (unsigned int)maxLength
@ -2709,6 +2709,16 @@ handle_printf_atsign (FILE *stream,
remainingRange: NULL];
}
/**
* Converts characters from the given range of the string to the c string
* encoding and stores the resulting bytes in the given buffer. As many
* characters are converted as will fit in the buffer. A trailing nul
* byte is always added, so the buffer needs to be big enough to hold
* maxLength+1 bytes.
* <br />
* If leftoverRange is non-NULL, the range of trailing characters that didn't
* will be stored in it.
*/
- (void) getCString: (char*)buffer
maxLength: (unsigned int)maxLength
range: (NSRange)aRange
@ -3624,12 +3634,12 @@ handle_printf_atsign (FILE *stream,
char new_buf[MAX_PATH];
#ifdef HAVE_REALPATH
if (realpath([self cString], new_buf) == 0)
if (realpath([self fileSystemRepresentation], new_buf) == 0)
return self;
#else
char extra[MAX_PATH];
char *dest;
const char *name = [self cString];
const char *name = [self fileSystemRepresentation];
const char *start;
const char *end;
unsigned num_links = 0;
@ -3763,7 +3773,8 @@ handle_printf_atsign (FILE *stream,
if (lstat(&new_buf[8], &st) == 0)
strcpy(new_buf, &new_buf[8]);
}
return [NSStringClass stringWithCString: new_buf];
return [[NSFileManager defaultManager]
stringWithFileSystemRepresentation: new_buf];
#endif /* (__MINGW__) */
}