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

Method validateLength

src/common/cvt.cpp:3673–3699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3671 }
3672
3673 ULONG CommonCallbacks::validateLength(Jrd::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
3674 const USHORT size)
3675 {
3676 if (length > size)
3677 {
3678 fb_assert(!charSet || (!charSet->isMultiByte() && charSet->getSpaceLength() == 1));
3679 UCHAR fillChar = charSet ?
3680 *charSet->getSpace() :
3681 (charSetId == ttype_binary ? 0x00 : ASCII_SPACE);
3682
3683 const UCHAR* p = start + size;
3684
3685 // Scan the truncated string to ensure only spaces lost
3686
3687 while (p < start + length)
3688 {
3689 if (*p++ != fillChar)
3690 {
3691 err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_string_truncation) <<
3692 Arg::Gds(isc_trunc_limits) <<
3693 Arg::Num(size) << Arg::Num(length));
3694 }
3695 }
3696 }
3697
3698 return MIN(length, size);
3699 }
3700
3701 CHARSET_ID CommonCallbacks::getChid(const dsc* d)
3702 {

Callers 2

integer_to_textFunction · 0.45
CVT_move_commonFunction · 0.45

Calls 5

GdsClass · 0.85
NumClass · 0.85
isMultiByteMethod · 0.80
getSpaceLengthMethod · 0.80
getSpaceMethod · 0.45

Tested by

no test coverage detected