ObjFW  Diff

Differences From Artifact [15022d3186]:

To Artifact [ffbda05782]:


271
272
273
274
275
276
277
278

279
280
281
282
283
284
285
286
287
288
289
271
272
273
274
275
276
277

278
279
280
281

282
283
284
285
286
287
288







-
+



-







- (id)objectAtIndexedSubscript: (size_t)index
{
	return [self objectAtIndex: index];
}

- (id)valueForKey: (OFString *)key
{
	OFMutableArray *ret;
	id ret;

	if ([key hasPrefix: @"@"]) {
		void *pool = objc_autoreleasePoolPush();
		id ret;

		key = [key substringWithRange: of_range(1, [key length] - 1)];
		ret = [[super valueForKey: key] retain];

		objc_autoreleasePoolPop(pool);

		return [ret autorelease];
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
314
315
316
317
318
319
320



321
322
323
324
325
326
327







-
-
-







		[super setValue: value
			 forKey: key];

		objc_autoreleasePoolPop(pool);
		return;
	}

	if (value == [OFNull null])
		value = nil;

	for (id object in self)
		[object setValue: value
			  forKey: key];
}

- (size_t)indexOfObject: (id)object
{
448
449
450
451
452
453
454

455
456









457
458
459
460
461
462
463
464
465



466
467
468
469
470
471
472
473
474
475
476
477
478





479
480
481
482
483
484
485

486
487
488
489
490
491
492
444
445
446
447
448
449
450
451


452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496

497
498
499
500
501
502
503
504







+
-
-
+
+
+
+
+
+
+
+
+









+
+
+













+
+
+
+
+






-
+







	OFMutableString *ret;

	if (separator == nil)
		@throw [OFInvalidArgumentException exception];

	if ([self count] == 0)
		return @"";

	if ([self count] == 1)
		return [[self firstObject] performSelector: selector];
	if ([self count] == 1) {
		OFString *component =
		    [[self firstObject] performSelector: selector];

		if (component == nil)
			@throw [OFInvalidArgumentException exception];

		return component;
	}

	ret = [OFMutableString string];

	if (options & OF_ARRAY_SKIP_EMPTY) {
		for (id object in self) {
			void *pool = objc_autoreleasePoolPush();
			OFString *component =
			    [object performSelector: selector];

			if (component == nil)
				@throw [OFInvalidArgumentException exception];

			if ([component length] > 0) {
				if ([ret length] > 0)
					[ret appendString: separator];
				[ret appendString: component];
			}

			objc_autoreleasePoolPop(pool);
		}
	} else {
		bool first = true;

		for (id object in self) {
			void *pool = objc_autoreleasePoolPush();
			OFString *component =
			    [object performSelector: selector];

			if (component == nil)
				@throw [OFInvalidArgumentException exception];

			if OF_UNLIKELY (first)
				first = false;
			else
				[ret appendString: separator];

			[ret appendString: [object performSelector: selector]];
			[ret appendString: component];

			objc_autoreleasePoolPop(pool);
		}
	}

	[ret makeImmutable];

672
673
674
675
676
677
678
679

680
681
682
683
684
685
686
684
685
686
687
688
689
690

691
692
693
694
695
696
697
698







-
+







		uint8_t type = 0xDC;
		uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)count);

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

		[data addItem: &type];
		[data addItems: &tmp
			 count: sizeof(tmp)];
	} else
		@throw [OFOutOfRangeException exception];
715
716
717
718
719
720
721
722
723
724



725
726
727
728
729
730
731
727
728
729
730
731
732
733



734
735
736
737
738
739
740
741
742
743







-
-
-
+
+
+







	for (id object in self)
		[object performSelector: selector];
}

- (void)makeObjectsPerformSelector: (SEL)selector
			withObject: (id)object
{
	for (id object in self)
		[object performSelector: selector
			     withObject: object];
	for (id objectIter in self)
		[objectIter performSelector: selector
				 withObject: object];
}

- (OFArray *)sortedArray
{
	OFMutableArray *new = [[self mutableCopy] autorelease];

	[new sort];