X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2970ae54d3ac3989cd47180229bc7d6cc0f65f51..4f1cf94b942cbf62616a8a1a066b1a13ff6af792:/src/common/dcbase.cpp diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 249af182a6..67f907abca 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 @@ -2303,7 +2302,7 @@ void wxDCBase::DrawLabel(const wxString& text, wxString curLine; for ( wxString::const_iterator pc = text.begin(); ; ++pc ) { - if ( *pc == _T('\n') || pc == text.end() ) + if ( pc == text.end() || *pc == _T('\n') ) { int xRealStart = x; // init it here to avoid compielr warnings