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

Function unicodeStrToKey

src/common/IntlUtil.cpp:807–846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805
806
807static USHORT unicodeStrToKey(texttype* tt, USHORT srcLen, const UCHAR* src,
808 USHORT dstLen, UCHAR* dst, USHORT keyType)
809{
810 TextTypeImpl* impl = static_cast<TextTypeImpl*>(tt->texttype_impl);
811
812 try
813 {
814 charset* cs = impl->cs;
815
816 HalfStaticArray<UCHAR, BUFFER_SMALL> utf16Str;
817 USHORT errorCode;
818 ULONG offendingPos;
819
820 utf16Str.getBuffer(
821 cs->charset_to_unicode.csconvert_fn_convert(
822 &cs->charset_to_unicode,
823 srcLen,
824 src,
825 0,
826 NULL,
827 &errorCode,
828 &offendingPos));
829
830 ULONG utf16Len = cs->charset_to_unicode.csconvert_fn_convert(
831 &cs->charset_to_unicode,
832 srcLen,
833 src,
834 utf16Str.getCapacity(),
835 utf16Str.begin(),
836 &errorCode,
837 &offendingPos);
838
839 return impl->collation->stringToKey(utf16Len, (USHORT*)utf16Str.begin(), dstLen, dst, keyType);
840 }
841 catch (const BadAlloc&)
842 {
843 fb_assert(false);
844 return INTL_BAD_KEY_LENGTH;
845 }
846}
847
848
849static SSHORT unicodeCompare(texttype* tt, ULONG len1, const UCHAR* str1,

Callers

nothing calls this directly

Calls 4

stringToKeyMethod · 0.80
getBufferMethod · 0.45
getCapacityMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected