OSDN Git Service

2003-02-04 Jerry Quinn <jlquinn@optonline.net>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Feb 2003 20:56:50 +0000 (20:56 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Feb 2003 20:56:50 +0000 (20:56 +0000)
* include/std/std_ostream.h (ostream::_M_write): Declare.
        * ostream.tcc (ostream::_M_write): Define.
(basic_ostream::write): Use it.
(operator<<(basic_ostream, _CharT)): Ditto.
(operator<<(basic_ostream, char)): Ditto.
(operator<<(basic_ostream, _CharT*)): Ditto.
(operator<<(basic_ostream, char*)): Ditto.
(operator<<(basic_ostream, basic_string)): Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@62399 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/ostream.tcc
libstdc++-v3/include/std/std_ostream.h

index 64ba862..de954ff 100644 (file)
@@ -1,3 +1,14 @@
+2003-02-04  Jerry Quinn  <jlquinn@optonline.net>
+
+       * include/std/std_ostream.h (ostream::_M_write): Declare.       
+        * ostream.tcc (ostream::_M_write): Define.
+       (basic_ostream::write): Use it.
+       (operator<<(basic_ostream, _CharT)): Ditto.
+       (operator<<(basic_ostream, char)): Ditto.
+       (operator<<(basic_ostream, _CharT*)): Ditto.
+       (operator<<(basic_ostream, char*)): Ditto.
+       (operator<<(basic_ostream, basic_string)): Ditto.
+
 2003-02-04  Benjamin Kosnik  <bkoz@redhat.com>
 
        * testsuite/26_numerics/valarray_name_lookup.cc: Fix.
@@ -67,7 +78,8 @@
        * include/bits/valarray_before.h (_UnBase::operator[]): Apply unary
        operator.
 
-       * include/bits/valarray_before.h (__not_equal_to): Use != instead of ==.
+       * include/bits/valarray_before.h (__not_equal_to): Use != instead
+       of ==.
 
        * testsuite/26_numerics/valarray_operators.cc: New test.
 
index 30b16ca..b5b8762 100644 (file)
@@ -1,6 +1,6 @@
 // ostream classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -388,7 +388,7 @@ namespace std
          if (traits_type::eq_int_type(__put, traits_type::eof()))
            this->setstate(ios_base::badbit);
        }
-      return *this;
+      return *this;  
     }
 
   template<typename _CharT, typename _Traits>
@@ -397,11 +397,7 @@ namespace std
     {
       sentry __cerb(*this);
       if (__cerb)
-       {
-         streamsize __put = this->rdbuf()->sputn(__s, __n);
-         if ( __put != __n)
-           this->setstate(ios_base::badbit);
-       }
+       _M_write(__s, __n);
       return *this;
     }
 
@@ -488,7 +484,7 @@ namespace std
                                                 &__c, __w, __len, false);
                  __len = __w;
                }
-             __out.write(__pads, __len);
+             __out._M_write(__pads, __len);
              __out.width(0);
            }
          catch(exception& __fail)
@@ -524,7 +520,7 @@ namespace std
                                               &__c, __w, __len, false);
                  __len = __w;
                }
-             __out.write(__pads, __len);
+             __out._M_write(__pads, __len);
              __out.width(0);
            }
          catch(exception& __fail)
@@ -559,7 +555,7 @@ namespace std
                  __s = __pads;
                  __len = __w;
                }
-             __out.write(__s, __len);
+             __out._M_write(__s, __len);
              __out.width(0);
            }
          catch(exception& __fail)
@@ -608,7 +604,7 @@ namespace std
                  __str = __pads;
                  __len = __w;
                }
-             __out.write(__str, __len);
+             __out._M_write(__str, __len);
              __out.width(0);
            }
          catch(exception& __fail)
@@ -647,7 +643,7 @@ namespace std
                  __s = __pads;
                  __len = __w;
                }
-             __out.write(__s, __len);
+             __out._M_write(__s, __len);
              __out.width(0);
            }
          catch(exception& __fail)
@@ -688,10 +684,8 @@ namespace std
              __s = __pads;
              __len = __w;
            }
-         streamsize __res = __out.rdbuf()->sputn(__s, __len);
+         __out._M_write(__s, __len);
          __out.width(0);
-         if (__res != __len)
-           __out.setstate(ios_base::failbit);
        }
       return __out;
     }
index 7a55329..9d1c1f6 100644 (file)
@@ -1,6 +1,6 @@
 // Output streams -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -261,6 +261,15 @@ namespace std
       __ostream_type& 
       put(char_type __c);
 
+      // Core write functionality, without sentry.
+      void
+      _M_write(const char_type* __s, streamsize __n)
+      {
+       streamsize __put = this->rdbuf()->sputn(__s, __n);
+       if (__put != __n)
+         this->setstate(ios_base::badbit);
+      }
+
       /**
        *  @brief  Character string insertion.
        *  @param  s  The array to insert.