This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] codecvt<wchar_t, char, mbstate_t> support for UTF-8, take 2


Hi again,

This patch adds support for UTF-8 locales to
codecvt<wchar_t, char, mbstate_t>::do_encoding, do_in, and do_max_length.

do_in now performs the conversion with mbrtowc. This is of course not
thread-safe (except in the gnu version) and is probably not very efficient
either (equivalent of a virtual function call for each character converted)
but seems to be the only way to implement this as the input sequence for
do_in is in general not zero-terminated.

Any comments?

Petur


2003-01-28  Petur Runolfsson  <peturr02@ru.is>

	* src/codecvt.cc
	(codecvt<wchar_t, char, mbstate_t>::do_encoding, do_max_length):
	Use MB_CUR_MAX and move...
	* config/locale/generic/codecvt_members.cc:  ...here.
	* config/locale/gnu/codecvt_members.cc:  ...and here.
	* config/locale/generic/codecvt_members.cc,
	* config/locale/gnu/codecvt_members.cc
	(codecvt<wchar_t, char, mbstate_t>::do_in):  Perform
	conversion with mbrtowc and an explicit loop rather than
	mbsrtowcs.
	* testsuite/22_locale/codecvt/encoding/wchar_t/1.cc:
	Cleanup and check for correct return value from encoding
	for "C" locale.
	* testsuite/22_locale/codecvt/encoding/wchar_t/2.cc:  New test.
	* testsuite/22_locale/codecvt/encoding/wchar_t/3.cc:  New test.
	* testsuite/22_locale/codecvt/encoding/wchar_t/4.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/1.cc:  Cleanup.
	* testsuite/22_locale/codecvt/in/wchar_t/2.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/3.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/4.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/5.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/6.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/7.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/8.cc:  New test.
	* testsuite/22_locale/codecvt/in/wchar_t/9.cc:  New test.
	* testsuite/22_locale/codecvt/max_length/wchar_t/1.cc:  Cleanup.
	* testsuite/22_locale/codecvt/max_length/wchar_t/2.cc:  New test.
	* testsuite/22_locale/codecvt/max_length/wchar_t/3.cc:  New test.
	* testsuite/22_locale/codecvt/max_length/wchar_t/4.cc:  New test.

Attachment: codecvt2.diff.gz
Description: codecvt2.diff.gz


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