You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2008/01/16 21:31:31 UTC

svn commit: r612563 - in /stdcxx/branches/4.2.x: include/ostream.cc tests/regress/27.ostream.unformatted.stdcxx-626.cpp

Author: sebor
Date: Wed Jan 16 12:31:30 2008
New Revision: 612563

URL: http://svn.apache.org/viewvc?rev=612563&view=rev
Log:
2008-01-16  Martin Sebor  <se...@roguewave.com>

	Merged rev 611016 and 611019 from trunk.

 	2008-01-10 Martin Sebor <se...@roguewave.com>

	* 27.ostream.unformatted.stdcxx-626.cpp: Added regression test
	for STDCXX-626.

	2008-01-10 Martin Sebor <se...@roguewave.com>

	STDCXX-626
	* ostream.cc (flush): Implemeneted proposed resolution of LWG
	issue 581 and reverted the resolution of issue 60 wrt ostream
	::flush().

Added:
    stdcxx/branches/4.2.x/tests/regress/27.ostream.unformatted.stdcxx-626.cpp
      - copied unchanged from r611016, incubator/stdcxx/trunk/tests/regress/27.ostream.unformatted.stdcxx-626.cpp
Modified:
    stdcxx/branches/4.2.x/include/ostream.cc

Modified: stdcxx/branches/4.2.x/include/ostream.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/ostream.cc?rev=612563&r1=612562&r2=612563&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/ostream.cc (original)
+++ stdcxx/branches/4.2.x/include/ostream.cc Wed Jan 16 12:31:30 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -35,19 +35,25 @@
 basic_ostream<_CharT, _Traits>::flush ()
 {
     if (this->rdbuf ()) {
-        _RWSTD_MT_GUARD (this->_C_bufmutex ());
 
-        int __res = 0;
+        // see LWG issue 581
 
-        _TRY {
-            __res = this->rdbuf ()->pubsync ();
-        }
-        _CATCH (...) {
-            this->setstate (ios_base::badbit | _RW::__rw_rethrow);
-        }
+        const sentry __opfx (*this);
+
+        if (__opfx) {
 
-        if (-1 == __res)
-            this->setstate (ios_base::badbit);
+            int __res = 0;
+
+            _TRY {
+                __res = this->rdbuf ()->pubsync ();
+            }
+            _CATCH (...) {
+                this->setstate (ios_base::badbit | _RW::__rw_rethrow);
+            }
+
+            if (-1 == __res)
+                this->setstate (ios_base::badbit);
+        }
     }
 
     return *this;