Overview
Comment: | Rename s->UTF8 to s->isUTF8. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9817eab3be57fe38df25a566b6b92b19 |
User & Date: | js on 2012-10-13 21:29:30 |
Other Links: | manifest | tags |
Context
2012-10-13
| ||
22:21 | Add -[OFString rangeOfString:options:range:]. check-in: 20dddc7345 user: js tags: trunk | |
21:29 | Rename s->UTF8 to s->isUTF8. check-in: 9817eab3be user: js tags: trunk | |
21:06 | of_bswap* -> OF_BSWAP*. check-in: 1cb8fee5c3 user: js tags: trunk | |
Changes
Modified src/OFConstantString.m from [0925478785] to [f72b46effc].
︙ | |||
154 155 156 157 158 159 160 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + | ivars->cString = cString; ivars->cStringLength = cStringLength; switch (of_string_utf8_check(ivars->cString, ivars->cStringLength, &ivars->length)) { case 1: |
︙ |
Modified src/OFMutableString_UTF8.m from [e8d0af35fc] to [34bbb5a839].
︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + | { of_unichar_t *unicodeString; size_t unicodeLen, newCStringLength; size_t i, j; char *newCString; BOOL isStart = YES; |
︙ | |||
201 202 203 204 205 206 207 | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - + | - (void)setCharacter: (of_unichar_t)character atIndex: (size_t)index { char buffer[4]; of_unichar_t c; size_t lenNew, lenOld; |
︙ | |||
243 244 245 246 247 248 249 | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | - + | memcpy(s->cString + index, buffer, lenNew); s->cStringLength -= lenOld; s->cStringLength += lenNew; s->cString[s->cStringLength] = '\0'; if (character & 0x80) |
︙ | |||
276 277 278 279 280 281 282 | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | - + | if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: |
︙ | |||
305 306 307 308 309 310 311 | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | - + | if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: |
︙ | |||
374 375 376 377 378 379 380 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | - - + + - + | s->cStringLength += UTF8StringLength; s->length += [string length]; s->cString[s->cStringLength] = 0; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) { |
︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - + | for (i = 0, j = s->cStringLength - 1; i < s->cStringLength / 2; i++, j--) { s->cString[i] ^= s->cString[j]; s->cString[j] ^= s->cString[i]; s->cString[i] ^= s->cString[j]; } |
︙ | |||
498 499 500 501 502 503 504 | 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 544 545 546 547 548 549 | - + - - + + - + - + | { size_t newCStringLength; if (index > s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; |
︙ | |||
566 567 568 569 570 571 572 | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + | size_t newCStringLength, newLength; if (end > s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; newLength = s->length - (end - start) + [replacement length]; |
︙ | |||
600 601 602 603 604 605 606 | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | - + | const char *searchString = [string UTF8String]; const char *replacementString = [replacement UTF8String]; size_t searchLength = [string UTF8StringLength]; size_t replacementLength = [replacement UTF8StringLength]; size_t i, last, newCStringLength, newLength; char *newCString; |
︙ |
Modified src/OFString.h from [505bd888a0] to [2f006f43b3].
︙ | |||
623 624 625 626 627 628 629 | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | - + | */ - (of_range_t)rangeOfString: (OFString*)string; /** * \brief Returns the range of the string. * * \param string The string to search |
︙ |
Modified src/OFString_UTF8.h from [a124fe7f59] to [cbba34b9c4].
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + | * Since constant strings don't have s_store, they have to malloc it on * the first access. Strings created at runtime just set the pointer to * &s_store. */ struct of_string_utf8_ivars { char *cString; size_t cStringLength; |
Modified src/OFString_UTF8.m from [2e4dae0bbe] to [dd6ca8a27b].
︙ | |||
252 253 254 255 256 257 258 | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | - + | s->cString = storage; s->cStringLength = UTF8StringLength; switch (of_string_utf8_check(UTF8String, UTF8StringLength, &s->length)) { case 1: |
︙ | |||
299 300 301 302 303 304 305 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - + | switch (of_string_utf8_check(cString, cStringLength, &s->length)) { case 1: if (encoding == OF_STRING_ENCODING_ASCII) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; |
︙ | |||
325 326 327 328 329 330 331 | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | - + | size_t bytes; if (!(cString[i] & 0x80)) { s->cString[j++] = cString[i]; continue; } |
︙ | |||
375 376 377 378 379 380 381 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | - + | character = table[(uint8_t)cString[i]]; if (character == 0xFFFD) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; |
︙ | |||
425 426 427 428 429 430 431 | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | - + | s->cString = (char*)UTF8String; s->cStringLength = UTF8StringLength; switch (of_string_utf8_check(UTF8String, UTF8StringLength, &s->length)) { case 1: |
︙ | |||
450 451 452 453 454 455 456 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | - + - + | @try { s = &s_store; s->cStringLength = [string UTF8StringLength]; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) |
︙ | |||
503 504 505 506 507 508 509 | 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 | - + - + - + | buffer); switch (characterLen) { case 1: s->cString[j++] = buffer[0]; break; case 2: |
︙ | |||
610 611 612 613 614 615 616 | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | - + - + - + | characterLen = of_string_utf8_encode(character, buffer); switch (characterLen) { case 1: s->cString[j++] = buffer[0]; break; case 2: |
︙ | |||
682 683 684 685 686 687 688 | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | - + | s->cStringLength = cStringLength; @try { switch (of_string_utf8_check(tmp, cStringLength, &s->length)) { case 1: |
︙ | |||
720 721 722 723 724 725 726 | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | - + - + + - + - + | s = &s_store; s->cStringLength = [firstComponent UTF8StringLength]; if ([firstComponent isKindOfClass: [OFString_UTF8 class]] || [firstComponent isKindOfClass: [OFMutableString_UTF8 class]]) |
︙ | |||
784 785 786 787 788 789 790 | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | - + | - (const char*)cStringWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: |
︙ | |||
812 813 814 815 816 817 818 | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | - + | - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cStringLength; case OF_STRING_ENCODING_ASCII: |
︙ | |||
897 898 899 900 901 902 903 | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | - + | @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; otherCString = [otherString UTF8String]; otherCStringLength = [otherString UTF8StringLength]; |
︙ | |||
1005 1006 1007 1008 1009 1010 1011 | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | - + | - (of_unichar_t)characterAtIndex: (size_t)index { of_unichar_t character; if (index >= s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; |
︙ | |||
1092 1093 1094 1095 1096 1097 1098 | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | - + | { size_t start = range.start; size_t end = range.start + range.length; if (end > s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; |
︙ |