| 564 | // ================================================================================================= |
| 565 | |
| 566 | void CodePoint_from_UTF8 ( const UTF8Unit * utf8In, const size_t utf8Len, UTF32Unit * cpOut, size_t * utf8Read ) |
| 567 | { |
| 568 | UTF8Unit inUnit; // ! Don't read until we know there is input. |
| 569 | size_t unitCount = 0; |
| 570 | |
| 571 | UC_Assert ( (utf8In != 0) && (cpOut != 0) && (utf8Read != 0) ); |
| 572 | if ( utf8Len == 0 ) goto Done; |
| 573 | inUnit = *utf8In; |
| 574 | if ( inUnit >= 0x80 ) goto MultiByte; // ! Force linear execution path for ASCII. |
| 575 | |
| 576 | unitCount = 1; |
| 577 | *cpOut = inUnit; // ! Don't put after Done, don't write if no input. |
| 578 | |
| 579 | Done: |
| 580 | *utf8Read = unitCount; |
| 581 | return; |
| 582 | |
| 583 | MultiByte: |
| 584 | CodePoint_from_UTF8_Multi ( utf8In, utf8Len, cpOut, utf8Read ); |
| 585 | return; |
| 586 | |
| 587 | } // CodePoint_from_UTF8 |
| 588 | |
| 589 | // ================================================================================================= |
| 590 |
nothing calls this directly
no test coverage detected