Fix -[NSCharacterSet invertedSet] to work by calling -invert on a mutable copy

This commit is contained in:
Richard Frith-Macdonald 2020-05-05 09:51:34 +01:00
parent d4dc2dafc9
commit dcfe2a2ce3
2 changed files with 36 additions and 13 deletions

View file

@ -1050,25 +1050,21 @@ static Class concreteMutableClass = nil;
- (NSCharacterSet*) invertedSet
{
unsigned i;
unsigned length;
unsigned char *bytes;
NSMutableData *bitmap;
NSMutableCharacterSet *m = [self mutableCopy];
NSCharacterSet *c;
bitmap = AUTORELEASE([[self bitmapRepresentation] mutableCopy]);
length = [bitmap length];
bytes = [bitmap mutableBytes];
for (i = 0; i < length; i++)
{
bytes[i] = ~bytes[i];
}
return [[self class] characterSetWithBitmapRepresentation: bitmap];
[m invert];
c = [m copy];
RELEASE(m);
return AUTORELEASE(c);
}
- (BOOL) isEqual: (id)anObject
{
if (anObject == self)
return YES;
{
return YES;
}
if ([anObject isKindOfClass: abstractClass])
{
unsigned i;