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

Function CodePoint_from_UTF16Nat

xmpsdk/src/UnicodeConversions.cpp:670–691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668// =================================================================================================
669
670static 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
683Done:
684 *utf16Read = unitCount;
685 return;
686
687SurrogatePair:
688 CodePoint_from_UTF16Nat_Surrogate ( utf16In, utf16Len, cpOut, utf16Read );
689 return;
690
691} // CodePoint_from_UTF16Nat
692
693// =================================================================================================
694

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected