ObjFW  Diff

Differences From Artifact [2fc9519558]:

To Artifact [13f7d8fe72]:


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
		[self release];
		@throw e;
	}

	return self;
}

- (void)addItem: (const void*)item
{
	if (SIZE_MAX - _count < 1 || _count + 1 > SIZE_MAX / _itemSize)
		@throw [OFOutOfRangeException exception];

	if (_count + 1 > _capacity) {
		size_t size, pageSize;








|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
		[self release];
		@throw e;
	}

	return self;
}

- (void)addItem: (const void *)item
{
	if (SIZE_MAX - _count < 1 || _count + 1 > SIZE_MAX / _itemSize)
		@throw [OFOutOfRangeException exception];

	if (_count + 1 > _capacity) {
		size_t size, pageSize;

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	}

	memcpy(_items + _count * _itemSize, item, _itemSize);

	_count++;
}

- (void)addItems: (const void*)items
	   count: (size_t)count
{
	if (count > SIZE_MAX - _count || _count + count > SIZE_MAX / _itemSize)
		@throw [OFOutOfRangeException exception];

	if (_count + count > _capacity) {
		size_t size, pageSize;







|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	}

	memcpy(_items + _count * _itemSize, item, _itemSize);

	_count++;
}

- (void)addItems: (const void *)items
	   count: (size_t)count
{
	if (count > SIZE_MAX - _count || _count + count > SIZE_MAX / _itemSize)
		@throw [OFOutOfRangeException exception];

	if (_count + count > _capacity) {
		size_t size, pageSize;
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	}

	memcpy(_items + _count * _itemSize, items, count * _itemSize);

	_count += count;
}

- (void)insertItems: (const void*)items
	    atIndex: (size_t)index
	      count: (size_t)count
{
	if (count > SIZE_MAX - _count || index > _count ||
	    _count + count > SIZE_MAX / _itemSize)
		@throw [OFOutOfRangeException exception];








|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	}

	memcpy(_items + _count * _itemSize, items, count * _itemSize);

	_count += count;
}

- (void)insertItems: (const void *)items
	    atIndex: (size_t)index
	      count: (size_t)count
{
	if (count > SIZE_MAX - _count || index > _count ||
	    _count + count > SIZE_MAX / _itemSize)
		@throw [OFOutOfRangeException exception];