ObjFW  Diff

Differences From Artifact [6d858b8401]:

To Artifact [b020b18390]:


342
343
344
345
346
347
348































349
350
351
352
353
354
355
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








	ret = [[array componentsJoinedByString: joinString] retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

static OFString *
decomposedString(OFString *self, const char *const *const *table, size_t size)
{
	OFMutableString *ret = [OFMutableString string];
	void *pool = objc_autoreleasePoolPush();
	const of_unichar_t *characters = [self characters];
	size_t length = [self length];

	for (size_t i = 0; i < length; i++) {
		of_unichar_t c = characters[i];
		const char *const *page;

		if (c >= size) {
			[ret appendCharacters: &c
				       length: 1];
			continue;
		}

		page = table[c >> 8];
		if (page != NULL && page[c & 0xFF] != NULL)
			[ret appendUTF8String: page[c & 0xFF]];
		else
			[ret appendCharacters: &c
				       length: 1];
	}

	objc_autoreleasePoolPop(pool);

	return ret;
}

static struct {
	Class isa;
} placeholder;

@interface OFString_placeholder: OFString
@end
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722

2723
2724
2725
2726
2727

2728
2729
2730
2731

2732
2733
2734
2735
2736
2737
2738
2739
2740

2741
2742
2743



2744
2745
2746
2747
2748
2749
2750
2742
2743
2744
2745
2746
2747
2748





2749





2750




2751
2752








2753



2754
2755
2756
2757
2758
2759
2760
2761
2762
2763







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

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








	return ret;
}

#ifdef OF_HAVE_UNICODE_TABLES
- (OFString *)decomposedStringWithCanonicalMapping
{
	OFMutableString *ret = [OFMutableString string];
	void *pool = objc_autoreleasePoolPush();
	const of_unichar_t *characters = [self characters];
	size_t length = [self length];

	return decomposedString(self, of_unicode_decomposition_table,
	for (size_t i = 0; i < length; i++) {
		of_unichar_t c = characters[i];
		const char *const *table;

		if (c >= OF_UNICODE_DECOMPOSITION_TABLE_SIZE) {
	    OF_UNICODE_DECOMPOSITION_TABLE_SIZE);
			[ret appendCharacters: &c
				       length: 1];
			continue;
		}
}

		table = of_unicode_decomposition_table[c >> 8];
		if (table != NULL && table[c & 0xFF] != NULL)
			[ret appendUTF8String: table[c & 0xFF]];
		else
			[ret appendCharacters: &c
				       length: 1];
	}

- (OFString *)decomposedStringWithCompatibilityMapping
	objc_autoreleasePoolPop(pool);

	return ret;
{
	return decomposedString(self, of_unicode_decomposition_compat_table,
	    OF_UNICODE_DECOMPOSITION_COMPAT_TABLE_SIZE);
}
#endif

#ifdef OF_HAVE_FILES
- (void)writeToFile: (OFString *)path
{
	[self writeToFile: path