Differences From Artifact [70fe1f9064]:
- File
src/OFString.m
— part of check-in
[149874777c]
at
2023-08-23 16:01:21
on branch trunk
— Remove incomplete NFD/NFKD support
It has been moved to the "unicode-normalization" branch until it is
ready. (user: js, size: 64779) [annotate] [blame] [check-ins using] [more...]
To Artifact [c29f20e2b2]:
- File src/OFString.m — part of check-in [8471999204] at 2023-08-22 16:16:00 on branch trunk — Don't require a regular file to init an object (user: js, size: 65839) [annotate] [blame] [check-ins using]
| ︙ | |||
341 342 343 344 345 346 347 348 349 350 351 352 353 354 | 341 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
{
size_t length = strlen(string);
char *copy = (char *)OFAllocMemory(1, length + 1);
memcpy(copy, string, length + 1);
return copy;
}
#ifdef OF_HAVE_UNICODE_TABLES
static OFString *
decomposedString(OFString *self, const char *const *const *table, size_t size)
{
OFMutableString *ret = [OFMutableString string];
void *pool = objc_autoreleasePoolPush();
const OFUnichar *characters = self.characters;
size_t length = self.length;
for (size_t i = 0; i < length; i++) {
OFUnichar 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;
}
#endif
@implementation OFPlaceholderString
#ifdef __clang__
/* We intentionally don't call into super, so silence the warning. */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wobjc-designated-initializers"
|
| ︙ | |||
2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 | 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 | + + + + + + + + + + + + + + |
[data retain];
objc_autoreleasePoolPop(pool);
return [data autorelease];
}
#ifdef OF_HAVE_UNICODE_TABLES
- (OFString *)decomposedStringWithCanonicalMapping
{
return decomposedString(self, OFUnicodeDecompositionTable,
OFUnicodeDecompositionTableSize);
}
- (OFString *)decomposedStringWithCompatibilityMapping
{
return decomposedString(self, OFUnicodeDecompositionCompatTable,
OFUnicodeDecompositionCompatTableSize);
}
#endif
#ifdef OF_WINDOWS
- (OFString *)stringByExpandingWindowsEnvironmentStrings
{
if ([OFSystemInfo isWindowsNT]) {
wchar_t buffer[512];
size_t length;
|
| ︙ |