Re: Patch: Fix for Bug 1164, 2nd try


Subject: Re: Patch: Fix for Bug 1164, 2nd try
From: ha shao (hashao@chinese.com)
Date: Tue May 22 2001 - 01:55:10 CDT


On Tue, May 22, 2001 at 12:52:30PM +0500, hvv@hippo.ru wrote:
> On Tue, 22 May 2001, ha shao wrote:
> The code in AW 0.7.14 is
> if (no_convert==0 && ch<=0xff)
> {
> wchar_t wc;
> if (m_mbtowc.mbtowc(wc,(UT_Byte)ch))
> return AddChar(wc);
> } else
> return AddChar(ch);
>
> I don't see how 'else' can reset buffer (AddChar(ch) doesn't reset it
> either). Or did RTF importer change there since 0.7.14?
>

Yes, the current cvs read:
=================================================================
                                if (no_convert==0 && ch<=0xff)
                                {
                                        wchar_t wc;
                                        // TODO Doesn't handle multibyte encodings (
CJK)
                                        if (m_mbtowc.mbtowc(wc,(UT_Byte)ch))
                                                return AddChar(wc);
                                        else
                                                m_mbtowc.initialize();
                                } else
                                        return AddChar(ch);
                        }
==================================================================

> > Beside, since the AddChar(ch) does not actually insert the
> > character into the document (as suggested in its definition),
> > can we just add the mb into a buffer and call m_mbtowc.mbtowc()
> > at the beginning of FlushStoredChars?
>
> I think it would be troublesome. Is there are any reasons why the way you
> propose may be better than current implementation (besides performance)?
>

yes, performance, and maybe safer. anyway, it is a mirror point.

-- 
Best regard
hashao



This archive was generated by hypermail 2b25 : Sat May 26 2001 - 03:51:06 CDT