X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2970ae54d3ac3989cd47180229bc7d6cc0f65f51..e6310bbc5a3bce1033c0e579341e115be9df6fe9:/src/common/dcbase.cpp diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 249af182a6..f42c88530e 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -2172,9 +2172,9 @@ void wxDCBase::GetMultiLineTextExtent(const wxString& text, heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; wxString curLine; - for ( const wxChar *pc = text; ; pc++ ) + for ( wxString::const_iterator pc = text.begin(); ; ++pc ) { - if ( *pc == _T('\n') || *pc == _T('\0') ) + if ( pc == text.end() || *pc == _T('\n') ) { if ( curLine.empty() ) { @@ -2205,14 +2205,13 @@ void wxDCBase::GetMultiLineTextExtent(const wxString& text, heightTextTotal += heightLine; } - if ( *pc == _T('\n') ) + if ( pc == text.end() ) { - curLine.clear(); + break; } - else + else // '\n' { - // the end of string - break; + curLine.clear(); } } else