MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / CodePoint_from_UTF16Swp

Function CodePoint_from_UTF16Swp

xmpsdk/src/UnicodeConversions.cpp:1102–1123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1100// =================================================================================================
1101
1102static 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
1115Done:
1116 *utf16Read = unitCount;
1117 return;
1118
1119SurrogatePair:
1120 CodePoint_from_UTF16Swp_Surrogate ( utf16In, utf16Len, cpOut, utf16Read );
1121 return;
1122
1123} // CodePoint_from_UTF16Swp
1124
1125// =================================================================================================
1126

Callers

nothing calls this directly

Calls 2

UTF16InSwapFunction · 0.85

Tested by

no test coverage detected