[Opalvoip-svn] SF.net SVN: opalvoip:[26648] ptlib/branches/v2_10/src/ptlib/common/contain. cxx
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2011-11-14 01:57:53
|
Revision: 26648 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=26648&view=rev Author: rjongbloed Date: 2011-11-14 01:57:47 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Fixed reading a PString from a line via TCP. The peek() can give phantom EOF's if the line is segmented by TCP into multiple IP packets preventing the whole line from being read. Modified Paths: -------------- ptlib/branches/v2_10/src/ptlib/common/contain.cxx Modified: ptlib/branches/v2_10/src/ptlib/common/contain.cxx =================================================================== --- ptlib/branches/v2_10/src/ptlib/common/contain.cxx 2011-11-09 12:17:34 UTC (rev 26647) +++ ptlib/branches/v2_10/src/ptlib/common/contain.cxx 2011-11-14 01:57:47 UTC (rev 26648) @@ -970,10 +970,9 @@ SetMinSize(100); char * ptr = theArray; PINDEX len = 0; - while (strm.peek() != EOF) { - if ((*ptr = (char)strm.get()) == '\n') - break; - ptr++; + int ch; + while ((ch = strm.get()) != EOF && ch != '\n') { + *ptr++ = (char)ch; len++; if (len >= GetSize()) { SetSize(len + 100); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |