From a1e1ec76058dfe6d995555ce8f6633882e99e84d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 20 Apr 2016 18:40:02 +0100 Subject: [PATCH] Fix std::codecvt_utf8* for big-endian targets PR libstdc++/69703 * src/c++11/codecvt.cc (__codecvt_utf8_base::do_in, __codecvt_utf8_utf16_base::do_in): Fix mask operations. From-SVN: r235293 --- libstdc++-v3/ChangeLog | 8 +++++++- libstdc++-v3/src/c++11/codecvt.cc | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6eed9a32315..e6934a5972e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,7 +1,13 @@ +2016-04-20 Jonathan Wakely + + PR libstdc++/69703 + * src/c++11/codecvt.cc (__codecvt_utf8_base::do_in, + __codecvt_utf8_utf16_base::do_in): Fix mask operations. + 2016-04-19 Jonathan Wakely PR libstdc++/69703 - * src/c++11/codecvt.cc (__codecvt_utf8_base::do_in)): + * src/c++11/codecvt.cc (__codecvt_utf8_base::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 diff --git a/libstdc++-v3/src/c++11/codecvt.cc b/libstdc++-v3/src/c++11/codecvt.cc index b6b63584fbe..b60691cf2a6 100644 --- a/libstdc++-v3/src/c++11/codecvt.cc +++ b/libstdc++-v3/src/c++11/codecvt.cc @@ -789,7 +789,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end, { range from{ __from, __from_end }; range 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 from{ __from, __from_end }; range 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