Changes from Jeremy Bettis. See ChangeLog Jan 21 17:09:09

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1997-05-03 17:05:57 +00:00
parent a5b4b7b405
commit 1b0b2e5f30
4 changed files with 45 additions and 3 deletions

View file

@ -222,6 +222,19 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
_contents_chars[_count] = '\0';
}
- (void) appendString: (NSString*)aString
{
unsigned c = [aString cStringLength];
if (_count + c >= _capacity)
{
_capacity = MAX(_capacity*2, _count+c);
OBJC_REALLOC(_contents_chars, char, _capacity);
}
memcpy(_contents_chars + _count, [aString cStringNoCopy], c);
_count += c;
_contents_chars[_count] = '\0';
}
/* xxx This method may be removed in future. */
- (void) setCString: (const char *)byteString length: (unsigned)length
{

View file

@ -156,7 +156,7 @@ handle_printf_atsign (FILE *stream,
#endif
len = fprintf(stream, "%*s",
(info->left ? - info->width : info->width),
[string_object cStringNoCopy]);
[[string_object description] cStringNoCopy]);
return len;
}
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
@ -186,7 +186,9 @@ handle_printf_atsign (FILE *stream,
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject ([self _concreteClass], 0, z);
if ([self class] == [NSString class])
return NSAllocateObject ([self _concreteClass], 0, z);
return [super allocWithZone:z];
}
// Creating Temporary Strings
@ -197,6 +199,11 @@ handle_printf_atsign (FILE *stream,
return self;
}
+ (NSString*) string
{
return [[[self alloc] init] autorelease];
}
+ (NSString*) stringWithCString: (const char*) byteString
{
return [[[self alloc] initWithCString:byteString]
@ -1419,7 +1426,9 @@ handle_printf_atsign (FILE *stream,
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject([self _mutableConcreteClass], 0, z);
if ([self class] == [NSMutableString class])
return NSAllocateObject([self _mutableConcreteClass], 0, z);
return [super allocWithZone:z];
}
/* xxx This method may be removed in future. */