This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] Don't check for __ilen > 0 in _M_convert_to_external
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 29 May 2003 23:58:23 +0200
- Subject: [Patch] Don't check for __ilen > 0 in _M_convert_to_external
Hi,
I mean to apply the below tomorrow, if nobody complains.
Basically:
-1 All the uses of _M_convert_to_external are guaranteed __ilen > 0.
-2 If it were to happen that __ilen == 0 and always_noconv() == true
it is not ok to branch to the 'else'.
-3 xsputn(*, 0) (that is, write(*, *, 0)), in case, works perfectly ok.
Tested x86-linux.
Paolo.
//////////
2003-05-29 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (_M_convert_to_external): Don't
check for __ilen > 0.
diff -urN libstdc++-v3-orig/include/bits/fstream.tcc libstdc++-v3/include/bits/fstream.tcc
--- libstdc++-v3-orig/include/bits/fstream.tcc 2003-05-29 13:02:27.000000000 +0200
+++ libstdc++-v3/include/bits/fstream.tcc 2003-05-29 22:22:15.000000000 +0200
@@ -376,7 +376,7 @@
streamsize __elen = 0;
streamsize __plen = 0;
- if (__check_facet(_M_codecvt).always_noconv() && __ilen)
+ if (__check_facet(_M_codecvt).always_noconv())
{
__elen += _M_file.xsputn(reinterpret_cast<char*>(__ibuf), __ilen);
__plen += __ilen;