Fix std::codecvt_utf8* for big-endian targets

PR libstdc++/69703
	* src/c++11/codecvt.cc (__codecvt_utf8_base<char16_t>::do_in,
	__codecvt_utf8_utf16_base<char16_t>::do_in): Fix mask operations.

From-SVN: r235293
This commit is contained in:
Jonathan Wakely 2016-04-20 18:40:02 +01:00 committed by Jonathan Wakely
parent 1011119f47
commit a1e1ec7605
2 changed files with 9 additions and 3 deletions

View File

@ -1,7 +1,13 @@
2016-04-20 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/69703
* src/c++11/codecvt.cc (__codecvt_utf8_base<char16_t>::do_in,
__codecvt_utf8_utf16_base<char16_t>::do_in): Fix mask operations.
2016-04-19 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/69703
* src/c++11/codecvt.cc (__codecvt_utf8_base<char16_t>::do_in)):
* src/c++11/codecvt.cc (__codecvt_utf8_base<char16_t>::do_in):
Override endianness bit in mode.
* testsuite/22_locale/codecvt/codecvt_utf8/69703.cc: New test.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/66855.cc: Test

View File

@ -789,7 +789,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
{
range<const char> from{ __from, __from_end };
range<char16_t> to{ __to, __to_end };
codecvt_mode mode = codecvt_mode(_M_mode | (consume_header|generate_header));
codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header));
#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
mode = codecvt_mode(mode | little_endian);
#endif
@ -1268,7 +1268,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
{
range<const char> from{ __from, __from_end };
range<char16_t> to{ __to, __to_end };
codecvt_mode mode = codecvt_mode(_M_mode | (consume_header|generate_header));
codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header));
#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
mode = codecvt_mode(mode | little_endian);
#endif