This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3, committed] Fix test for synced buffers


Hi,

I have committed as obvious to trunk the below, which
fixes the recently introduced tests for synced buffers:
_M_buf_size == 0 for synced output.

Tested x86-linux.

Paolo.

//////////
2003-03-30  Paolo Carlini  <pcarlini at unitus dot it>

	* include/bits/fstream.tcc (basic_filebuf::showmanyc,
	_M_convert_to_external, _M_really_overflow, seekoff): Fix
	test for synced buffer.
	* include/std/std_fstream.h (sync): Likewise.
	* src/fstream.cc (basic_filebuf<char>::_M_underflow_common,
	basic_filebuf<wchar_t>::_M_underflow_common): Likewise.
diff -urN libstdc++-v3-orig/include/bits/fstream.tcc libstdc++-v3/include/bits/fstream.tcc
--- libstdc++-v3-orig/include/bits/fstream.tcc	2003-03-28 18:45:23.000000000 +0100
+++ libstdc++-v3/include/bits/fstream.tcc	2003-03-30 10:08:22.000000000 +0200
@@ -160,7 +160,7 @@
       const locale __loc = this->getloc();
       const __codecvt_type& __cvt = use_facet<__codecvt_type>(__loc);
       // Sync with stdio.
-      bool __sync = this->_M_buf_size == 1;
+      bool __sync = this->_M_buf_size <= 1;
 
       if (__testin && this->is_open())
 	{
@@ -285,7 +285,7 @@
       const locale __loc = this->getloc();
       const __codecvt_type& __cvt = use_facet<__codecvt_type>(__loc);
       // Sync with stdio.
-      bool __sync = this->_M_buf_size == 1;
+      bool __sync = this->_M_buf_size <= 1;
 
       if (__cvt.always_noconv() && __ilen)
 	{
@@ -358,7 +358,7 @@
       bool __testput = this->_M_out_cur && this->_M_out_beg < this->_M_out_lim;
       bool __testunbuffered = _M_file.is_open() && !this->_M_buf_size_opt;
       // Sync with stdio.
-      bool __sync = this->_M_buf_size == 1;
+      bool __sync = this->_M_buf_size <= 1;
 
       if (__testput || __testunbuffered)
 	{
@@ -448,7 +448,7 @@
       bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
       bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
       // Sync with stdio.
-      bool __sync = this->_M_buf_size == 1;
+      bool __sync = this->_M_buf_size <= 1;
       
       // Should probably do has_facet checks here.
       int __width = use_facet<__codecvt_type>(this->_M_buf_locale).encoding();
diff -urN libstdc++-v3-orig/include/std/std_fstream.h libstdc++-v3/include/std/std_fstream.h
--- libstdc++-v3-orig/include/std/std_fstream.h	2003-03-29 09:14:24.000000000 +0100
+++ libstdc++-v3/include/std/std_fstream.h	2003-03-30 10:09:17.000000000 +0200
@@ -315,7 +315,7 @@
 	bool __testput = this->_M_out_cur
 	  && this->_M_out_beg < this->_M_out_lim;
 	// Sync with stdio.
-	bool __sync = this->_M_buf_size == 1;
+	bool __sync = this->_M_buf_size <= 1;
 
 	// Make sure that the internal buffer resyncs its idea of
 	// the file position with the external file.
diff -urN libstdc++-v3-orig/src/fstream.cc libstdc++-v3/src/fstream.cc
--- libstdc++-v3-orig/src/fstream.cc	2003-03-18 00:50:40.000000000 +0100
+++ libstdc++-v3/src/fstream.cc	2003-03-30 10:07:26.000000000 +0200
@@ -44,7 +44,7 @@
       bool __testin = _M_mode & ios_base::in;
       bool __testout = _M_mode & ios_base::out;
       // Sync with stdio.
-      bool __sync = _M_buf_size == 1;
+      bool __sync = _M_buf_size <= 1;
 
       if (__testin)
 	{
@@ -126,7 +126,7 @@
       bool __testin = _M_mode & ios_base::in;
       bool __testout = _M_mode & ios_base::out;
       // Sync with stdio.
-      bool __sync = _M_buf_size == 1;
+      bool __sync = _M_buf_size <= 1;
 
       if (__testin)
 	{

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]