home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / g / lib / bug / 581 < prev    next >
Encoding:
Text File  |  1992-11-08  |  2.5 KB  |  97 lines

  1. Newsgroups: gnu.g++.lib.bug
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!dfv.rwth-aachen.DE!mj
  3. From: mj@dfv.rwth-aachen.DE (Martin Junius)
  4. Subject: libg++-2.2 - bug in istream: :get()/getline()
  5. Message-ID: <1992Nov6.162043.24604@dfv.rwth-aachen.de>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Communication Networks
  8. Distribution: gnu
  9. Date: Fri, 6 Nov 1992 16:20:43 GMT
  10. Approved: bug-lib-g++@prep.ai.mit.edu
  11. Lines: 84
  12.  
  13. Bugs:
  14.  
  15. - istream::getline(), istream::get() in igetline.C set 
  16.   ios::failbit when receiving an empty line as input and don't 
  17.   set ios::eofbit when EOF occurs.
  18. - streambuf::sgetline() doesn't communicate EOF from underflow() 
  19.   to it's caller.
  20.  
  21. The following patch fixes this:
  22.  
  23. *** igetline.C-ORIG    Fri Nov  6 13:44:09 1992
  24. --- igetline.C    Fri Nov  6 17:06:51 1992
  25. ***************
  26. *** 23,30 ****
  27.       if (ipfx1()) {
  28.       long count = rdbuf()->sgetline(buf, len, delim, 0);
  29.       _gcount = count;
  30. !     if (count <= 0 || count == len-1)
  31. !         set(ios::failbit);
  32.       }
  33.       return *this;
  34.   }
  35. --- 23,32 ----
  36.       if (ipfx1()) {
  37.       long count = rdbuf()->sgetline(buf, len, delim, 0);
  38.       _gcount = count;
  39. ! //    if (count <= 0 || count == len-1)
  40. ! //        set(ios::failbit);
  41. !     if (count < 0)
  42. !         set(ios::failbit|ios::eofbit);
  43.       }
  44.       return *this;
  45.   }
  46. ***************
  47. *** 34,41 ****
  48.       _gcount = 0;
  49.       if (ipfx1()) {
  50.       long count = rdbuf()->sgetline(buf, len, delim, -1);
  51. !     if (count <= 0)
  52. !         set(ios::failbit);
  53.       else
  54.           _gcount = count;
  55.       }
  56. --- 36,45 ----
  57.       _gcount = 0;
  58.       if (ipfx1()) {
  59.       long count = rdbuf()->sgetline(buf, len, delim, -1);
  60. ! //    if (count <= 0)
  61. ! //        set(ios::failbit);
  62. !         if (count < 0)
  63. !         set(ios::failbit|ios::eofbit);
  64.       else
  65.           _gcount = count;
  66.       }
  67. *** sgetline.C-ORIG    Fri Nov  6 16:42:00 1992
  68. --- sgetline.C    Fri Nov  6 16:42:47 1992
  69. ***************
  70. *** 34,40 ****
  71.       int len = egptr() - gptr();
  72.       if (len <= 0)
  73.           if (underflow() == EOF)
  74. !         break;
  75.           else
  76.           len = egptr() - gptr();
  77.       if (len >= (int)n)
  78. --- 34,43 ----
  79.       int len = egptr() - gptr();
  80.       if (len <= 0)
  81.           if (underflow() == EOF)
  82. !         {
  83. !             *ptr = 0;
  84. !             return EOF;
  85. !         }
  86.           else
  87.           len = egptr() - gptr();
  88.       if (len >= (int)n)
  89.  
  90. Martin
  91. -- 
  92.  _____ _____
  93. |     |___  |   Martin Junius           FIDO:      2:242/6.1
  94. | | | |   | |   Communication Networks  Internet:  mj@dfv.rwth-aachen.de
  95. |_|_|_|@work|   Aachen U of Technology  Phone:     ++49-241-8790220 (voice)
  96.  
  97.