Overview
Comment: | Don't assume all custom string classes use Unicode
Initially, isUTF8 was set to true for all custom string classes because |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
82c584673415ba9d2a14c9f2664fe1d0 |
User & Date: | js on 2024-08-24 23:41:16 |
Other Links: | manifest | tags |
Context
2024-08-25
| ||
00:47 | Add support for tagged pointer strings check-in: 8ca952eaa4 user: js tags: trunk | |
2024-08-24
| ||
23:43 | Don't assume all custom string classes use Unicode check-in: cacfcf1b9d user: js tags: 1.1 | |
23:41 | Don't assume all custom string classes use Unicode check-in: 82c5846734 user: js tags: trunk | |
22:19 | OFString: Fix converting from some encodings check-in: d6a8d57148 user: js tags: trunk | |
Changes
Modified src/OFMutableUTF8String.m from [3976c4d518] to [521dc8393f].
︙ | |||
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | 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 387 388 389 390 | + + - + - - - + + + + + + + + + + | objc_autoreleasePoolPop(pool); } } - (void)appendString: (OFString *)string { const char *UTF8String; size_t UTF8StringLength; if (string == nil) @throw [OFInvalidArgumentException exception]; UTF8String = string.UTF8String; UTF8StringLength = string.UTF8StringLength; _s->hasHash = false; _s->cString = OFResizeMemory(_s->cString, _s->cStringLength + UTF8StringLength + 1, 1); |
︙ | |||
429 430 431 432 433 434 435 | 438 439 440 441 442 443 444 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 | + - + + + + - + - - - + + + - - - + + + + + + + + + + | } @finally { free(UTF8String); } } - (void)insertString: (OFString *)string atIndex: (size_t)idx { const char *UTF8String; |
︙ | |||
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | 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 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 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 | + + + + + - - + + - - - + + + - - - + + + + + + + + + + | - (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement { size_t start = range.location; size_t end = range.location + range.length; size_t newCStringLength, newLength; const char *replacementString; size_t replacementLength; if (replacement == nil) @throw [OFInvalidArgumentException exception]; if (range.length > SIZE_MAX - range.location || end > _s->length) @throw [OFOutOfRangeException exception]; newLength = _s->length - range.length + replacement.length; if (_s->isUTF8) { start = _OFUTF8StringIndexToPosition(_s->cString, start, _s->cStringLength); end = _OFUTF8StringIndexToPosition(_s->cString, end, _s->cStringLength); } replacementString = replacement.UTF8String; replacementLength = replacement.UTF8StringLength; |
︙ | |||
633 634 635 636 637 638 639 | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | - - + + + + + + + + + + | _s->cStringLength = newCStringLength; _s->length = newLength; if ([replacement isKindOfClass: [OFUTF8String class]] || [replacement isKindOfClass: [OFMutableUTF8String class]]) { if (((OFMutableUTF8String *)replacement)->_s->isUTF8) _s->isUTF8 = true; |
︙ |
Modified src/OFUTF8String+Private.h from [ec0d6fe6c1] to [ccfb13bd6d].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | length: (size_t)UTF8StringLength storage: (char *)storage OF_METHOD_FAMILY(init); @end #ifdef __cplusplus extern "C" { #endif |
︙ |
Modified src/OFUTF8String.m from [69877c8b33] to [eb22322b98].
︙ | |||
456 457 458 459 460 461 462 | 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 | - - - - - - - + + + + + + + + + + + + + + | { self = [super init]; @try { _s = &_storage; _s->cStringLength = string.UTF8StringLength; |
︙ |