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

Function cvt_get_short

src/common/cvt.cpp:1164–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1162};
1163
1164static SSHORT cvt_get_short(const dsc* desc, SSHORT scale, DecimalStatus decSt, ErrorFunction err)
1165{
1166/**************************************
1167 *
1168 * C V T _ g e t _ s h o r t
1169 *
1170 **************************************
1171 *
1172 * Functional description
1173 * Convert something arbitrary to a short (16 bit) integer of given
1174 * scale.
1175 *
1176 **************************************/
1177 SSHORT value;
1178
1179 if (desc->isText())
1180 {
1181 VaryStr<20> buffer; // long enough to represent largest short in ASCII
1182 const char* p;
1183 USHORT length = CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), decSt, err);
1184
1185 {
1186 RetValue<SSHORTTraits> rv(&value);
1187 scale -= cvt_decompose(p, length, &rv, err);
1188 }
1189 adjustForScale(value, scale, SHORT_LIMIT, err);
1190 }
1191 else {
1192 ULONG lval = CVT_get_long(desc, scale, decSt, err);
1193 value = (SSHORT) lval;
1194 if (value != SLONG(lval))
1195 err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
1196 }
1197
1198 return value;
1199}
1200
1201
1202class SLONGTraits

Callers 1

CVT_move_commonFunction · 0.85

Calls 6

CVT_make_stringFunction · 0.85
cvt_decomposeFunction · 0.85
adjustForScaleFunction · 0.85
CVT_get_longFunction · 0.85
GdsClass · 0.85
isTextMethod · 0.80

Tested by

no test coverage detected