X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f7b64fde9be7403bbae90ed6d141bfe2ba245c87..76b0f8384ed211c5f6b48597a62da743b604e666:/src/html/m_pre.cpp diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index c69db2129d..cc0664f86a 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -2,7 +2,6 @@ // Name: src/html/m_pre.cpp // Purpose: wxHtml module for
...tag (code citation) // Author: Vaclav Slavik -// RCS-ID: $Id$ // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,25 +32,42 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str) wxString out; out.reserve(str.length()); // we'll certainly need at least that - for ( wxString::const_iterator i = str.begin(); i != str.end(); ++i ) + const wxString::const_iterator end = str.end(); + for ( wxString::const_iterator i = str.begin(); i != end; ++i ) { switch ( (*i).GetValue() ) { case '<': - while ( i != str.end() && *i != '>') + while ( i != end && *i != '>' ) { out << *i++; } out << '>'; + if ( i == end ) + return out; break; + + // We need to translate any line break into exactly one