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

Function make_null_string

src/common/cvt.cpp:2432–2477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2430
2431
2432void make_null_string(const dsc* desc,
2433 USHORT to_interp,
2434 const char** address,
2435 vary* temp,
2436 USHORT length,
2437 DecimalStatus decSt,
2438 ErrorFunction err)
2439{
2440/**************************************
2441 *
2442 * C V T _ m a k e _ n u l l _ s t r i n g
2443 *
2444 **************************************
2445 *
2446 * Functional description
2447 * Convert the data from the desc to a zero-terminated string.
2448 * The pointer to this string is returned in address.
2449 * Data always placed to temp buffer.
2450 *
2451 **************************************/
2452 fb_assert(temp);
2453
2454 USHORT len = CVT_make_string(desc, to_interp, address, temp, --length, decSt, err);
2455
2456 if (*address != temp->vary_string)
2457 {
2458 length -= sizeof(USHORT); // Take into an account VaryStr specifics
2459 if (len > length)
2460 {
2461 err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_string_truncation) <<
2462 Arg::Gds(isc_imp_exc) <<
2463 Arg::Gds(isc_trunc_limits) << Arg::Num(length) << Arg::Num(len));
2464 }
2465 memcpy(temp->vary_string, *address, len);
2466 temp->vary_length = len;
2467 }
2468
2469 fb_assert(temp->vary_length == len);
2470 temp->vary_string[len] = 0;
2471
2472 for (USHORT n = 0; n < len; ++n)
2473 {
2474 if (!temp->vary_string[n]) // \0 in the middle of a string
2475 CVT_conversion_error(desc, err);
2476 }
2477}
2478
2479
2480USHORT CVT_make_string(const dsc* desc,

Callers 2

CVT_get_dec64Function · 0.85
CVT_get_dec128Function · 0.85

Calls 4

CVT_make_stringFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
CVT_conversion_errorFunction · 0.85

Tested by

no test coverage detected