Overview
Comment: | Add support for tagged pointer strings |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8ca952eaa46d5f2070b0a507d5226038 |
User & Date: | js on 2024-08-25 00:47:24 |
Other Links: | manifest | tags |
References
2024-08-25
| ||
00:53 | • Fixed ticket [31d1e19cd9]: Support for tagged pointer strings plus 4 other changes artifact: 016d95a5f0 user: js | |
Context
2024-08-25
| ||
21:27 | OFINIFile: Fix parsing `=` within `"` check-in: 95fcd0f05b user: js tags: trunk | |
00:47 | Add support for tagged pointer strings check-in: 8ca952eaa4 user: js tags: trunk | |
2024-08-24
| ||
23:41 | Don't assume all custom string classes use Unicode check-in: 82c5846734 user: js tags: trunk | |
Changes
Modified src/Makefile from [4661138f18] to [65892fa6a5].
︙ | |||
243 244 245 246 247 248 249 | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | - + + | OFKernelEventObserver.m \ ${OF_KQUEUE_KERNEL_EVENT_OBSERVER_M} \ ${OF_POLL_KERNEL_EVENT_OBSERVER_M} \ ${OF_SELECT_KERNEL_EVENT_OBSERVER_M} \ OFTCPSocketSOCKS5Connector.m SRCS_TAGGED_POINTERS = OFTaggedPointerColor.m \ OFTaggedPointerDate.m \ |
︙ |
Modified src/OFString.m from [8acc3c73fe] to [0a6f9138dd].
︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | + | # import "OFFileManager.h" #endif #import "OFIRI.h" #import "OFIRIHandler.h" #import "OFLocale.h" #import "OFStream.h" #import "OFSystemInfo.h" #import "OFTaggedPointerString.h" #import "OFUTF8String.h" #import "OFUTF8String+Private.h" #import "OFGetItemAttributesFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" |
︙ | |||
85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | + + + + + + + + | static struct { Class isa; } placeholder; #if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L) || defined(HAVE_USELOCALE) static locale_t cLocale; #endif #ifdef OF_OBJFW_RUNTIME # if UINTPTR_MAX == UINT64_MAX # define MAX_TAGGED_POINTER_LENGTH 8 # else # define MAX_TAGGED_POINTER_LENGTH 4 # endif #endif @interface OFString () - (size_t)of_getCString: (char *)cString maxLength: (size_t)maxLength encoding: (OFStringEncoding)encoding lossy: (bool)lossy OF_DIRECT; - (const char *)of_cStringWithEncoding: (OFStringEncoding)encoding |
︙ | |||
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | 370 371 372 373 374 375 376 377 378 379 380 381 382 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 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | + + + + + + + + + + + + + - + + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + | { size_t length = strlen(string); char *copy = (char *)OFAllocMemory(1, length + 1); memcpy(copy, string, length + 1); return copy; } #ifdef OF_OBJFW_RUNTIME static bool isASCII(const char *string, size_t length) { uint8_t combined = 0; for (size_t i = 0; i < length; i++) combined |= string[i]; return !(combined & ~0x7F); } #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" #endif - (instancetype)init { |
︙ | |||
423 424 425 426 427 428 429 | 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 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | - - - + + + + - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + | length: UTF8StringLength freeWhenDone: freeWhenDone]; } - (instancetype)initWithCString: (const char *)cString encoding: (OFStringEncoding)encoding { |
︙ | |||
477 478 479 480 481 482 483 484 485 486 487 488 489 490 | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | { return (id)[[OFUTF8String alloc] initWithString: string]; } - (instancetype)initWithCharacters: (const OFUnichar *)string length: (size_t)length { if (length == 0) return (id)@""; #ifdef OF_OBJFW_RUNTIME if (length <= MAX_TAGGED_POINTER_LENGTH) { char buffer[MAX_TAGGED_POINTER_LENGTH]; bool isUnicode = false; for (size_t i = 0; i < length; i++) { if (string[i] >= 0x80) { isUnicode = true; break; } buffer[i] = (char)string[i]; } if (!isUnicode) { id ret = [OFTaggedPointerString stringWithASCIIString: buffer length: length]; if (ret != nil) return ret; } } #endif return (id)[[OFUTF8String alloc] initWithCharacters: string length: length]; } - (instancetype)initWithUTF16String: (const OFChar16 *)string { return (id)[[OFUTF8String alloc] initWithUTF16String: string]; |
︙ |
Added src/OFTaggedPointerString.h version [b8ba961a0f].
|
Added src/OFTaggedPointerString.m version [17da7c1b2d].