STRING_LINE_READER::ReadLine() has been broken for a few weeks, since changing the purpose of member 'source'
This commit is contained in:
parent
27a02d3226
commit
dbd4fe12be
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue