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:
Richard Frith-MacDonald 2016-01-21 12:27:25 +00:00
parent e1396c2e48
commit 912fbca179

View file

@ -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