mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
minor performance tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38530 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
696c4dd7a3
commit
ca40ca54c2
1 changed files with 21 additions and 8 deletions
|
@ -2464,16 +2464,29 @@ fillHole(GSStr self, unsigned index, unsigned size)
|
|||
static inline void
|
||||
getCharacters_c(GSStr self, unichar *buffer, NSRange aRange)
|
||||
{
|
||||
unsigned len = aRange.length;
|
||||
if (aRange.length)
|
||||
{
|
||||
if (NSISOLatin1StringEncoding == internalEncoding)
|
||||
{
|
||||
register NSUInteger count = aRange.length;
|
||||
register NSUInteger base = aRange.location;
|
||||
|
||||
if (!len)
|
||||
return;
|
||||
while (count-- > 0)
|
||||
{
|
||||
buffer[count] = self->_contents.c[base + count];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned len = aRange.length;
|
||||
|
||||
if (!GSToUnicode(&buffer, &len, self->_contents.c + aRange.location,
|
||||
aRange.length, internalEncoding, 0, 0))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Can't convert to Unicode."];
|
||||
if (!GSToUnicode(&buffer, &len, self->_contents.c + aRange.location,
|
||||
aRange.length, internalEncoding, 0, 0))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Can't convert to Unicode."];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue