ObjFW  Diff

Differences From Artifact [b6b253b742]:

To Artifact [183d3ab057]:


380
381
382
383
384
385
386


387
388
389
390
391
392
393
}

- (void)dealloc
{
	if (_freeWhenDone)
		free(_items);



	[super dealloc];
}

- (size_t)count
{
	return _count;
}







>
>







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
}

- (void)dealloc
{
	if (_freeWhenDone)
		free(_items);

	[_parentData release];

	[super dealloc];
}

- (size_t)count
{
	return _count;
}
495
496
497
498
499
500
501

















502
503
504
505
506
507
508
	for (size_t i = 0; i < _count * _itemSize; i++)
		OF_HASH_ADD(hash, ((uint8_t *)_items)[i]);

	OF_HASH_FINALIZE(hash);

	return hash;
}


















- (OFString *)description
{
	OFMutableString *ret = [OFMutableString stringWithString: @"<"];

	for (size_t i = 0; i < _count; i++) {
		if (i > 0)







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







497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
	for (size_t i = 0; i < _count * _itemSize; i++)
		OF_HASH_ADD(hash, ((uint8_t *)_items)[i]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFData *)subdataWithRange: (of_range_t)range
{
	OFData *ret;

	if (range.length > SIZE_MAX - range.location ||
	    range.location + range.length > _count)
		@throw [OFOutOfRangeException exception];

	ret = [OFData dataWithItemsNoCopy: _items + (range.location * _itemSize)
				 itemSize: _itemSize
				    count: range.length
			     freeWhenDone: false];
	ret->_parentData = [(_parentData != nil ? _parentData : self) copy];

	return ret;
}

- (OFString *)description
{
	OFMutableString *ret = [OFMutableString stringWithString: @"<"];

	for (size_t i = 0; i < _count; i++) {
		if (i > 0)