| 668 | // ================================================================================================= |
| 669 | |
| 670 | static void CodePoint_from_UTF16Nat ( const UTF16Unit * utf16In, const size_t utf16Len, UTF32Unit * cpOut, size_t * utf16Read ) |
| 671 | { |
| 672 | UTF16Unit inUnit; // ! Don't read until we know there is input. |
| 673 | size_t unitCount = 0; |
| 674 | |
| 675 | UC_Assert ( (utf16In != 0) && (cpOut != 0) && (utf16Read != 0) ); |
| 676 | if ( utf16Len == 0 ) goto Done; |
| 677 | inUnit = *utf16In; |
| 678 | if ( (0xD800 <= inUnit) && (inUnit <= 0xDFFF) ) goto SurrogatePair; // ! Force linear execution path for the BMP. |
| 679 | |
| 680 | unitCount = 1; |
| 681 | *cpOut = inUnit; // ! Don't put after Done, don't write if no input. |
| 682 | |
| 683 | Done: |
| 684 | *utf16Read = unitCount; |
| 685 | return; |
| 686 | |
| 687 | SurrogatePair: |
| 688 | CodePoint_from_UTF16Nat_Surrogate ( utf16In, utf16Len, cpOut, utf16Read ); |
| 689 | return; |
| 690 | |
| 691 | } // CodePoint_from_UTF16Nat |
| 692 | |
| 693 | // ================================================================================================= |
| 694 |
nothing calls this directly
no test coverage detected