mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix error copnverting utf8 constant string to latin1 data
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39298 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e1396c2e48
commit
912fbca179
1 changed files with 3 additions and 2 deletions
|
@ -5899,13 +5899,14 @@ literalIsEqual(NXConstantString *self, id anObject)
|
|||
unsigned i = 0;
|
||||
unichar n = 0;
|
||||
uint8_t *b;
|
||||
uint8_t *p;
|
||||
|
||||
/* If all the characters are latin1 we can copy them efficiently.
|
||||
*/
|
||||
b = NSAllocateCollectable(length, 0);
|
||||
p = b = NSAllocateCollectable(length, 0);
|
||||
while (i < length)
|
||||
{
|
||||
b[i] = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
|
||||
*p++ = (uint8_t)nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
|
||||
}
|
||||
return [NSDataClass dataWithBytesNoCopy: (void*)b
|
||||
length: length
|
||||
|
|
Loading…
Reference in a new issue