Commit dbd4fe12 authored by Dick Hollenbeck's avatar Dick Hollenbeck

STRING_LINE_READER::ReadLine() has been broken for a few weeks, since changing...

STRING_LINE_READER::ReadLine() has been broken for a few weeks, since changing the purpose of member 'source'
parent 27a02d32
...@@ -119,7 +119,7 @@ unsigned FILE_LINE_READER::ReadLine() throw (IOError) ...@@ -119,7 +119,7 @@ unsigned FILE_LINE_READER::ReadLine() throw (IOError)
unsigned STRING_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 ) if( nlOffset == std::string::npos )
length = lines.length() - ndx; length = lines.length() - ndx;
...@@ -131,13 +131,12 @@ unsigned STRING_LINE_READER::ReadLine() throw (IOError) ...@@ -131,13 +131,12 @@ unsigned STRING_LINE_READER::ReadLine() throw (IOError)
if( length >= maxLineLength ) if( length >= maxLineLength )
throw IOError( _("Line length exceeded") ); throw IOError( _("Line length exceeded") );
if( length+1 > capacity ) if( length+1 > capacity ) // +1 for terminating nul
expandCapacity( length+1 ); expandCapacity( length+1 );
wxASSERT( ndx + length <= lines.length() ); wxASSERT( ndx + length <= lines.length() );
memcpy( line, &source[ndx], length ); memcpy( line, &lines[ndx], length );
line[length] = 0;
++lineNum; ++lineNum;
ndx += length; ndx += length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment