ObjFW  Diff

Differences From Artifact [b484829d75]:

To Artifact [5f0048c446]:


80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100
101

102
103
104


105
106
107

108
109

110
111
112
113
114
115
116
117
118
119
120
121
122
123

124
125
126
127



128
129
130
131
132
133
134
135
136
137
138
139

140
141
142

143

144
145
146
147
148
149
150
151
80
81
82
83
84
85
86

87














88
89


90
91
92
93

94


95














96
97
98


99
100
101
102
103
104
105
106
107
108
109
110
111

112
113
114
115
116
117

118

119
120
121
122
123
124
125







-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

-
-
+
+


-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+


-
-
+
+
+










-

+



+
-
+
-







}

- initWithString: (OFString*)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithString: string];
}

- initWithUnicodeString: (const of_unichar_t*)string
- initWithCharacters: (const of_unichar_t*)characters
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUnicodeString: string];
}

- initWithUnicodeString: (const of_unichar_t*)string
	      byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUnicodeString: string
			byteOrder: byteOrder];
}

- initWithUnicodeString: (const of_unichar_t*)string
		 length: (size_t)length
	      length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUnicodeString: string
								length: length];
	return (id)[[OFMutableString_UTF8 alloc] initWithCharacters: characters
							     length: length];
}

- initWithUnicodeString: (const of_unichar_t*)string
- initWithCharacters: (const of_unichar_t*)characters
	      byteOrder: (of_byte_order_t)byteOrder
		 length: (size_t)length
	      length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUnicodeString: string
			byteOrder: byteOrder
			   length: length];
}

- initWithUTF16String: (const uint16_t*)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string];
}

- initWithUTF16String: (const uint16_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
	   byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF16String: string
		      byteOrder: byteOrder];
	    initWithCharacters: characters
			length: length
		     byteOrder: byteOrder];
}

- initWithUTF16String: (const uint16_t*)string
	       length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string
							      length: length];
}

- initWithUTF16String: (const uint16_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
	       length: (size_t)length
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF16String: string
			 length: length
		      byteOrder: byteOrder
		      byteOrder: byteOrder];
			 length: length];
}

- initWithFormat: (OFConstantString*)format, ...
{
	id ret;
	va_list arguments;

257
258
259
260
261
262
263
264

265
266
267
268
269
270
271

272
273
274
275
276
277
278
231
232
233
234
235
236
237

238
239
240
241
242
243
244

245
246
247
248
249
250
251
252







-
+






-
+








- (void)OF_convertWithWordStartTable: (const of_unichar_t *const[])startTable
		     wordMiddleTable: (const of_unichar_t *const[])middleTable
		  wordStartTableSize: (size_t)startTableSize
		 wordMiddleTableSize: (size_t)middleTableSize
{
	void *pool = objc_autoreleasePoolPush();
	const of_unichar_t *string = [self unicodeString];
	const of_unichar_t *characters = [self characters];
	size_t i, length = [self length];
	BOOL isStart = YES;

	for (i = 0; i < length; i++) {
		const of_unichar_t *const *table;
		size_t tableSize;
		of_unichar_t c = string[i];
		of_unichar_t c = characters[i];

		if (isStart) {
			table = startTable;
			tableSize = middleTableSize;
		} else {
			table = middleTable;
			tableSize = middleTableSize;
300
301
302
303
304
305
306
307
308


309
310
311
312
313
314
315
274
275
276
277
278
279
280


281
282
283
284
285
286
287
288
289







-
-
+
+








- (void)setCharacter: (of_unichar_t)character
	     atIndex: (size_t)index
{
	void *pool = objc_autoreleasePoolPush();
	OFString *string;

	string = [OFString stringWithUnicodeString: &character
					    length: 1];
	string = [OFString stringWithCharacters: &character
					 length: 1];

	[self replaceCharactersInRange: of_range(index, 1)
			    withString: string];

	objc_autoreleasePoolPop(pool);
}

471
472
473
474
475
476
477
478
479


480
481
482
483
484
485
486
487
488
489
490
491
492
493
494

495
496
497

498
499
500
501
502
503
504
505
506
507
508
509
510
511
512

513
514
515
516
517
518
519
445
446
447
448
449
450
451


452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467

468
469
470

471
472
473
474
475
476
477
478
479
480
481
482
483
484
485

486
487
488
489
490
491
492
493







-
-
+
+














-
+


-
+














-
+








- (void)replaceOccurrencesOfString: (OFString*)string
			withString: (OFString*)replacement
			   options: (int)options
			     range: (of_range_t)range
{
	void *pool = objc_autoreleasePoolPush(), *pool2;
	const of_unichar_t *unicodeString;
	const of_unichar_t *searchString = [string unicodeString];
	const of_unichar_t *characters;
	const of_unichar_t *searchCharacters = [string characters];
	size_t searchLength = [string length];
	size_t replacementLength = [replacement length];
	size_t i;

	if (range.length > SIZE_MAX - range.location ||
	    range.location + range.length > [self length])
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	if (searchLength > range.length) {
		objc_autoreleasePoolPop(pool);
		return;
	}

	pool2 = objc_autoreleasePoolPush();
	unicodeString = [self unicodeString];
	characters = [self characters];

	for (i = range.location; i <= range.length - searchLength; i++) {
		if (memcmp(unicodeString + i, searchString,
		if (memcmp(characters + i, searchCharacters,
		    searchLength * sizeof(of_unichar_t)))
			continue;

		[self replaceCharactersInRange: of_range(i, searchLength)
				    withString: replacement];

		range.length -= searchLength;
		range.length += replacementLength;

		i += replacementLength - 1;

		objc_autoreleasePoolPop(pool2);
		pool2 = objc_autoreleasePoolPush();

		unicodeString = [self unicodeString];
		characters = [self characters];
	}

	objc_autoreleasePoolPop(pool);
}

- (void)deleteLeadingWhitespaces
{