mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Fix bug in abstract implementation by calling method of concrete class.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23264 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ef89bc2679
commit
b109605b16
2 changed files with 15 additions and 40 deletions
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
* Source/GSString.m: getCString_c() call getCString_u() to do the
|
* Source/GSString.m: getCString_c() call getCString_u() to do the
|
||||||
work if external encoding != internal encoding.
|
work if external encoding != internal encoding.
|
||||||
|
* Source/NSScanner.m: Fix for utf8
|
||||||
|
* Source/GSFormat.m: remove call to deprecated method.
|
||||||
|
* Source/NSString.m: remove calls to deprecated methods.
|
||||||
|
Fix getCstring... by using concrete class implementation.
|
||||||
|
|
||||||
2006-08-11 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-08-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -2603,47 +2603,18 @@ handle_printf_atsign (FILE *stream,
|
||||||
range: (NSRange)aRange
|
range: (NSRange)aRange
|
||||||
remainingRange: (NSRange*)leftoverRange
|
remainingRange: (NSRange*)leftoverRange
|
||||||
{
|
{
|
||||||
unsigned len;
|
NSString *s;
|
||||||
unsigned count;
|
|
||||||
unichar (*caiImp)(NSString*, SEL, unsigned int);
|
|
||||||
|
|
||||||
len = [self cStringLength];
|
/* As this is a deprecated method, keep things simple (but inefficient)
|
||||||
GS_RANGE_CHECK(aRange, len);
|
* by copying the receiver to a new instance of a base library built-in
|
||||||
|
* class, and use the implementation provided by that class.
|
||||||
caiImp = (unichar (*)())[self methodForSelector: caiSel];
|
* We need an autorelease to avoid a memory leak if there is an exception.
|
||||||
|
*/
|
||||||
if (maxLength < aRange.length)
|
s = AUTORELEASE([(NSString*)defaultPlaceholderString initWithString: self]);
|
||||||
{
|
[s getCString: buffer
|
||||||
len = maxLength;
|
maxLength: maxLength
|
||||||
if (leftoverRange)
|
range: aRange
|
||||||
{
|
remainingRange: leftoverRange];
|
||||||
leftoverRange->location = 0;
|
|
||||||
leftoverRange->length = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = aRange.length;
|
|
||||||
if (leftoverRange)
|
|
||||||
{
|
|
||||||
leftoverRange->location = aRange.location + maxLength;
|
|
||||||
leftoverRange->length = aRange.length - maxLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
count = 0;
|
|
||||||
while (count < len)
|
|
||||||
{
|
|
||||||
buffer[count] = encode_unitochar(
|
|
||||||
(*caiImp)(self, caiSel, aRange.location + count),
|
|
||||||
_DefaultStringEncoding);
|
|
||||||
if (buffer[count] == 0)
|
|
||||||
{
|
|
||||||
[NSException raise: NSCharacterConversionException
|
|
||||||
format: @"unable to convert to cString"];
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
buffer[len] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue