ObjFW  Diff

Differences From Artifact [8d074bf70b]:

To Artifact [6c57bbac26]:


238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
}

- (id)copy
{
	return [OFString stringWithCString: string];
}

- setTo: (OFString*)str
{
	size_t len;

	if (string != NULL)
		free(string);

	len = [str length];

	switch (check_utf8([str cString], len)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:
		string = NULL;
		length = 0;
		is_utf8 = NO;

		@throw [OFInvalidEncodingException newWithClass: [self class]];
	}

	length = len;
	string = [self getMemWithSize: length + 1];
	memcpy(string, [str cString], length + 1);

	return self;
}

- (BOOL)isEqual: (id)obj
{
	if (![obj isKindOf: [OFString class]])







|






|

|













|







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
}

- (id)copy
{
	return [OFString stringWithCString: string];
}

- setTo: (const char*)str
{
	size_t len;

	if (string != NULL)
		free(string);

	len = strlen(str);

	switch (check_utf8(str, len)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:
		string = NULL;
		length = 0;
		is_utf8 = NO;

		@throw [OFInvalidEncodingException newWithClass: [self class]];
	}

	length = len;
	string = [self getMemWithSize: length + 1];
	memcpy(string, str, length + 1);

	return self;
}

- (BOOL)isEqual: (id)obj
{
	if (![obj isKindOf: [OFString class]])