diff options
Diffstat (limited to 'libstdc++-v3/include/bits/fstream.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/fstream.tcc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 2c591c389a2..0c6e7b04b6b 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -291,9 +291,15 @@ namespace std const char_type* __iend; __res_type __r = __cvt.out(_M_state_cur, __ibuf, __ibuf + __ilen, __iend, __buf, __buf + __blen, __bend); - // Result == ok, partial, noconv - if (__r != codecvt_base::error) + + if (__r == codecvt_base::ok || __r == codecvt_base::partial) __blen = __bend - __buf; + // Similarly to the always_noconv case above. + else if (__r == codecvt_base::noconv) + { + __buf = reinterpret_cast<char*>(__ibuf); + __blen = __ilen; + } // Result == error else __blen = 0; |