OSDN Git Service

2003-02-17 Paolo Carlini <pcarlini@unitus.it>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / bits / fstream.tcc
index 2c591c3..0c6e7b0 100644 (file)
@@ -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;