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

Function CVT2_make_string2

src/jrd/cvt2.cpp:939–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937
938
939USHORT CVT2_make_string2(const dsc* desc, USHORT to_interp, UCHAR** address, MoveBuffer& temp, DecimalStatus decSt)
940{
941/**************************************
942 *
943 * C V T 2 _ m a k e _ s t r i n g 2
944 *
945 **************************************
946 *
947 * Functional description
948 *
949 * Convert the data from the desc to a string in the specified interp.
950 * The pointer to this string is returned in address.
951 *
952 **************************************/
953 UCHAR* from_buf;
954 USHORT from_len;
955 USHORT from_interp;
956
957 fb_assert(desc != NULL);
958 fb_assert(address != NULL);
959
960 switch (desc->dsc_dtype)
961 {
962 case dtype_text:
963 from_buf = desc->dsc_address;
964 from_len = desc->dsc_length;
965 from_interp = INTL_TTYPE(desc);
966 break;
967
968 case dtype_cstring:
969 from_buf = desc->dsc_address;
970 from_len = MIN(static_cast<USHORT>(strlen((char *) desc->dsc_address)), (unsigned) (desc->dsc_length - 1));
971 from_interp = INTL_TTYPE(desc);
972 break;
973
974 case dtype_varying:
975 {
976 vary* varying = (vary*) desc->dsc_address;
977 from_buf = reinterpret_cast<UCHAR*>(varying->vary_string);
978 from_len = MIN(varying->vary_length, (USHORT) (desc->dsc_length - sizeof(SSHORT)));
979 from_interp = INTL_TTYPE(desc);
980 }
981 break;
982 }
983
984 if (desc->isText())
985 {
986 if (from_interp == to_interp || to_interp == ttype_none || to_interp == ttype_binary)
987 {
988 *address = from_buf;
989 return from_len;
990 }
991
992 thread_db* tdbb = JRD_get_thread_data();
993 const USHORT cs1 = INTL_charset(tdbb, to_interp);
994 const USHORT cs2 = INTL_charset(tdbb, from_interp);
995 if (cs1 == cs2)
996 {

Callers 3

MOV_make_string2Function · 0.85
CVT2_blob_compareFunction · 0.85
CVT2_make_metanameFunction · 0.85

Calls 9

JRD_get_thread_dataFunction · 0.85
INTL_charsetFunction · 0.85
INTL_convert_bytesFunction · 0.85
isTextMethod · 0.80
setTextTypeMethod · 0.80
CVT_moveFunction · 0.70
getBufferMethod · 0.45
resizeMethod · 0.45
getCapacityMethod · 0.45

Tested by

no test coverage detected