| 2430 | |
| 2431 | |
| 2432 | void 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 | |
| 2480 | USHORT CVT_make_string(const dsc* desc, |
no test coverage detected