ObjFW  Diff

Differences From Artifact [a950dfa678]:

To Artifact [dd89e81e6e]:


229
230
231
232
233
234
235
236

237
238
239
240
241
242
243
244
245

246

247
248
249
250
251
252
253
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254







-
+









+
-
+








- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException exceptionWithClass: isa
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
}
@end

@implementation OFMutableString
+ (void)initialize
{
	if (self == [OFMutableString class])
		object_setClass((id)&placeholder,
		placeholder.isa = [OFMutableString_placeholder class];
		    [OFMutableString_placeholder class]);
}

+ alloc
{
	if (self == [OFMutableString class])
		return (id)&placeholder;

296
297
298
299
300
301
302
303

304
305
306
307
308
309
310
297
298
299
300
301
302
303

304
305
306
307
308
309
310
311







-
+








	[pool release];
}

- (void)setCharacter: (of_unichar_t)character
	     atIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: isa
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (void)appendUTF8String: (const char*)UTF8String
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];

367
368
369
370
371
372
373
374
375



376
377
378
379


380
381
382
383
384
385
386
368
369
370
371
372
373
374


375
376
377
378
379
380

381
382
383
384
385
386
387
388
389







-
-
+
+
+



-
+
+







- (void)appendFormat: (OFConstantString*)format
       withArguments: (va_list)arguments
{
	char *UTF8String;
	int UTF8StringLength;

	if (format == nil)
		@throw [OFInvalidArgumentException exceptionWithClass: isa
							     selector: _cmd];
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];

	if ((UTF8StringLength = of_vasprintf(&UTF8String, [format UTF8String],
	    arguments)) == -1)
		@throw [OFInvalidFormatException exceptionWithClass: isa];
		@throw [OFInvalidFormatException
		    exceptionWithClass: [self class]];

	@try {
		[self appendUTF8String: UTF8String
			    withLength: UTF8StringLength];
	} @finally {
		free(UTF8String);
	}
428
429
430
431
432
433
434
435

436
437
438
439
440
441

442
443
444
445
446
447
448
431
432
433
434
435
436
437

438
439
440
441
442
443

444
445
446
447
448
449
450
451







-
+





-
+







		      wordStartTableSize: OF_UNICODE_TITLECASE_TABLE_SIZE
		     wordMiddleTableSize: OF_UNICODE_LOWERCASE_TABLE_SIZE];
}

- (void)insertString: (OFString*)string
	     atIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: isa
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (void)deleteCharactersInRange: (of_range_t)range
{
	@throw [OFNotImplementedException exceptionWithClass: isa
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (void)replaceCharactersInRange: (of_range_t)range
		      withString: (OFString*)replacement
{
	[self deleteCharactersInRange: range];
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
469
470
471
472
473
474
475

476
477
478
479
480
481
482
483







-
+







	const of_unichar_t *unicodeString;
	const of_unichar_t *searchString = [string unicodeString];
	size_t searchLength = [string length];
	size_t replacementLength = [replacement length];
	size_t i;

	if (range.start + range.length > [self length])
		@throw [OFOutOfRangeException exceptionWithClass: isa];
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	if (searchLength > range.length) {
		[pool release];
		return;
	}

	pool2 = [[OFAutoreleasePool alloc] init];