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

Patch by Dmitry Kovalenko for CORE-1596

This commit is contained in:
asfernandes 2008-10-20 13:19:33 +00:00
parent d45449ef72
commit 608fa01368

View File

@ -117,19 +117,18 @@ public:
if (cnvt2)
{
ULONG len = (*cnvt1->csconvert_fn_convert)(cnvt1, srcLen, NULL, 0, NULL, &errCode, &errPos);
fb_assert(len % sizeof(USHORT) == 0);
if (len == INTL_BAD_STR_LENGTH || errCode != 0)
{
raiseError(isc_string_truncation);
}
fb_assert(len % sizeof(USHORT) == 0);
Firebird::HalfStaticArray<USHORT, BUFFER_SMALL> temp;
len = (*cnvt1->csconvert_fn_convert)(cnvt1, srcLen, src, len,
reinterpret_cast<UCHAR*>(temp.getBuffer(len / 2)), &errCode, &errPos);
fb_assert(len % sizeof(USHORT) == 0);
temp.shrink(len / 2);
if (len == INTL_BAD_STR_LENGTH)
{
@ -137,12 +136,18 @@ public:
}
if (errCode == CS_BAD_INPUT && badInputPos)
{
*badInputPos = errPos;
}
else if (errCode != 0)
{
raiseError(isc_transliteration_failed);
}
fb_assert(len % sizeof(USHORT) == 0);
temp.shrink(len / 2);
len = (*cnvt2->csconvert_fn_convert)(cnvt2, len, reinterpret_cast<const UCHAR*>(temp.begin()),
dstLen, dst, &errCode, &errPos);