Are there any point in doing patches like this one? If so we should hunt for and kill over use of functions like this.
? src/frontends/xforms/lyx_forms.h ? src/frontends/xforms/lyx_xpm.h Index: src/rowpainter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.18 diff -u -p -r1.18 rowpainter.C --- src/rowpainter.C 30 May 2003 06:48:20 -0000 1.18 +++ src/rowpainter.C 18 Jun 2003 14:36:37 -0000 @@ -452,8 +452,10 @@ void RowPainter::paintDepthBar() if (row_ != text_.rows().begin()) prev_depth = boost::prior(row_)->par()->getDepth(); Paragraph::depth_type next_depth = 0; - if (boost::next(row_) != text_.rows().end()) - next_depth = boost::next(row_)->par()->getDepth(); + + RowList::iterator next_row = boost::next(row_); + if (next_row != text_.rows().end()) + next_depth = next_row->par()->getDepth(); for (Paragraph::depth_type i = 1; i <= depth; ++i) { int x = (PAPER_MARGIN / 5) * i + xo_; Index: src/text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.367 diff -u -p -r1.367 text.C --- src/text.C 12 Jun 2003 11:09:53 -0000 1.367 +++ src/text.C 18 Jun 2003 14:36:38 -0000 @@ -1731,9 +1731,10 @@ void LyXText::insertChar(char c) false, cursor.boundary()); // cursor MUST be in row now. - if (boost::next(row) != rows().end() && - boost::next(row)->par() == row->par()) - need_break_row = boost::next(row); + RowList::iterator next_row = boost::next(row); + if (next_row != rows().end() && + next_row->par() == row->par()) + need_break_row = next_row; else need_break_row = rows().end(); @@ -1757,13 +1758,18 @@ void LyXText::insertChar(char c) if (c == Paragraph::META_INSET || row->fill() < 0) { postPaint(y); breakAgainOneRow(row); + + RowList::iterator next_row = boost::next(row); + // will the cursor be in another row now? if (lastPos(*this, row) <= cursor.pos() + 1 && - boost::next(row) != rows().end()) { - if (boost::next(row) != rows().end() && - boost::next(row)->par() == row->par()) + next_row != rows().end()) { + if (next_row != rows().end() && + next_row->par() == row->par()) { // this should always be true ++row; + } + breakAgainOneRow(row); } current_font = rawtmpfont; @@ -1775,9 +1781,12 @@ void LyXText::insertChar(char c) != cursor.boundary()) setCursor(cursor.par(), cursor.pos(), false, !cursor.boundary()); - if (boost::next(row) != rows().end() && - boost::next(row)->par() == row->par()) - need_break_row = boost::next(row); + + next_row = boost::next(row); + + if (next_row != rows().end() && + next_row->par() == row->par()) + need_break_row = next_row; else need_break_row = rows().end(); } else { Index: src/text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.371 diff -u -p -r1.371 text2.C --- src/text2.C 17 Jun 2003 15:33:46 -0000 1.371 +++ src/text2.C 18 Jun 2003 14:36:39 -0000 @@ -1243,14 +1243,16 @@ void LyXText::updateCounters() // CHECK if this is really needed. (Lgb) bv()->buffer()->params.getLyXTextClass().counters().reset(); - for (; pit != ownerParagraphs().end(); ++pit) { + ParagraphList::iterator beg = ownerParagraphs().begin(); + ParagraphList::iterator end = ownerParagraphs().end(); + for (; pit != end; ++pit) { while (rowit->par() != pit) ++rowit; string const oldLabel = pit->params().labelString(); size_t maxdepth = 0; - if (pit != ownerParagraphs().begin()) + if (pit != beg) maxdepth = boost::prior(pit)->getMaxDepthAfter(); if (pit->params().depth() > maxdepth) @@ -1458,7 +1460,9 @@ void LyXText::replaceSelectionWithString selection.start.pos()); // Insert the new string - for (string::const_iterator cit = str.begin(); cit != str.end(); ++cit) { + string::const_iterator cit = str.begin(); + string::const_iterator end = str.end(); + for (; cit != end; ++cit) { selection.end.par()->insertChar(pos, (*cit), font); ++pos; } @@ -1498,7 +1502,9 @@ void LyXText::insertStringAsParagraphs(s { string linestr(str); bool newline_inserted = false; - for (string::size_type i = 0; i < linestr.length(); ++i) { + string::size_type const siz = linestr.length(); + + for (string::size_type i = 0; i < siz; ++i) { if (linestr[i] == '\n') { if (newline_inserted) { // we know that \r will be ignored by Index: src/text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.81 diff -u -p -r1.81 text3.C --- src/text3.C 17 Jun 2003 15:33:47 -0000 1.81 +++ src/text3.C 18 Jun 2003 14:36:39 -0000 @@ -343,10 +343,11 @@ void LyXText::cursorNext() } } bv()->screen().draw(bv()->text, bv(), new_y); - if (boost::next(cursor.row()) != rows().end()) { + + RowList::iterator next_row = boost::next(cursor.row()); + if (next_row != rows().end()) { LyXCursor cur; - setCursor(cur, boost::next(cursor.row())->par(), - boost::next(cursor.row())->pos(), false); + setCursor(cur, next_row->par(), next_row->pos(), false); if (cur.y() < top_y() + bv()->workHeight()) { cursorDown(true); }
-- Lgb