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 | 1.1 |
Files: | files | file ages | folders |
SHA3-256: |
cacfcf1b9d70ebd6788ea775af155458 |
User & Date: | js on 2024-08-24 23:43:39 |
Other Links: | branch diff | manifest | tags |
Context
2024-08-25
| ||
21:29 | OFINIFile: Fix parsing `=` within `"` check-in: a7ef90581c user: js tags: 1.1 | |
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:20 | OFString: Fix converting from some encodings check-in: 6e79f005c4 user: js tags: 1.1 | |
Changes
Modified src/OFMutableUTF8String.m from [0d2c04f6f8] to [dda54dd86e].
︙ | |||
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | 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 387 388 | + + - + - - - + + + + + + + + + + | 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); |
︙ | |||
427 428 429 430 431 432 433 | 436 437 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 | + - + + + + - + - - - + + + - - - + + + + + + + + + + | } @finally { free(UTF8String); } } - (void)insertString: (OFString *)string atIndex: (size_t)idx { const char *UTF8String; |
︙ | |||
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | 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 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 | + + + + + - - + + - - - + + + - - - + + + + + + + + + + | - (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; |
︙ | |||
631 632 633 634 635 636 637 | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | - - + + + + + + + + + + | _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.h from [f1efc16deb] to [a9510f1ddf].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + | struct OFUTF8StringIvars _storage; } @end #ifdef __cplusplus extern "C" { #endif |
︙ |
Modified src/OFUTF8String.m from [2832b02ca4] to [3e5753e6f2].
︙ | |||
444 445 446 447 448 449 450 | 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 | - - - - - - - + + + + + + + + + + + + + + | { self = [super init]; @try { _s = &_storage; _s->cStringLength = string.UTF8StringLength; |
︙ |