ObjFW  Diff

Differences From Artifact [95b4b4e97a]:

To Artifact [238d0749d1]:


373
374
375
376
377
378
379

380

381
382
383
384
385
386
387
373
374
375
376
377
378
379
380

381
382
383
384
385
386
387
388







+
-
+







- (void)removeItemAtIndex: (size_t)index
{
	[self removeItemsInRange: of_range(index, 1)];
}

- (void)removeItemsInRange: (of_range_t)range
{
	if (range.length > SIZE_MAX - range.location ||
	if (range.location + range.length > count)
	    range.location + range.length > count)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	memmove(data + range.location * itemSize,
	    data + (range.location + range.length) * itemSize,
	    (count - range.location - range.length) * itemSize);

	count -= range.length;
636
637
638
639
640
641
642

643

644
645
646
647
648
649
650
637
638
639
640
641
642
643
644

645
646
647
648
649
650
651
652







+
-
+







	size = newSize;
}

- (void)removeItemsInRange: (of_range_t)range
{
	size_t newSize, lastPageByte;

	if (range.length > SIZE_MAX - range.location ||
	if (range.location + range.length > count)
	    range.location + range.length > count)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	memmove(data + range.location * itemSize,
	    data + (range.location + range.length) * itemSize,
	    (count - range.location - range.length) * itemSize);

	count -= range.length;