ObjFW  Diff

Differences From Artifact [bbba29f5a7]:

To Artifact [dbdac00eff]:


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
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 "OFMutableAdjacentData.h"
#import "OFAdjacentData.h"

#import "OFInvalidArgumentException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

@implementation OFMutableConcreteData
@implementation OFMutableAdjacentData
+ (void)initialize
{
	if (self == [OFMutableConcreteData class])
		[self inheritMethodsFromClass: [OFConcreteData class]];
	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
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]);
	object_setClass(self, [OFAdjacentData class]);
}
@end