Overview
Comment: | OF(Mutable)String_UTF8: Code simplification. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f177032b43bea32a84498a790fdb3522 |
User & Date: | js on 2013-11-23 17:28:18 |
Other Links: | manifest | tags |
Context
2013-11-23
| ||
17:48 | of_asprintf: Add %K format specifier. check-in: 945ff1043d user: js tags: trunk | |
17:28 | OF(Mutable)String_UTF8: Code simplification. check-in: f177032b43 user: js tags: trunk | |
03:24 | of_asprintf: Change %C to %k. check-in: 5eada9f7b0 user: js tags: trunk | |
Changes
Modified src/OFMutableString_UTF8.m from [9492a9e3d8] to [be6d727813].
︙ | ︙ | |||
391 392 393 394 395 396 397 | tmp = [self allocMemoryWithSize: (length * 4) + 1]; @try { size_t i, j = 0; bool isUTF8 = false; for (i = 0; i < length; i++) { | < < | < | < < < < | | < < < < < | < < < | < < < < < | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | tmp = [self allocMemoryWithSize: (length * 4) + 1]; @try { size_t i, j = 0; bool isUTF8 = false; for (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) isUTF8 = true; j += len; } tmp[j] = '\0'; _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: _s->cStringLength + j + 1]; |
︙ | ︙ |
Modified src/OFString_UTF8.m from [33807e1aeb] to [7fb4904a02].
︙ | ︙ | |||
412 413 414 415 416 417 418 | _s = &_storage; _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; for (i = 0; i < length; i++) { | < < > | > | < | < < < < | < < < < < | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | _s = &_storage; _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; for (i = 0; i < length; i++) { size_t len = of_string_utf8_encode(characters[i], _s->cString + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) _s->isUTF8 = true; j += len; } _s->cString[j] = '\0'; _s->cStringLength = j; @try { _s->cString = [self resizeMemory: _s->cString |
︙ | ︙ | |||
477 478 479 480 481 482 483 | _s = &_storage; _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; for (i = 0; i < length; i++) { | < | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | _s = &_storage; _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; for (i = 0; i < length; i++) { of_unichar_t character = (swap ? OF_BSWAP16(string[i]) : string[i]); size_t len; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; |
︙ | ︙ | |||
508 509 510 511 512 513 514 | character = (((character & 0x3FF) << 10) | (nextCharacter & 0x3FF)) + 0x10000; i++; _s->length--; } | | | | | | < < < < | < < < < < | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | character = (((character & 0x3FF) << 10) | (nextCharacter & 0x3FF)) + 0x10000; i++; _s->length--; } len = of_string_utf8_encode(character, _s->cString + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) _s->isUTF8 = true; j += len; } _s->cString[j] = '\0'; _s->cStringLength = j; @try { _s->cString = [self resizeMemory: _s->cString |
︙ | ︙ |