8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:43:03 +01:00

Fixed CORE-2359 - Logical multibyte maximum string length is not respected when assigning numbers

This commit is contained in:
asfernandes 2009-03-30 15:23:16 +00:00
parent 1ac21e7783
commit c8c61879f7

View File

@ -379,6 +379,7 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
}
UCHAR* q = (to->dsc_dtype == dtype_varying) ? to->dsc_address + sizeof(USHORT) : to->dsc_address;
const UCHAR* start = q;
/* If negative, put in minus sign */
@ -389,10 +390,13 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
copy number */
if (scale >= 0)
{
do {
*q++ = *--p;
} while (--l);
else {
}
else
{
l += scale; /* l > 0 (see postassertion: l+scale > 0 above) */
do {
*q++ = *--p;
@ -403,12 +407,16 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
} while (++scale);
}
cb->validateLength(cb->getToCharset(to->getCharSet()), length, start, TEXT_LEN(to), cb->err);
/* If padding is required, do it now. */
if (pad_count)
{
do {
*q++ = '0';
} while (--pad_count);
}
/* Finish up by padding (if fixed) or computing the actual length
(varying string) */