14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
*/
#include "config.h"
#include <limits.h>
#include <string.h>
#import "OFMutableConcreteData.h"
#import "OFConcreteData.h"
#import "OFInvalidArgumentException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
@implementation OFMutableConcreteData
+ (void)initialize
{
if (self == [OFMutableConcreteData class])
[self inheritMethodsFromClass: [OFConcreteData class]];
}
- (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity
{
self = [super init];
@try {
|
|
|
|
|
|
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
*/
#include "config.h"
#include <limits.h>
#include <string.h>
#import "OFMutableAdjacentData.h"
#import "OFAdjacentData.h"
#import "OFInvalidArgumentException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
@implementation OFMutableAdjacentData
+ (void)initialize
{
if (self == [OFMutableAdjacentData class])
[self inheritMethodsFromClass: [OFAdjacentData class]];
}
- (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity
{
self = [super init];
@try {
|
180
181
182
183
184
185
186
187
188
189
|
_items = OFResizeMemory(_items, _count, _itemSize);
_capacity = _count;
} @catch (OFOutOfMemoryException *e) {
/* We don't care, as we only made it smaller */
}
}
object_setClass(self, [OFConcreteData class]);
}
@end
|
|
|
180
181
182
183
184
185
186
187
188
189
|
_items = OFResizeMemory(_items, _count, _itemSize);
_capacity = _count;
} @catch (OFOutOfMemoryException *e) {
/* We don't care, as we only made it smaller */
}
}
object_setClass(self, [OFAdjacentData class]);
}
@end
|