ObjFW  Diff

Differences From Artifact [2832b02ca4]:

To Artifact [3e5753e6f2]:


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
{
	self = [super init];

	@try {
		_s = &_storage;

		_s->cStringLength = string.UTF8StringLength;

		if ([string isKindOfClass: [OFUTF8String class]] ||
		    [string isKindOfClass: [OFMutableUTF8String class]])
			_s->isUTF8 = ((OFUTF8String *)string)->_s->isUTF8;
		else
			_s->isUTF8 = true;

		_s->length = string.length;

		_s->cString = OFAllocMemory(_s->cStringLength + 1, 1);
		memcpy(_s->cString, string.UTF8String, _s->cStringLength + 1);
		_s->freeWhenDone = true;














	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







<
<
<
<
<
<
<





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







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
{
	self = [super init];

	@try {
		_s = &_storage;

		_s->cStringLength = string.UTF8StringLength;







		_s->length = string.length;

		_s->cString = OFAllocMemory(_s->cStringLength + 1, 1);
		memcpy(_s->cString, string.UTF8String, _s->cStringLength + 1);
		_s->freeWhenDone = true;

		if ([string isKindOfClass: [OFUTF8String class]] ||
		    [string isKindOfClass: [OFMutableUTF8String class]])
			_s->isUTF8 = ((OFUTF8String *)string)->_s->isUTF8;
		else {
			switch (_OFUTF8StringCheck(_s->cString,
			    _s->cStringLength, NULL)) {
			case 1:
				_s->isUTF8 = true;
				break;
			case -1:
				@throw [OFInvalidEncodingException exception];
			}
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}