Differences From Artifact [7b388678b4]:
- File
src/OFMutableString_UTF8.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 19854) [annotate] [blame] [check-ins using] [more...]
To Artifact [3b7cce9749]:
- File src/OFMutableString_UTF8.m — part of check-in [e0b9167693] at 2016-02-21 15:37:42 on branch trunk — Make use of C99-style for loops (user: js, size: 19862) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
385 386 387 388 389 390 391 | - (void)appendCharacters: (of_unichar_t*)characters length: (size_t)length { char *tmp; tmp = [self allocMemoryWithSize: (length * 4) + 1]; @try { | | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | - (void)appendCharacters: (of_unichar_t*)characters length: (size_t)length { char *tmp; tmp = [self allocMemoryWithSize: (length * 4) + 1]; @try { size_t j = 0; bool isUTF8 = false; for (size_t i = 0; i < length; i++) { size_t len = of_string_utf8_encode(characters[i], tmp + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) |
︙ | ︙ | |||
645 646 647 648 649 650 651 | options: (int)options range: (of_range_t)range { const char *searchString = [string UTF8String]; const char *replacementString = [replacement UTF8String]; size_t searchLength = [string UTF8StringLength]; size_t replacementLength = [replacement UTF8StringLength]; | | < > | | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | options: (int)options range: (of_range_t)range { const char *searchString = [string UTF8String]; const char *replacementString = [replacement UTF8String]; size_t searchLength = [string UTF8StringLength]; size_t replacementLength = [replacement UTF8StringLength]; size_t last, newCStringLength, newLength; char *newCString; if (range.length > SIZE_MAX - range.location || range.location + range.length > [self length]) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { range.location = of_string_utf8_get_position(_s->cString, range.location, _s->cStringLength); range.length = of_string_utf8_get_position( _s->cString + range.location, range.length, _s->cStringLength - range.location); } if ([string UTF8StringLength] > range.length) return; newCString = NULL; newCStringLength = 0; newLength = _s->length; last = 0; for (size_t i = range.location; i <= range.length - searchLength; i++) { if (memcmp(_s->cString + i, searchString, searchLength) != 0) continue; @try { newCString = [self resizeMemory: newCString size: newCStringLength + i - last + |
︙ | ︙ |