MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / unicodeCanonical

Function unicodeCanonical

src/common/IntlUtil.cpp:914–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912
913
914static ULONG unicodeCanonical(texttype* tt, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst)
915{
916 TextTypeImpl* impl = static_cast<TextTypeImpl*>(tt->texttype_impl);
917
918 try
919 {
920 charset* cs = impl->cs;
921
922 HalfStaticArray<UCHAR, BUFFER_SMALL> utf16Str;
923 USHORT errorCode;
924 ULONG offendingPos;
925
926 utf16Str.getBuffer(
927 cs->charset_to_unicode.csconvert_fn_convert(
928 &cs->charset_to_unicode,
929 srcLen,
930 src,
931 0,
932 NULL,
933 &errorCode,
934 &offendingPos));
935
936 const ULONG utf16Len = cs->charset_to_unicode.csconvert_fn_convert(
937 &cs->charset_to_unicode,
938 srcLen,
939 src,
940 utf16Str.getCapacity(),
941 utf16Str.begin(),
942 &errorCode,
943 &offendingPos);
944
945 return impl->collation->canonical(
946 utf16Len, Firebird::Aligner<USHORT>(utf16Str.begin(), utf16Len),
947 dstLen, Firebird::OutAligner<ULONG>(dst, dstLen), NULL);
948 }
949 catch (const BadAlloc&)
950 {
951 fb_assert(false);
952 return INTL_BAD_KEY_LENGTH;
953 }
954}
955
956
957} // namespace Firebird

Callers

nothing calls this directly

Calls 4

getBufferMethod · 0.45
getCapacityMethod · 0.45
beginMethod · 0.45
canonicalMethod · 0.45

Tested by

no test coverage detected