This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, RFC] Codecvt and _M_c_locale_codecvt


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.


Attachment: patch_codecvt
Description: application/java-vm


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]