home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / g / lib / bug / 806 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.8 KB  |  81 lines

  1. Path: sparky!uunet!stanford.edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cygnus.com!bothner
  2. From: bothner@cygnus.com
  3. Newsgroups: gnu.g++.lib.bug
  4. Subject: Re: 2.3: ostrstream and freeze
  5. Date: 26 Jan 1993 21:47:12 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 67
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-lib-g++@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301260718.AA07832@cygnus.com>
  12. References: <9301250337.AA08048@cs.rice.edu>
  13.  
  14. > Unfreezing a previously frozen (with str) ostrstream, when that
  15. > ostrstream has a fixed, user-supplied buffer,
  16.  
  17. Well, you can't unfreeze an ostrstream with a fixed user-supplied
  18. buffer.  In this case the freeze(0) should be ignored.
  19. Patches to do so are appended below.
  20.  
  21.     --Per Bothner
  22. Cygnus Support     bothner@cygnus.com
  23.  
  24. ===================================================================
  25. RCS file: /rel/cvsfiles/devo/libg++/iostream/strstream.h,v
  26. retrieving revision 1.10
  27. diff -c -r1.10 strstream.h
  28. *** 1.10    1992/11/03 06:30:01
  29. --- strstream.h    1993/01/26 03:01:10
  30. ***************
  31. *** 33,38 ****
  32. --- 33,39 ----
  33.       void init_const() { xsetflags(_S_NO_WRITES); }
  34.       void init_static(char *ptr, int size, char *pstart);
  35.     protected:
  36. +     int is_static() const { return _allocate_buffer == (_alloc_type)0; }
  37.       virtual int overflow(int = EOF);
  38.       virtual int underflow();
  39.       virtual int pbackfail(int c);
  40. ***************
  41. *** 56,64 ****
  42.       strstreambuf(const signed char *ptr, int size)
  43.       { init_static((char*)ptr, size, NULL); init_const(); }
  44.   #endif
  45.       int frozen() { return _flags & _S_USER_BUF ? 1 : 0; }
  46.       void freeze(int n=1)
  47. !     { if (n) _flags |= _S_USER_BUF; else _flags &= ~_S_USER_BUF; }
  48.       _G_size_t pcount();
  49.       char *str();
  50.       virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
  51. --- 57,67 ----
  52.       strstreambuf(const signed char *ptr, int size)
  53.       { init_static((char*)ptr, size, NULL); init_const(); }
  54.   #endif
  55. +     // Note: frozen() is always true if is_static().
  56.       int frozen() { return _flags & _S_USER_BUF ? 1 : 0; }
  57.       void freeze(int n=1)
  58. !     { if (!is_static())
  59. !         { if (n) _flags |= _S_USER_BUF; else _flags &= ~_S_USER_BUF; } }
  60.       _G_size_t pcount();
  61.       char *str();
  62.       virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
  63. ===================================================================
  64. RCS file: /rel/cvsfiles/devo/libg++/iostream/strstream.C,v
  65. retrieving revision 1.15
  66. diff -c -r1.15 strstream.C
  67. *** 1.15    1992/10/17 00:26:47
  68. --- strstream.C    1993/01/26 02:59:57
  69. ***************
  70. *** 182,189 ****
  71.   streampos strstreambuf::seekoff(streamoff off, _seek_dir dir,
  72.                       int mode /*=ios::in|ios::out*/)
  73.   {
  74. -     _allocate_buffer = default_alloc;
  75. -     _free_buffer = default_free;
  76.       size_t cur_size = pcount();
  77.       streampos new_pos = EOF;
  78.   
  79. --- 182,187 ----
  80.  
  81.