mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 02:01:03 +00:00
Minor tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13631 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
80cf1e3e72
commit
9fbec32045
2 changed files with 33 additions and 10 deletions
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
* Source/Unicode.m: Rationalise so that all conversion operations
|
* Source/Unicode.m: Rationalise so that all conversion operations
|
||||||
go through the two new functions. Gets rid of a load of old code.
|
go through the two new functions. Gets rid of a load of old code.
|
||||||
|
* Source/GSString.m: ([-replaceCharactersInRange:withString:])
|
||||||
|
minor performance enhancement when copying from a 16-bit string
|
||||||
|
to an 8-bit string.
|
||||||
|
|
||||||
2002-05-10 Adam Fedor <fedor@gnu.org>
|
2002-05-10 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -2938,23 +2938,43 @@ transmute(ivars self, NSString *aString)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* As we got here, intEnc == defEnc, so we can use standard
|
||||||
|
* CString methods to get the characters into our buffer,
|
||||||
|
* or may even be able to copy from another string directly.
|
||||||
|
*/
|
||||||
if (other == 0)
|
if (other == 0)
|
||||||
{
|
{
|
||||||
unsigned l;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since getCString appends a '\0' terminator, we must ask for
|
* Since getCString appends a '\0' terminator, we must handle
|
||||||
* one character less than we actually want, then get the last
|
* that problem in copying data into our buffer. Either by
|
||||||
* character separately.
|
* saving and restoring the character which would be
|
||||||
|
* overwritten by the nul, or by getting a character less,
|
||||||
|
* and fetching the last character separately.
|
||||||
*/
|
*/
|
||||||
l = length - 1;
|
if (aRange.location + length < _count)
|
||||||
if (l > 0)
|
|
||||||
{
|
{
|
||||||
|
unsigned char tmp = _contents.c[aRange.location + length];
|
||||||
|
|
||||||
[aString getCString: &_contents.c[aRange.location]
|
[aString getCString: &_contents.c[aRange.location]
|
||||||
maxLength: l];
|
maxLength: length];
|
||||||
|
_contents.c[aRange.location + length] = tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int l = length - 1;
|
||||||
|
unsigned int size = 1;
|
||||||
|
unichar u;
|
||||||
|
unsigned char *dst = &_contents.c[aRange.location + l];
|
||||||
|
|
||||||
|
if (l > 0)
|
||||||
|
{
|
||||||
|
[aString getCString: &_contents.c[aRange.location]
|
||||||
|
maxLength: l];
|
||||||
|
}
|
||||||
|
u = [aString characterAtIndex: l];
|
||||||
|
GSFromUnicode(&dst, &size, &u, 1, intEnc, 0, 0);
|
||||||
}
|
}
|
||||||
_contents.c[aRange.location + l]
|
|
||||||
= encode_unitochar([aString characterAtIndex: l], intEnc);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue