137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
{
self = [super initWithStringRepresentation: string];
_capacity = _count;
return self;
}
- (void)addItem: (const void *)item
{
if (SIZE_MAX - _count < 1)
@throw [OFOutOfRangeException exception];
if (_count + 1 > _capacity) {
|
>
>
>
>
>
>
>
>
>
>
>
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
{
self = [super initWithStringRepresentation: string];
_capacity = _count;
return self;
}
- (OFData *)subdataWithRange: (of_range_t)range
{
if (range.length > SIZE_MAX - range.location ||
range.location + range.length > _count)
@throw [OFOutOfRangeException exception];
return [OFData dataWithItems: _items + (range.location * _itemSize)
itemSize: _itemSize
count: range.length];
}
- (void)addItem: (const void *)item
{
if (SIZE_MAX - _count < 1)
@throw [OFOutOfRangeException exception];
if (_count + 1 > _capacity) {
|