| 1100 | // ================================================================================================= |
| 1101 | |
| 1102 | static void CodePoint_from_UTF16Swp ( const UTF16Unit * utf16In, const size_t utf16Len, UTF32Unit * cpOut, size_t * utf16Read ) |
| 1103 | { |
| 1104 | UTF16Unit inUnit; // ! Don't read until we know there is input. |
| 1105 | size_t unitCount = 0; |
| 1106 | |
| 1107 | UC_Assert ( (utf16In != 0) && (cpOut != 0) && (utf16Read != 0) ); |
| 1108 | if ( utf16Len == 0 ) goto Done; |
| 1109 | inUnit = UTF16InSwap(utf16In); |
| 1110 | if ( (0xD800 <= inUnit) && (inUnit <= 0xDFFF) ) goto SurrogatePair; // ! Force linear execution path for the BMP. |
| 1111 | |
| 1112 | unitCount = 1; |
| 1113 | *cpOut = inUnit; // ! Don't put after Done, don't write if no input. |
| 1114 | |
| 1115 | Done: |
| 1116 | *utf16Read = unitCount; |
| 1117 | return; |
| 1118 | |
| 1119 | SurrogatePair: |
| 1120 | CodePoint_from_UTF16Swp_Surrogate ( utf16In, utf16Len, cpOut, utf16Read ); |
| 1121 | return; |
| 1122 | |
| 1123 | } // CodePoint_from_UTF16Swp |
| 1124 | |
| 1125 | // ================================================================================================= |
| 1126 |
nothing calls this directly
no test coverage detected