X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTexRow.cpp;h=8586a81c41d8fbaac884176d327a02cb8a951d77;hb=8009edd3d4f3deee5ed8721113bbf31abe9e0aa6;hp=60a3539c2936de8841de1edea38a4cda22fb3074;hpb=10d7f6d479b05cf101173a8ab036676482b7c251;p=lyx.git diff --git a/src/TexRow.cpp b/src/TexRow.cpp index 60a3539c29..8586a81c41 100644 --- a/src/TexRow.cpp +++ b/src/TexRow.cpp @@ -75,7 +75,7 @@ void TexRow::RowEntryList::append(RowEntryList const & row) TexRow::TextEntry const TexRow::text_none = { -1, 0 }; -TexRow::RowEntry const TexRow::row_none = { false, TexRow::text_none }; +TexRow::RowEntry const TexRow::row_none = { false, { TexRow::text_none } }; bool TexRow::isNone(TextEntry const & t) @@ -204,15 +204,12 @@ void TexRow::append(TexRow const & texrow) bool TexRow::getIdFromRow(int row, int & id, int & pos) const { TextEntry t = text_none; - bool ret = false; if (row <= int(rowlist_.size())) while (row > 0 && isNone(t = rowlist_[row - 1].getTextEntry())) --row; - if (row > 0) - ret = true; id = t.id; pos = t.pos; - return ret; + return !isNone(t); } @@ -466,19 +463,19 @@ std::pair TexRow::rowFromCursor(Cursor const & cur) const /// docstring TexRow::asString(RowEntry const & entry) { - std::ostringstream t; + odocstringstream os; if (entry.is_math) - t << "(1," << entry.math.id << "," << entry.math.cell << ")"; + os << "(1," << entry.math.id << "," << entry.math.cell << ")"; else - t << "(0," << entry.text.id << "," << entry.text.pos << ")"; - return from_utf8( t.str() ); + os << "(0," << entry.text.id << "," << entry.text.pos << ")"; + return os.str(); } ///prepends the texrow to the source given by tex, for debugging purpose void TexRow::prepend(docstring_list & tex) const { - int const prefix_length = 25; + size_type const prefix_length = 25; if (tex.size() < rowlist_.size()) tex.resize(rowlist_.size()); std::vector::const_iterator it = rowlist_.begin(); @@ -492,7 +489,7 @@ void TexRow::prepend(docstring_list & tex) const entry += asString(*it2); if (entry.length() < prefix_length) entry = entry + docstring(prefix_length - entry.length(), L' '); - int i = it - beg; + ptrdiff_t i = it - beg; tex[i] = entry + " " + tex[i]; } }