Article View: gnu.g++.lib.bug
Article #113Bug in istream::get
From: Doug Lea
Date: Sun, 06 Aug 1989 11:31
Date: Sun, 06 Aug 1989 11:31
77 lines
2012 bytes
2012 bytes
Oops. Your interpretation of Stroustrup looks correct. Here are the fixes.
(The same counting errors occurred in a couple of places)
g.oswego.edu% cd libg++/src
g.oswego.edu% diff -rc2N stream.cc~ stream.cc
*** stream.cc~ Sun Jul 16 09:26:11 1989
--- stream.cc Sun Aug 6 07:15:24 1989
***************
*** 321,325 ****
char ch = 0;
! if (n > 0 && get(ch))
{
if (ch == terminator)
--- 321,325 ----
char ch = 0;
! if (--n > 0 && get(ch))
{
if (ch == terminator)
***************
*** 328,332 ****
{
*s++ = ch; --n;
! while (n-- >= 0 && get(ch))
{
if (ch == terminator)
--- 328,332 ----
{
*s++ = ch; --n;
! while (n-- > 0 && get(ch))
{
if (ch == terminator)
***************
*** 387,391 ****
char ch;
! while (--n >= 0 && get(ch) && ((*s++ = ch) != terminator));
*s = 0;
--- 387,391 ----
char ch;
! while (--n > 0 && get(ch) && ((*s++ = ch) != terminator));
*s = 0;
g.oswego.edu% diff -rc2N File.cc~ File.cc
*** File.cc~ Thu Jul 20 09:57:26 1989
--- File.cc Sun Aug 6 07:15:23 1989
***************
*** 379,383 ****
char ch;
! stat = n;
if (n > 0 && (get(ch)))
--- 379,383 ----
char ch;
! stat = --n;
if (n > 0 && (get(ch)))
***************
*** 418,422 ****
char ch;
! stat = n;
while (n > 0 && (get(ch)))
--- 418,422 ----
char ch;
! stat = --n;
while (n > 0 && (get(ch)))
g.oswego.edu%
Technical Details
Message-ID:
<8908061131.AA01681@g.oswego.edu.Oswego.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!G.OSWEGO.EDU!dlReferences:
<8908051856.AA21241@AENEAS.MIT.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!G.OSWEGO.EDU!dl From: dl@G.OSWEGO.EDU (Doug Lea) Newsgroups: gnu.g++.lib.bug Subject: Bug in istream::get Message-ID: <8908061131.AA01681@g.oswego.edu.Oswego.EDU> Date: 6 Aug 89 11:31:00 GMT References: <8908051856.AA21241@AENEAS.MIT.EDU> Sender: daemon@tut.cis.ohio-state.edu Reply-To: dl@oswego.oswego.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 77