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

Function unicodeCompare

src/common/IntlUtil.cpp:849–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847
848
849static SSHORT unicodeCompare(texttype* tt, ULONG len1, const UCHAR* str1,
850 ULONG len2, const UCHAR* str2, INTL_BOOL* errorFlag)
851{
852 TextTypeImpl* impl = static_cast<TextTypeImpl*>(tt->texttype_impl);
853
854 try
855 {
856 *errorFlag = false;
857
858 charset* cs = impl->cs;
859
860 HalfStaticArray<UCHAR, BUFFER_SMALL> utf16Str1;
861 HalfStaticArray<UCHAR, BUFFER_SMALL> utf16Str2;
862 USHORT errorCode;
863 ULONG offendingPos;
864
865 utf16Str1.getBuffer(
866 cs->charset_to_unicode.csconvert_fn_convert(
867 &cs->charset_to_unicode,
868 len1,
869 str1,
870 0,
871 NULL,
872 &errorCode,
873 &offendingPos));
874
875 const ULONG utf16Len1 = cs->charset_to_unicode.csconvert_fn_convert(
876 &cs->charset_to_unicode,
877 len1,
878 str1,
879 utf16Str1.getCapacity(),
880 utf16Str1.begin(),
881 &errorCode,
882 &offendingPos);
883
884 utf16Str2.getBuffer(
885 cs->charset_to_unicode.csconvert_fn_convert(
886 &cs->charset_to_unicode,
887 len2,
888 str2,
889 0,
890 NULL,
891 &errorCode,
892 &offendingPos));
893
894 const ULONG utf16Len2 = cs->charset_to_unicode.csconvert_fn_convert(
895 &cs->charset_to_unicode,
896 len2,
897 str2,
898 utf16Str2.getCapacity(),
899 utf16Str2.begin(),
900 &errorCode,
901 &offendingPos);
902
903 return impl->collation->compare(utf16Len1, (USHORT*)utf16Str1.begin(),
904 utf16Len2, (USHORT*)utf16Str2.begin(), errorFlag);
905 }
906 catch (const BadAlloc&)

Callers

nothing calls this directly

Calls 4

getBufferMethod · 0.45
getCapacityMethod · 0.45
beginMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected