28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
- (instancetype)initWithCharactersInString: (OFString *)string
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
const of_unichar_t *characters = string.characters;
size_t length = string.length;
for (size_t i = 0; i < length; i++) {
of_unichar_t c = characters[i];
if (c / CHAR_BIT >= _size) {
size_t newSize;
if (UINT32_MAX - c < 1)
@throw [OFOutOfRangeException
exception];
|
|
|
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
- (instancetype)initWithCharactersInString: (OFString *)string
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
const OFUnichar *characters = string.characters;
size_t length = string.length;
for (size_t i = 0; i < length; i++) {
OFUnichar c = characters[i];
if (c / CHAR_BIT >= _size) {
size_t newSize;
if (UINT32_MAX - c < 1)
@throw [OFOutOfRangeException
exception];
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
- (void)dealloc
{
free(_bitset);
[super dealloc];
}
- (bool)characterIsMember: (of_unichar_t)character
{
if (character / CHAR_BIT >= _size)
return false;
return of_bitset_isset(_bitset, character);
}
@end
|
|
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
- (void)dealloc
{
free(_bitset);
[super dealloc];
}
- (bool)characterIsMember: (OFUnichar)character
{
if (character / CHAR_BIT >= _size)
return false;
return of_bitset_isset(_bitset, character);
}
@end
|