fstream bits patch

Phil Edwards pedwards@jaj.com
Wed Jun 2 14:15:00 GMT 1999


This patches the fstream bits, mostly to shut off a bunch of warnings
at -Wall level.  The unused-variables-patch to fstream.tcc might be
disregarded if those sections are being worked on by somebody.  The
std_fstream.h patch is necessary to compile (mismatched variable names
from previous edits, I think).

Phil
(If you reply to the list, please don't cc another copy to me.  Thanks.)



1999-06-02  Phil Edwards  <pedwards@ball.com>

	* fstream.tcc:  Re-order inits to stop warnings.  Comment/move
	  unused variables to within #if 0 blocks to do the same.
	* std_fstream.h:  Fix typos (one prevents compilation).



Index: fstream.tcc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/fstream.tcc,v
retrieving revision 1.20
diff -c -3 -r1.20 fstream.tcc
*** fstream.tcc	1999/04/23 04:01:14	1.20
--- fstream.tcc	1999/06/02 21:02:19
***************
*** 40,47 ****
    template<typename _CharT, typename _Traits>
      basic_filebuf<_CharT, _Traits>::
      basic_filebuf() 
!     : __streambuf_type(), _M_state_cur(), _M_state_beg(), _M_buf(NULL),
!     _M_last_overflowed(false)
      {
        _M_buf_unified = true; // Tie input to output for basic_streambuf.
        _M_fcvt = &use_facet<__codecvt_type>(this->getloc());
--- 40,47 ----
    template<typename _CharT, typename _Traits>
      basic_filebuf<_CharT, _Traits>::
      basic_filebuf() 
!     : __streambuf_type(), _M_buf(NULL), _M_last_overflowed(false),
!       _M_state_cur(), _M_state_beg()
      {
        _M_buf_unified = true; // Tie input to output for basic_streambuf.
        _M_fcvt = &use_facet<__codecvt_type>(this->getloc());
***************
*** 453,459 ****
      xsputn(const char_type* __s, streamsize __n)
      {
        bool __testinit = _M_is_indeterminate();
!       bool __testinout = _M_mode & ios_base::in && _M_mode & ios_base::out;
        bool __testin = _M_mode & ios_base::in;
        streamsize __retval = 0;
  
--- 453,459 ----
      xsputn(const char_type* __s, streamsize __n)
      {
        bool __testinit = _M_is_indeterminate();
!       // bool __testinout = _M_mode & ios_base::in && _M_mode & ios_base::out;
        bool __testin = _M_mode & ios_base::in;
        streamsize __retval = 0;
  
***************
*** 489,498 ****
      void 
      basic_filebuf<_CharT, _Traits>::_M_output_unshift()
        {
- 	int __width = _M_fcvt->encoding();
- 
  	// XXX Not complete, or correct.
  #if 0
  	if (__width < 0)
  	  {
  	    // Part one: call codecvt::unshift
--- 489,498 ----
      void 
      basic_filebuf<_CharT, _Traits>::_M_output_unshift()
        {
  	// XXX Not complete, or correct.
  #if 0
+ 	int __width = _M_fcvt->encoding();
+ 
  	if (__width < 0)
  	  {
  	    // Part one: call codecvt::unshift
Index: std_fstream.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/std_fstream.h,v
retrieving revision 1.52
diff -c -3 -r1.52 std_fstream.h
*** std_fstream.h	1999/05/27 08:48:20	1.52
--- std_fstream.h	1999/06/02 21:02:19
***************
*** 208,214 ****
  	bool __testput = _M_out_cur && _M_out_beg < _M_out_cur;
  	if (__testput)
  	  {
! 	    // Iff _M_mode is ios_base::out ony, then need to set out
  	    // pointers to the end of the current put sequence before
  	    // we call _M_really_overflow, or else the stream will not be
  	    // flushed. Back up, so overflow doesn't append extra characters.
--- 208,214 ----
  	bool __testput = _M_out_cur && _M_out_beg < _M_out_cur;
  	if (__testput)
  	  {
! 	    // Iff _M_mode is ios_base::out only, then need to set out
  	    // pointers to the end of the current put sequence before
  	    // we call _M_really_overflow, or else the stream will not be
  	    // flushed. Back up, so overflow doesn't append extra characters.
***************
*** 308,314 ****
        
        explicit 
        basic_ofstream(const char* __s, 
! 		     ios_base::openmode __m = ios_base::out | ios_base::trunc)
        : __ios_type(new __filebuf_type()), __ostream_type()
        { this->open(__s, __mode); }
  
--- 308,314 ----
        
        explicit 
        basic_ofstream(const char* __s, 
! 		     ios_base::openmode __mode = ios_base::out | ios_base::trunc)
        : __ios_type(new __filebuf_type()), __ostream_type()
        { this->open(__s, __mode); }
  






More information about the Libstdc++ mailing list