ObjFW  Diff

Differences From Artifact [4ddd782651]:

To Artifact [6944810146]:


133
134
135
136
137
138
139





140
141
142
143
144
145
146
- (void)setToCString: (const char*)str
{
	size_t len;

	[self freeMemory: string];

	len = strlen(str);






	switch (of_string_check_utf8(str, len)) {
	case 0:
		isUTF8 = NO;
		break;
	case 1:
		isUTF8 = YES;







>
>
>
>
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
- (void)setToCString: (const char*)str
{
	size_t len;

	[self freeMemory: string];

	len = strlen(str);

	if (len >= 3 && !memcmp(str, "\xEF\xBB\xBF", 3)) {
		str += 3;
		len -= 3;
	}

	switch (of_string_check_utf8(str, len)) {
	case 0:
		isUTF8 = NO;
		break;
	case 1:
		isUTF8 = YES;
159
160
161
162
163
164
165





166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183





184
185
186
187
188
189
190
}

- (void)appendCString: (const char*)str
{
	size_t strlength;

	strlength = strlen(str);






	switch (of_string_check_utf8(str, strlength)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}

	string = [self resizeMemory: string
			     toSize: length + strlength + 1];
	memcpy(string + length, str, strlength + 1);
	length += strlength;
}

- (void)appendCString: (const char*)str
	   withLength: (size_t)len
{





	switch (of_string_check_utf8(str, len)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}







>
>
>
>
>


















>
>
>
>
>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
}

- (void)appendCString: (const char*)str
{
	size_t strlength;

	strlength = strlen(str);

	if (strlength >= 3 && !memcmp(str, "\xEF\xBB\xBF", 3)) {
		str += 3;
		strlength -= 3;
	}

	switch (of_string_check_utf8(str, strlength)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}

	string = [self resizeMemory: string
			     toSize: length + strlength + 1];
	memcpy(string + length, str, strlength + 1);
	length += strlength;
}

- (void)appendCString: (const char*)str
	   withLength: (size_t)len
{
	if (len >= 3 && !memcmp(str, "\xEF\xBB\xBF", 3)) {
		str += 3;
		len -= 3;
	}

	switch (of_string_check_utf8(str, len)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}