ObjFW  Diff

Differences From Artifact [ee8d4c3fc0]:

To Artifact [d68d151905]:


920
921
922
923
924
925
926


927
928
929
930
931
932
933
934
935
936
937
938
939
940

941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961





962

963
964
965

966
967
968
969
970
971
972
		OFString *component;
		size_t i, cStringLength;
		va_list argumentsCopy;

		s = [self allocMemoryWithSize: sizeof(*s)];
		memset(s, 0, sizeof(*s));



		s->cStringLength = [firstComponent cStringLength];

		switch (of_string_check_utf8([firstComponent cString],
		    s->cStringLength)) {
		case 1:
			s->isUTF8 = YES;
			break;
		case -1:
			@throw [OFInvalidEncodingException newWithClass: isa];
		}

		/* Calculate length */
		va_copy(argumentsCopy, arguments);
		while ((component = va_arg(argumentsCopy, OFString*)) != nil) {

			cStringLength = [component cStringLength];
			s->cStringLength += 1 + cStringLength;

			switch (of_string_check_utf8([component cString],
			    cStringLength)) {
			case 1:
				s->isUTF8 = YES;
				break;
			case -1:
				@throw [OFInvalidEncodingException
				    newWithClass: isa];
			}
		}

		s->cString = [self allocMemoryWithSize: s->cStringLength + 1];

		cStringLength = [firstComponent cStringLength];
		memcpy(s->cString, [firstComponent cString], cStringLength);
		i = cStringLength;

		while ((component = va_arg(arguments, OFString*)) != nil) {





			cStringLength = [component cStringLength];

			s->cString[i] = OF_PATH_DELIMITER;
			memcpy(s->cString + i + 1, [component cString],
			    cStringLength);

			i += 1 + cStringLength;
		}

		s->cString[i] = '\0';
	} @catch (id e) {
		[self release];
		@throw e;







>
>
|
|
<
|
<
|
<
<
<
|
<
|


>



|
<
<

<
<
<
<
<









>
>
>
>
>
|
>

|

>







920
921
922
923
924
925
926
927
928
929
930

931

932



933

934
935
936
937
938
939
940
941


942





943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
		OFString *component;
		size_t i, cStringLength;
		va_list argumentsCopy;

		s = [self allocMemoryWithSize: sizeof(*s)];
		memset(s, 0, sizeof(*s));

		/*
		 * First needs to be a call to be sure it is initialized, in
		 * case it's a constant string.
		 */

		s->cStringLength = [firstComponent cStringLength];

		s->isUTF8 = firstComponent->s->isUTF8;





		/* Calculate length and see if we need UTF-8 */
		va_copy(argumentsCopy, arguments);
		while ((component = va_arg(argumentsCopy, OFString*)) != nil) {
			/* First needs to be a call, see above */
			cStringLength = [component cStringLength];
			s->cStringLength += 1 + cStringLength;

			if (component->s->isUTF8)


				s->isUTF8 = YES;





		}

		s->cString = [self allocMemoryWithSize: s->cStringLength + 1];

		cStringLength = [firstComponent cStringLength];
		memcpy(s->cString, [firstComponent cString], cStringLength);
		i = cStringLength;

		while ((component = va_arg(arguments, OFString*)) != nil) {
			/*
			 * We already sent each component a message, so we can
			 * be sure they are initialized and access them
			 * directly.
			 */
			cStringLength = component->s->cStringLength;

			s->cString[i] = OF_PATH_DELIMITER;
			memcpy(s->cString + i + 1, component->s->cString,
			    cStringLength);

			i += 1 + cStringLength;
		}

		s->cString[i] = '\0';
	} @catch (id e) {
		[self release];
		@throw e;