]> git.lyx.org Git - features.git/commitdiff
Initialize properly two members of InsetTabular
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 12 Sep 2015 20:54:35 +0000 (22:54 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 12 Sep 2015 20:54:35 +0000 (22:54 +0200)
Also rename first_visible_cell to first_visible_cell_. I wonder though whether this variable is still useful.

Coverity issue 23383

src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index f2f65ccddfc3df535a3ab76711ac2b54ffd10ac1..be88ad64e8882f3d97e9b840e9a4c043005cdb78 100644 (file)
@@ -3463,7 +3463,7 @@ docstring InsetTableCell::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 InsetTabular::InsetTabular(Buffer * buf, row_type rows,
                           col_type columns)
        : Inset(buf), tabular(buf, max(rows, row_type(1)), max(columns, col_type(1))),
-         rowselect_(false), colselect_(false)
+         first_visible_cell_(0), offset_valign_(0), rowselect_(false), colselect_(false)
 {
 }
 
@@ -3732,7 +3732,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
        bool const original_selection_state = pi.selected;
 
        idx_type idx = 0;
-       first_visible_cell = Tabular::npos;
+       first_visible_cell_ = Tabular::npos;
 
        int yy = y + offset_valign_;
        for (row_type r = 0; r < tabular.nrows(); ++r) {
@@ -3748,8 +3748,8 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
                                continue;
                        }
 
-                       if (first_visible_cell == Tabular::npos)
-                               first_visible_cell = idx;
+                       if (first_visible_cell_ == Tabular::npos)
+                               first_visible_cell_ = idx;
 
                        pi.selected |= isCellSelected(cur, r, c);
                        int const cx = nx + tabular.textHOffset(idx);
@@ -4254,7 +4254,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 //             int const t =   cur.bv().top_y() + cur.bv().height();
 //             if (t < yo() + tabular.getHeightOfTabular()) {
 //                     cur.bv().scrollDocView(t, true);
-//                     cur.idx() = tabular.cellBelow(first_visible_cell) + col;
+//                     cur.idx() = tabular.cellBelow(first_visible_cell_) + col;
 //             } else {
 //                     cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
 //             }
@@ -4273,7 +4273,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 //                     if (yo() > 0)
 //                             cur.idx() = col;
 //                     else
-//                             cur.idx() = tabular.cellBelow(first_visible_cell) + col;
+//                             cur.idx() = tabular.cellBelow(first_visible_cell_) + col;
 //             } else {
 //                     cur.idx() = col;
 //             }
index ce55c17708fb07575eafd11761e58eb270f0f20e..f27df2ae3a040470e06713e3facf45a0942f8ddd 100644 (file)
@@ -1032,7 +1032,7 @@ private:
                                row_type row_start, row_type row_end,
                                col_type col_start, col_type col_end) const;
        ///
-       mutable idx_type first_visible_cell;
+       mutable idx_type first_visible_cell_;
        /// The vertical offset of the table due to the vertical
        /// alignment with respect to the baseline.
        mutable int offset_valign_;