Re: Patch: add conversion from pg_wchar to multibyte
От | Alexander Korotkov |
---|---|
Тема | Re: Patch: add conversion from pg_wchar to multibyte |
Дата | |
Msg-id | CAPpHfdv8_fa6FCCe_sHndDaAcdA6R28tO-A7PQJSC2joizHmpA@mail.gmail.com обсуждение исходный текст |
Ответ на | Patch: add conversion from pg_wchar to multibyte (Alexander Korotkov <aekorotkov@gmail.com>) |
Ответы |
Re: Patch: add conversion from pg_wchar to multibyte
|
Список | pgsql-hackers |
Hello, Ishii-san!
We've talked on PGCon that I've questions about mule to wchar conversion. My questions about pg_mule2wchar_with_len function are following. In these parts of code:
we skip first character of original string. Are we able to restore it back from pg_wchar?
------
With best regards,
Alexander Korotkov.
else if (IS_LCPRV1(*from) && len >= 3)
{
from++;
*to = *from++ << 16;
*to |= *from++;
len -= 3;
}
and
else if (IS_LCPRV2(*from) && len >= 4)
{
from++;
*to = *from++ << 16;
*to |= *from++ << 8;
*to |= *from++;
len -= 4;
}
Also in this part of code we're shifting first byte by 16 bits:
if (IS_LC1(*from) && len >= 2)
{
*to = *from++ << 16;
*to |= *from++;
len -= 2;
}
else if (IS_LCPRV1(*from) && len >= 3)
{
from++;
*to = *from++ << 16;
*to |= *from++;
len -= 3;
}
Why don't we shift it by 8 bits?
You can see my patch in this thread where I propose purely mechanical changes in this function which make inverse conversion possible.
With best regards,
Alexander Korotkov.
В списке pgsql-hackers по дате отправления: