ObjFW  Diff

Differences From Artifact [4738b91ed8]:

To Artifact [6b96716473]:


409
410
411
412
413
414
415
416
417

418
419
420
421
422
423




424
425
426

427
428
429
430
431
432
433
434







435
436






















437
438
439
440
441
442
443
409
410
411
412
413
414
415


416






417
418
419
420
421


422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437


438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466







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

-
-
+








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







	}

	return self;
}

- (instancetype)initWithBase64EncodedString: (OFString *)string
{
	bool mutable = [self isKindOfClass: [OFMutableData class]];

	void *pool = objc_autoreleasePoolPush();
	if (!mutable) {
		[self release];
		self = [OFMutableData alloc];
	}

	self = [(OFMutableData *)self initWithCapacity: string.length / 3];
	OFMutableData *data;

	@try {
		data = [OFMutableData data];

	@try {
		if (!OFBase64Decode((OFMutableData *)self,
		if (!OFBase64Decode(data,
		    [string cStringWithEncoding: OFStringEncodingASCII],
		    [string cStringLengthWithEncoding: OFStringEncodingASCII]))
			@throw [OFInvalidFormatException exception];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	/* Avoid copying if the class already matches. */
	if (data.class == self.class) {
		[self release];
		self = [data retain];
		objc_autoreleasePoolPop(pool);
		return self;
	}
	if (!mutable)
		[(OFMutableData *)self makeImmutable];

	/*
	 * Make it immutable and avoid copying if the class already matches
	 * after that.
	 */
	@try {
		[data makeImmutable];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	if (data.class == self.class) {
		[self release];
		self = [data retain];
		objc_autoreleasePoolPop(pool);
		return self;
	}

	self = [self initWithItems: data.items count: data.count];

	objc_autoreleasePoolPop(pool);

	return self;
}

- (size_t)count
{
	OF_UNRECOGNIZED_SELECTOR