if ( nRead == 0 )
break;
+ // save the number characters which we already processed during the
+ // last loop iteration
+ const size_t lenOld = str.length();
+
#if wxUSE_UNICODE
// we have to properly NUL-terminate the string for any encoding it may
// use -- 4 NULs should be enough for everyone (this is why we add 4
str += strbuf;
#else // ANSI
+ wxUnusedVar(conv);
buf[nRead] = '\0';
str += buf;
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// the beginning of the current line, changes inside the loop
- const wxChar *lineStart = str.begin();
- const wxChar * const end = str.end();
- for ( const wxChar *p = lineStart; p != end; p++ )
+ wxString::const_iterator lineStart = str.begin();
+ const wxString::const_iterator end = str.end();
+ for ( wxString::const_iterator p = lineStart + lenOld; p != end; p++ )
{
const wxChar ch = *p;
switch ( ch )