ObjFW  Diff

Differences From Artifact [786611bf27]:

To Artifact [20c52d7bc7]:


612
613
614
615
616
617
618













































619
620
621
622
623
624
625

	[element retain];

	objc_autoreleasePoolPop(pool);

	return [element autorelease];
}













































@end

@implementation OFBigDataArray
- initWithItemSize: (size_t)itemSize
	  capacity: (size_t)capacity
{
	size_t lastPageByte = [OFSystemInfo pageSize] - 1;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670

	[element retain];

	objc_autoreleasePoolPop(pool);

	return [element autorelease];
}

- (OFDataArray*)binaryPackRepresentation
{
	OFDataArray *data;

	if (_itemSize != 1)
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];

	if (_count <= 15) {
		uint8_t tmp = 0xA0 | ((uint8_t)_count & 0xF);

		data = [OFDataArray dataArrayWithItemSize: 1
						 capacity: _count + 1];

		[data addItem: &tmp];
	} else if (_count <= UINT16_MAX) {
		uint8_t type = 0xDA;
		uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)_count);

		data = [OFDataArray dataArrayWithItemSize: 1
						 capacity: _count + 3];

		[data addItem: &type];
		[data addItems: &tmp
			 count: sizeof(tmp)];
	} else if (_count <= UINT32_MAX) {
		uint8_t type = 0xDB;
		uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)_count);

		data = [OFDataArray dataArrayWithItemSize: 1
						 capacity: _count + 5];

		[data addItem: &type];
		[data addItems: &tmp
			 count: sizeof(tmp)];
	} else
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	[data addItems: _items
		 count: _count];

	return data;
}
@end

@implementation OFBigDataArray
- initWithItemSize: (size_t)itemSize
	  capacity: (size_t)capacity
{
	size_t lastPageByte = [OFSystemInfo pageSize] - 1;