STRING_LINE_READER::ReadLine() has been broken for a few weeks, since changing the purpose of member 'source'

This commit is contained in:
Dick Hollenbeck 2010-10-21 10:49:36 -05:00
parent 27a02d3226
commit dbd4fe12be
1 changed files with 3 additions and 4 deletions

View File

@ -119,7 +119,7 @@ unsigned FILE_LINE_READER::ReadLine() throw (IOError)
unsigned STRING_LINE_READER::ReadLine() throw (IOError)
{
size_t nlOffset = lines.find( '\n', ndx );
size_t nlOffset = lines.find( '\n', ndx );
if( nlOffset == std::string::npos )
length = lines.length() - ndx;
@ -131,13 +131,12 @@ unsigned STRING_LINE_READER::ReadLine() throw (IOError)
if( length >= maxLineLength )
throw IOError( _("Line length exceeded") );
if( length+1 > capacity )
if( length+1 > capacity ) // +1 for terminating nul
expandCapacity( length+1 );
wxASSERT( ndx + length <= lines.length() );
memcpy( line, &source[ndx], length );
line[length] = 0;
memcpy( line, &lines[ndx], length );
++lineNum;
ndx += length;