ObjFW  Diff

Differences From Artifact [f0e2960871]:

To Artifact [7f39ded0e7]:


338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
		@throw e;
	}

	switch (encoding) {
	case OF_STRING_ENCODING_UTF_8:
		switch (of_string_check_utf8(str, length)) {
		case 1:
			is_utf8 = YES;
			break;
		case -1:;
			/*
			 * We can't use [super dealloc] on OS X here.
			 * Compiler bug? Anyway, [self dealloc] will do here as
			 * we don't reimplement dealloc.
			 */







|







338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
		@throw e;
	}

	switch (encoding) {
	case OF_STRING_ENCODING_UTF_8:
		switch (of_string_check_utf8(str, length)) {
		case 1:
			isUTF8 = YES;
			break;
		case -1:;
			/*
			 * We can't use [super dealloc] on OS X here.
			 * Compiler bug? Anyway, [self dealloc] will do here as
			 * we don't reimplement dealloc.
			 */
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
					 */
					Class c = isa;
					[self dealloc];
					@throw [OFInvalidEncodingException
					    newWithClass: c];
				}

				is_utf8 = YES;
				chr_bytes = of_string_unicode_to_utf8(chr, buf);

				if (chr_bytes == 0) {
					/*
					 * We can't use [super dealloc] on OS X
					 * here. Compiler bug? Anyway,
					 * [self dealloc] will do here as we







|







402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
					 */
					Class c = isa;
					[self dealloc];
					@throw [OFInvalidEncodingException
					    newWithClass: c];
				}

				isUTF8 = YES;
				chr_bytes = of_string_unicode_to_utf8(chr, buf);

				if (chr_bytes == 0) {
					/*
					 * We can't use [super dealloc] on OS X
					 * here. Compiler bug? Anyway,
					 * [self dealloc] will do here as we
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
		 */
		@throw [OFOutOfMemoryException newWithClass: c];
	}
	length = t;

	switch (of_string_check_utf8(string, length)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:;
		Class c = isa;
		free(string);
		[super dealloc];
		@throw [OFInvalidEncodingException newWithClass: c];
	}







|







505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
		 */
		@throw [OFOutOfMemoryException newWithClass: c];
	}
	length = t;

	switch (of_string_check_utf8(string, length)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:;
		Class c = isa;
		free(string);
		[super dealloc];
		@throw [OFInvalidEncodingException newWithClass: c];
	}
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
	Class c;

	self = [super init];

	len = [first cStringLength];
	switch (of_string_check_utf8([first cString], len)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:
		c = isa;
		[self dealloc];
		@throw [OFInvalidEncodingException newWithClass: c];
	}
	length += len;

	va_copy(args2, args);
	while ((component = va_arg(args2, OFString*)) != nil) {
		len = [component cStringLength];
		length += 1 + len;

		switch (of_string_check_utf8([component cString], len)) {
		case 1:
			is_utf8 = YES;
			break;
		case -1:
			c = isa;
			[self dealloc];
			@throw [OFInvalidEncodingException newWithClass: c];
		}
	}







|















|







550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
	Class c;

	self = [super init];

	len = [first cStringLength];
	switch (of_string_check_utf8([first cString], len)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		c = isa;
		[self dealloc];
		@throw [OFInvalidEncodingException newWithClass: c];
	}
	length += len;

	va_copy(args2, args);
	while ((component = va_arg(args2, OFString*)) != nil) {
		len = [component cStringLength];
		length += 1 + len;

		switch (of_string_check_utf8([component cString], len)) {
		case 1:
			isUTF8 = YES;
			break;
		case -1:
			c = isa;
			[self dealloc];
			@throw [OFInvalidEncodingException newWithClass: c];
		}
	}
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
	self = [super init];

	string = (char*)[str cString];
	length = [str cStringLength];

	switch (of_string_check_utf8(string, length)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:;
		Class c = isa;
		[self dealloc];
		@throw [OFInvalidEncodingException newWithClass: c];
	}








|







607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
	self = [super init];

	string = (char*)[str cString];
	length = [str cStringLength];

	switch (of_string_check_utf8(string, length)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:;
		Class c = isa;
		[self dealloc];
		@throw [OFInvalidEncodingException newWithClass: c];
	}