[PATCH, RFC] Codecvt and _M_c_locale_codecvt

Paolo Carlini pcarlini@unitus.it
Sun Sep 8 12:09:00 GMT 2002


Hi,

as noticed by Jakub a few days ago, a wcsrtombs and a mbsrtowcs call
in src/codecvt.cc are still not wrapped in __uselocale.

In order to fix this, it seems to me that a _M_c_locale_codecvt member
must be added to the codecvt specializations.

Is this unavoidable? Then, most probably the patch may qualify only for 3.3.

I'm also unsure if the _M_c_locale_codecvt member is really necessary also
for the codecvt<_InternT, _ExternT, __enc_traits> specialization: it seems
so, however, due to the structure of codecvt_byname.

Anyway, for the time being I could only sanity-check the patch with
glibc2.2.5, since I don't have a 2.3pre installed on my system: I would
appreciate if someone could regression test it with a current 2.3.

Ciao, Paolo.

/////////

        * include/bits/codecvt.h (class codecvt<char, char, mbstate_t>,
        codecvt<wchar_t, char, mbstate_t>): Add __c_locale type
        _M_c_locale_codecvt member.
        (codecvt_byname::codecvt_byname): Initialize it.
        * config/locale/ieee_1003.1-2001/codecvt_specializations.h
        (class codecvt<_InternT, _ExternT, __enc_traits>):
        Add __c_locale type _M_c_locale_codecvt member.
        * src/codecvt.cc (codecvt<char, char, mbstate_t>::codecvt,
        codecvt<wchar_t, char, mbstate_t>::codecvt):
        Initialize _M_c_locale_codecvt.
        (codecvt<char, char, mbstate_t>::~codecvt,
        codecvt<wchar_t, char, mbstate_t>::~codecvt): Destroy locale.
        (codecvt::do_out): Switch to _M_c_locale_codecvt around
        wcsrtombs call.
        (codecvt::do_in): Ditto for mbsrtowcs call.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_codecvt
Type: application/x-java-vm
Size: 3907 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20020908/4d542980/attachment.bin>


More information about the Libstdc++ mailing list