ObjFW  Diff

Differences From Artifact [920953956a]:

To Artifact [4f2f2b15be]:


383
384
385
386
387
388
389






































390
391
392
393
394
395
396
}

- (void)removeCharactersInRange: (of_range_t)range
{
	[self removeCharactersFromIndex: range.start
				toIndex: range.start + range.length];
}







































- (void)replaceOccurrencesOfString: (OFString*)str
			withString: (OFString*)repl
{
	const char *str_c = [str cString];
	const char *repl_c = [repl cString];
	size_t str_len = [str cStringLength];







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







383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
}

- (void)removeCharactersInRange: (of_range_t)range
{
	[self removeCharactersFromIndex: range.start
				toIndex: range.start + range.length];
}

- (void)replaceCharactersFromIndex: (size_t)start
			   toIndex: (size_t)end
			withString: (OFString*)repl
{
	size_t nlen;

	if (isUTF8) {
		start = of_string_index_to_position(string, start, length);
		end = of_string_index_to_position(string, end, length);
	}

	if (start > end)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (end > length)
		@throw [OFOutOfRangeException newWithClass: isa];

	nlen = length - (end - start) + [repl cStringLength];
	string = [self resizeMemory: string
			     toSize: nlen + 1];

	memmove(string + end, string + start + [repl cStringLength],
	    length - end);
	memcpy(string + start, [repl cString], [repl cStringLength]);
	string[nlen] = '\0';

	length = nlen;
}

- (void)replaceCharactersInRange: (of_range_t)range
		      withString: (OFString*)repl
{
	[self replaceCharactersFromIndex: range.start
				 toIndex: range.start + range.length
			      withString: repl];
}

- (void)replaceOccurrencesOfString: (OFString*)str
			withString: (OFString*)repl
{
	const char *str_c = [str cString];
	const char *repl_c = [repl cString];
	size_t str_len = [str cStringLength];