| 937 | |
| 938 | |
| 939 | USHORT 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 | { |
no test coverage detected