Hi all,

I've recently compiled LyX with latest version of GCC and used several useful diagnostic options. Two simpler patches are already committed, but the third one is bigger and worth additional checkup -- it is in attachment.

Best Regards,
Yuriy
From 6e2fb6f86550186881838f7020a1535e4fdffbb7 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Tue, 28 Sep 2021 20:13:42 +0300
Subject: [PATCH] Remove useless casts reported by GCC with -Wuseless-cast
 option

---
 src/BiblioInfo.cpp                    |  2 +-
 src/Buffer.cpp                        |  2 +-
 src/Converter.cpp                     |  2 +-
 src/KeyMap.cpp                        |  2 +-
 src/LaTeX.cpp                         |  2 +-
 src/ParIterator.cpp                   |  6 +++---
 src/frontends/qt/ColorCache.cpp       |  2 +-
 src/frontends/qt/GuiBibtex.cpp        |  2 +-
 src/frontends/qt/GuiBox.cpp           |  2 +-
 src/frontends/qt/GuiCitation.cpp      |  4 ++--
 src/frontends/qt/GuiDocument.cpp      |  6 +++---
 src/frontends/qt/GuiExternal.cpp      |  2 +-
 src/frontends/qt/GuiMathMatrix.cpp    |  4 ++--
 src/frontends/qt/GuiPrefs.cpp         | 12 ++++++------
 src/frontends/qt/GuiSendto.cpp        |  2 +-
 src/frontends/qt/GuiView.cpp          |  4 ++--
 src/frontends/qt/Menus.cpp            |  6 ++----
 src/frontends/qt/TocModel.cpp         |  2 +-
 src/frontends/qt/TocWidget.cpp        |  2 +-
 src/insets/InsetGraphics.cpp          |  2 +-
 src/insets/InsetIPAMacro.cpp          |  4 ++--
 src/insets/InsetTabular.cpp           | 16 ++++++++--------
 src/mathed/InsetMathMacroTemplate.cpp |  2 +-
 23 files changed, 44 insertions(+), 46 deletions(-)

diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 85c3e884d9..638579a752 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -1402,7 +1402,7 @@ docstring const BiblioInfo::getInfo(docstring const & key,
 {
        BiblioInfo::const_iterator it = find(key);
        if (it == end())
-               return docstring(_("Bibliography entry not found!"));
+               return _("Bibliography entry not found!");
        BibTeXInfo const & data = it->second;
        BibTeXInfoList xrefptrs;
        for (docstring const & xref : getXRefs(data)) {
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 457aa43225..a713f8dd55 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3827,7 +3827,7 @@ void Buffer::Impl::updateMacros(DocIterator & it, 
DocIterator & scope)
                        // FIXME (Abdel), I don't understand why we pass 'it' 
here
                        // instead of 'macroTemplate' defined above... is this 
correct?
                        macros[macroTemplate.name()][it] =
-                               Impl::ScopeMacro(scope, 
MacroData(const_cast<Buffer *>(owner_), it));
+                               Impl::ScopeMacro(scope, MacroData(owner_, it));
                }
 
                // next paragraph
diff --git a/src/Converter.cpp b/src/Converter.cpp
index b4340c8f52..4e9a2ad426 100644
--- a/src/Converter.cpp
+++ b/src/Converter.cpp
@@ -853,7 +853,7 @@ Converters::RetVal Converters::runLaTeX(Buffer const & 
buffer, string const & co
 
        // do the LaTeX run(s)
        string const name = buffer.latexName();
-       LaTeX latex(command, runparams, FileName(makeAbsPath(name)),
+       LaTeX latex(command, runparams, makeAbsPath(name),
                    buffer.filePath(), buffer.layoutPos(),
                    buffer.isClone(), buffer.freshStartRequired());
        TeXErrors terr;
diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index f469da5c44..6b55b8e20e 100644
--- a/src/KeyMap.cpp
+++ b/src/KeyMap.cpp
@@ -439,7 +439,7 @@ FuncRequest const & KeyMap::lookup(KeySymbol const &key,
        Table::const_iterator end = table.end();
        for (Table::const_iterator cit = table.begin(); cit != end; ++cit) {
                KeyModifier mask = cit->mod.second;
-               KeyModifier check = static_cast<KeyModifier>(mod & ~mask);
+               KeyModifier check = mod & ~mask;
 
                if (cit->code == key && cit->mod.first == check) {
                        // match found
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index 6e7fe921b8..a8d14b1f74 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -795,7 +795,7 @@ int LaTeX::scanLogFile(TeXErrors & terr)
        string tmp =
                onlyFileName(changeExtension(file.absFileName(), ".log"));
        LYXERR(Debug::LATEX, "Log file: " << tmp);
-       FileName const fn = FileName(makeAbsPath(tmp));
+       FileName const fn = makeAbsPath(tmp);
        // FIXME we should use an ifdocstream here and a docstring for token
        // below. The encoding of the log file depends on the _output_ (font)
        // encoding of the TeX file (T1, TU etc.). See #10728.
diff --git a/src/ParIterator.cpp b/src/ParIterator.cpp
index 7289889360..10de5f312d 100644
--- a/src/ParIterator.cpp
+++ b/src/ParIterator.cpp
@@ -69,7 +69,7 @@ ParIterator & ParIterator::operator--()
 
 Paragraph & ParIterator::operator*() const
 {
-       return const_cast<Paragraph&>(text()->getPar(pit()));
+       return text()->getPar(pit());
 }
 
 
@@ -81,7 +81,7 @@ pit_type ParIterator::pit() const
 
 Paragraph * ParIterator::operator->() const
 {
-       return const_cast<Paragraph*>(&text()->getPar(pit()));
+       return &text()->getPar(pit());
 }
 
 
@@ -93,7 +93,7 @@ pit_type ParIterator::outerPar() const
 
 ParagraphList & ParIterator::plist() const
 {
-       return const_cast<ParagraphList&>(text()->paragraphs());
+       return text()->paragraphs();
 }
 
 
diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index 822f44a9d1..821494edc1 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -23,7 +23,7 @@ namespace{
 
 QPalette::ColorRole role(ColorCode col)
 {
-       switch (ColorCode(col)) {
+       switch (col) {
        case Color_background:
        case Color_commentbg:
        case Color_greyedoutbg:
diff --git a/src/frontends/qt/GuiBibtex.cpp b/src/frontends/qt/GuiBibtex.cpp
index 64bb987137..3e4459e5bc 100644
--- a/src/frontends/qt/GuiBibtex.cpp
+++ b/src/frontends/qt/GuiBibtex.cpp
@@ -526,7 +526,7 @@ void GuiBibtex::setFileEncodings(vector<docstring> const & 
m)
                QModelIndexList qmil =
                                selected_model_.match(selected_model_.index(0, 
0),
                                                     Qt::DisplayRole, 
toqstr(key), 1,
-                                                    
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchWrap));
+                                                    Qt::MatchExactly | 
Qt::MatchWrap);
                if (!qmil.empty()) {
                        QComboBox * cb = 
qobject_cast<QComboBox*>(selectedLV->indexWidget(selected_model_.index(qmil.front().row(),
 1)));
                        cb->setCurrentIndex(cb->findData(enc));
diff --git a/src/frontends/qt/GuiBox.cpp b/src/frontends/qt/GuiBox.cpp
index 0d22aa7963..ddd577534e 100644
--- a/src/frontends/qt/GuiBox.cpp
+++ b/src/frontends/qt/GuiBox.cpp
@@ -172,7 +172,7 @@ void GuiBox::fillComboColor(QComboBox * combo, bool const 
is_none)
        for (; cit != color_codes_.end(); ++cit) {
                QString const latexname = toqstr(lcolor.getLaTeXName(*cit));
                QString const guiname = 
toqstr(translateIfPossible(lcolor.getGUIName(*cit)));
-               color = QColor(guiApp->colorCache().get(*cit, false));
+               color = guiApp->colorCache().get(*cit, false);
                coloritem.fill(color);
                combo->addItem(QIcon(coloritem), guiname, latexname);
        }
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index 4b5548803b..1b1fa412c4 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -704,7 +704,7 @@ void GuiCitation::setPreTexts(vector<docstring> const & m)
                QModelIndexList qmil =
                        selected_model_.match(selected_model_.index(0, 1),
                                             Qt::DisplayRole, toqstr(key), -1,
-                                            Qt::MatchFlags(Qt::MatchExactly | 
Qt::MatchWrap));
+                                            Qt::MatchExactly | Qt::MatchWrap);
                for (auto const & idx : qmil) {
                        if (!handled.contains(idx)) {
                                selected_model_.setItem(idx.row(), 0, si);
@@ -742,7 +742,7 @@ void GuiCitation::setPostTexts(vector<docstring> const & m)
                QModelIndexList qmil =
                        selected_model_.match(selected_model_.index(0, 1),
                                             Qt::DisplayRole, toqstr(key), -1,
-                                            Qt::MatchFlags(Qt::MatchExactly | 
Qt::MatchWrap));
+                                            Qt::MatchExactly | Qt::MatchWrap);
                for (auto const & idx : qmil) {
                        if (!handled.contains(idx)) {
                                selected_model_.setItem(idx.row(), 2, si);
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 40d7bc0bc2..9389272335 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -1029,7 +1029,7 @@ GuiDocument::GuiDocument(GuiView & lv)
                if (encvar.unsafe() ||encvar.guiName().empty()
                    || utf8_base_encodings.contains(toqstr(encvar.name())))
                        continue;
-               if (std::string(encvar.name()).find("utf8") == 0)
+               if (encvar.name().find("utf8") == 0)
                        encodingmap_utf8.insert(qt_(encvar.guiName()), 
toqstr(encvar.name()));
                else
                        encodingmap.insert(qt_(encvar.guiName()), 
toqstr(encvar.name()));
@@ -5165,7 +5165,7 @@ GuiDocument::modInfoStruct GuiDocument::modInfo(LyXModule 
const & mod)
        QString const guiname = 
toqstr(translateIfPossible(from_utf8(mod.getName())));
        m.missingreqs = !isModuleAvailable(mod.getID());
        if (m.missingreqs) {
-               m.name = QString(qt_("%1 (missing req.)")).arg(guiname);
+               m.name = qt_("%1 (missing req.)").arg(guiname);
        } else
                m.name = guiname;
        m.category = mod.category().empty() ? qt_("Miscellaneous")
@@ -5178,7 +5178,7 @@ GuiDocument::modInfoStruct GuiDocument::modInfo(LyXModule 
const & mod)
                desc.truncate(pos);
        m.local = mod.isLocal();
        QString const mtype = m.local ? qt_("personal module") : 
qt_("distributed module");
-       QString modulename = QString(qt_("<b>Module name:</b> <i>%1</i> 
(%2)")).arg(toqstr(m.id)).arg(mtype);
+       QString modulename = qt_("<b>Module name:</b> <i>%1</i> 
(%2)").arg(toqstr(m.id)).arg(mtype);
        // Tooltip is the desc followed by the module name and the type
        m.description = QString("%1%2")
                .arg(desc.isEmpty() ? QString() : 
QString("<p>%1</p>").arg(desc),
diff --git a/src/frontends/qt/GuiExternal.cpp b/src/frontends/qt/GuiExternal.cpp
index 62c56c982d..65fb8610a1 100644
--- a/src/frontends/qt/GuiExternal.cpp
+++ b/src/frontends/qt/GuiExternal.cpp
@@ -444,7 +444,7 @@ static void getSize(external::ResizeData & data,
                data.scale = widgetToDoubleStr(&widthED);
                data.width = Length();
        } else {
-               data.width = Length(widgetsToLength(&widthED, &widthUnitCO));
+               data.width = widgetsToLength(&widthED, &widthUnitCO);
                data.scale = string();
        }
        data.height = Length(widgetsToLength(&heightED, &heightUnitCO));
diff --git a/src/frontends/qt/GuiMathMatrix.cpp 
b/src/frontends/qt/GuiMathMatrix.cpp
index d339e2c976..db062781f0 100644
--- a/src/frontends/qt/GuiMathMatrix.cpp
+++ b/src/frontends/qt/GuiMathMatrix.cpp
@@ -101,7 +101,7 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv)
 
 void GuiMathMatrix::columnsChanged(int)
 {
-       int const nx = int(columnsSB->value());
+       int const nx = columnsSB->value();
        halignED->setText(QString(nx, 'c'));
 }
 
@@ -159,7 +159,7 @@ void GuiMathMatrix::slotOK()
                // otherwise create just a standard AMS matrix
                if (sh.contains('l') || sh.contains('r') || sh.contains('|')) {
                        string const str_ams = fromqstr(
-                               QString("%1 %2 
%3").arg(int(1)).arg(int(1)).arg(deco_name));
+                               QString("%1 %2 
%3").arg(1).arg(1).arg(deco_name));
                        dispatch(FuncRequest(LFUN_MATH_AMS_MATRIX, str_ams));
                } else {
                        string const str_ams = fromqstr(
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 7d880856cf..c0c0a54db2 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1153,7 +1153,7 @@ void PrefColors::applyRC(LyXRC & rc) const
 void PrefColors::updateRC(LyXRC const & rc)
 {
        for (size_type i = 0; i < lcolors_.size(); ++i) {
-               QColor color = QColor(guiApp->colorCache().get(lcolors_[i], 
false));
+               QColor color = guiApp->colorCache().get(lcolors_[i], false);
                QPixmap coloritem(32, 32);
                coloritem.fill(color);
                lyxObjectsLW->item(int(i))->setIcon(QIcon(coloritem));
@@ -3084,7 +3084,7 @@ QTreeWidgetItem * 
PrefShortcuts::insertShortcutItem(FuncRequest const & lfun,
        // for unbind items, try to find an existing item in the system bind 
list
        if (tag == KeyMap::UserUnbind) {
                QList<QTreeWidgetItem*> const items = 
shortcutsTW->findItems(lfun_name,
-                       Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 
0);
+                       Qt::MatchExactly | Qt::MatchRecursive, 0);
                for (auto const & item : items) {
                        if (item->text(1) == shortcut) {
                                newItem = item;
@@ -3173,7 +3173,7 @@ void PrefShortcuts::unhideEmpty(QString const & lfun, 
bool select)
 {
        // list of items that match lfun
        QList<QTreeWidgetItem*> items = shortcutsTW->findItems(lfun,
-            Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
+            Qt::MatchExactly | Qt::MatchRecursive, 0);
        for (auto const & item : items) {
                if (isAlwaysHidden(*item)) {
                        setItemType(item, KeyMap::System);
@@ -3323,9 +3323,9 @@ void PrefShortcuts::on_searchLE_textEdited()
        }
        // search both columns
        QList<QTreeWidgetItem *> matched = 
shortcutsTW->findItems(searchLE->text(),
-               Qt::MatchFlags(Qt::MatchContains | Qt::MatchRecursive), 0);
+               Qt::MatchContains | Qt::MatchRecursive, 0);
        matched += shortcutsTW->findItems(searchLE->text(),
-               Qt::MatchFlags(Qt::MatchContains | Qt::MatchRecursive), 1);
+               Qt::MatchContains | Qt::MatchRecursive, 1);
 
        // hide everyone (to avoid searching in matched QList repeatedly
        QTreeWidgetItemIterator it(shortcutsTW, 
QTreeWidgetItemIterator::Selectable);
@@ -3412,7 +3412,7 @@ bool PrefShortcuts::validateNewShortcut(FuncRequest const 
& func,
                        return false;
                QString const sequence_text = 
toqstr(k.print(KeySequence::ForGui));
                QList<QTreeWidgetItem*> items = 
shortcutsTW->findItems(sequence_text,
-                       Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 
1);
+                       Qt::MatchExactly | Qt::MatchRecursive, 1);
                deactivateShortcuts(items);
        }
        return true;
diff --git a/src/frontends/qt/GuiSendto.cpp b/src/frontends/qt/GuiSendto.cpp
index ec40ff3dcb..1f561789df 100644
--- a/src/frontends/qt/GuiSendto.cpp
+++ b/src/frontends/qt/GuiSendto.cpp
@@ -112,7 +112,7 @@ bool GuiSendTo::isValid()
 {
        int const line = formatLW->currentRow();
 
-       if (line < 0 || (line > int(formatLW->count())))
+       if (line < 0 || (line > formatLW->count()))
                return false;
 
        return (!formatLW->selectedItems().empty()
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 3a6a04c3bf..a2d20f7807 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -1184,7 +1184,7 @@ bool GuiView::prepareAllBuffersForLogout()
        // We cannot use a for loop as the buffer list cycles.
        Buffer * b = first;
        do {
-               if (!saveBufferIfNeeded(const_cast<Buffer &>(*b), false))
+               if (!saveBufferIfNeeded(*b, false))
                        return false;
                b = theBufferList().next(b);
        } while (b != first);
@@ -3173,7 +3173,7 @@ bool GuiView::exportBufferAs(Buffer & b, docstring const 
& iformat)
                return false;
 
        // fname is now the new Buffer location.
-       if (FileName(fname).exists()) {
+       if (fname.exists()) {
                docstring const file = makeDisplayPath(fname.absFileName(), 30);
                docstring text = bformat(_("The document %1$s already "
                                           "exists.\n\nDo you want to "
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 8f6464f569..2fbac3f2c5 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -1302,8 +1302,7 @@ void MenuDefinition::expandToc2(Toc const & toc_list,
                                                label += 
QString::number(++shortcut_count);
                                }
                        }
-                       add(MenuItem(MenuItem::Command, label,
-                                           FuncRequest(toc_list[i].action())));
+                       add(MenuItem(MenuItem::Command, label, 
toc_list[i].action()));
                        // separator after the menu heading
                        if (toc_list[i].depth() < depth)
                                add(MenuItem(MenuItem::Separator));
@@ -1331,8 +1330,7 @@ void MenuDefinition::expandToc2(Toc const & toc_list,
                                break;
                        }
                        if (new_pos == pos + 1) {
-                               add(MenuItem(MenuItem::Command,
-                                                   label, 
FuncRequest(toc_list[pos].action())));
+                               add(MenuItem(MenuItem::Command, label, 
toc_list[pos].action()));
                        } else {
                                MenuDefinition sub;
                                sub.expandToc2(toc_list, pos, new_pos, depth + 
1, toc_type);
diff --git a/src/frontends/qt/TocModel.cpp b/src/frontends/qt/TocModel.cpp
index 16990b8359..4638d53c21 100644
--- a/src/frontends/qt/TocModel.cpp
+++ b/src/frontends/qt/TocModel.cpp
@@ -131,7 +131,7 @@ QModelIndex TocModel::modelIndex(DocIterator const & dit) 
const
 
        QModelIndexList list = model()->match(model()->index(0, 0), 
Qt::UserRole,
                QVariant(toc_index), 1,
-               Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive));
+               Qt::MatchExactly | Qt::MatchRecursive);
 
        LASSERT(!list.isEmpty(), return QModelIndex());
        return list[0];
diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp
index 957b3a64e0..d381ea8ebb 100644
--- a/src/frontends/qt/TocWidget.cpp
+++ b/src/frontends/qt/TocWidget.cpp
@@ -524,7 +524,7 @@ void TocWidget::filterContents()
        QModelIndexList indices = tocTV->model()->match(
                tocTV->model()->index(0, 0),
                Qt::DisplayRole, "*", -1,
-               Qt::MatchFlags(Qt::MatchWildcard|Qt::MatchRecursive));
+               Qt::MatchWildcard|Qt::MatchRecursive);
 
        bool const show_active =
                activeFilterCO->currentIndex() != 2;
diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 7daa40d9aa..ef03b6ff00 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -742,7 +742,7 @@ string InsetGraphics::prepareFile(OutputParams const & 
runparams) const
 
        if (from == to) {
                // source and destination formats are the same
-               if (!runparams.nice && !FileName(temp_file).hasExtension(ext)) {
+               if (!runparams.nice && !temp_file.hasExtension(ext)) {
                        // The LaTeX compiler will not be able to determine
                        // the file format from the extension, so we must
                        // change it.
diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp
index 5d2035b559..a529d04b08 100644
--- a/src/insets/InsetIPAMacro.cpp
+++ b/src/insets/InsetIPAMacro.cpp
@@ -287,7 +287,7 @@ int InsetIPADeco::plaintext(odocstringstream & os,
                            OutputParams const & runparams, size_t max_length) 
const
 {
        odocstringstream ods;
-       int h = (int)(InsetCollapsible::plaintext(ods, runparams, max_length) / 
2);
+       int h = InsetCollapsible::plaintext(ods, runparams, max_length) / 2;
        docstring result = ods.str();
        docstring const before = result.substr(0, h);
        docstring const after = result.substr(h, result.size());
@@ -311,7 +311,7 @@ void InsetIPADeco::docbook(XMLStream & xs, OutputParams 
const & runparams) const
        // The special combining character must be put in the middle, between 
the two other characters.
        // It will not work if there is anything else than two pure characters, 
so going back to plaintext.
        odocstringstream ods;
-       int h = (int)(InsetText::plaintext(ods, runparams) / 2);
+       int h = InsetText::plaintext(ods, runparams) / 2;
        docstring result = ods.str();
        docstring const before = result.substr(0, h);
        docstring const after = result.substr(h, result.size());
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index d6d9c57013..15f1ca7dd9 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -617,7 +617,7 @@ DocIterator separatorPos(InsetTableCell const * cell, 
docstring const & align_d)
 
 InsetTableCell splitCell(InsetTableCell & head, docstring const & align_d, 
bool & hassep)
 {
-       InsetTableCell tail = InsetTableCell(head);
+       InsetTableCell tail = head;
        DocIterator const dit = separatorPos(&head, align_d);
        hassep = static_cast<bool>(dit);
        if (hassep) {
@@ -839,13 +839,13 @@ void Tabular::appendRow(row_type row)
 
 void Tabular::insertRow(row_type const row, bool copy)
 {
-       row_info.insert(row_info.begin() + row + 1, RowData(row_info[row]));
+       row_info.insert(row_info.begin() + row + 1, row_info[row]);
        cell_info.insert(cell_info.begin() + row + 1,
                cell_vector(0, CellData(buffer_)));
 
        for (col_type c = 0; c < ncols(); ++c) {
                cell_info[row + 1].insert(cell_info[row + 1].begin() + c,
-                       copy ? CellData(cell_info[row][c]) : CellData(buffer_));
+                       copy ? cell_info[row][c] : CellData(buffer_));
                if (cell_info[row][c].multirow == CELL_BEGIN_OF_MULTIROW)
                        cell_info[row + 1][c].multirow = CELL_PART_OF_MULTIROW;
        }
@@ -1002,11 +1002,11 @@ void Tabular::appendColumn(col_type col)
 void Tabular::insertColumn(col_type const col, bool copy)
 {
        bool const ct = buffer().params().track_changes;
-       column_info.insert(column_info.begin() + col + 1, 
ColumnData(column_info[col]));
+       column_info.insert(column_info.begin() + col + 1, column_info[col]);
 
        for (row_type r = 0; r < nrows(); ++r) {
                cell_info[r].insert(cell_info[r].begin() + col + 1,
-                       copy ? CellData(cell_info[r][col]) : CellData(buffer_));
+                       copy ? cell_info[r][col] : CellData(buffer_));
                if (cell_info[r][col].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
                        cell_info[r][col + 1].multicolumn = 
CELL_PART_OF_MULTICOLUMN;
        }
@@ -4525,7 +4525,7 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & 
dim) const
                        // determine horizontal offset because of decimal align 
(if necessary)
                        int decimal_width = 0;
                        if (tabular.getAlignment(cell) == LYX_ALIGN_DECIMAL) {
-                               InsetTableCell tail = 
InsetTableCell(*tabular.cellInset(cell));
+                               InsetTableCell tail = *tabular.cellInset(cell);
                                tail.setBuffer(tabular.buffer());
                                // we need to set macrocontext position 
everywhere
                                // otherwise we crash with nested insets (e.g. 
footnotes)
@@ -4778,7 +4778,7 @@ void InsetTabular::drawCellLines(PainterInfo & pi, int x, 
int y,
        Color colour = Color_tabularline;
        if (tabular.column_info[col].change.changed()
            || tabular.row_info[row].change.changed())
-               colour = 
InsetTableCell(*tabular.cellInset(cell)).paragraphs().front().lookupChange(0).color();
+               colour = 
tabular.cellInset(cell)->paragraphs().front().lookupChange(0).color();
 
        // Top
        bool drawline = tabular.topLine(cell)
@@ -6018,7 +6018,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest 
const & cmd,
                }
                // check if there is already a caption
                bool have_caption = false;
-               InsetTableCell itc = 
InsetTableCell(*tabular.cellInset(cur.idx()));
+               InsetTableCell itc = *tabular.cellInset(cur.idx());
                ParagraphList::const_iterator pit = itc.paragraphs().begin();
                ParagraphList::const_iterator pend = itc.paragraphs().end();
                for (; pit != pend; ++pit) {
diff --git a/src/mathed/InsetMathMacroTemplate.cpp 
b/src/mathed/InsetMathMacroTemplate.cpp
index 3525ba4e8c..949f161bf9 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -678,7 +678,7 @@ int InsetMathMacroTemplate::maxArgumentInDefinition() const
                if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE)
                        continue;
                InsetMathMacroArgument * arg = 
static_cast<InsetMathMacroArgument*>(it.nextInset());
-               maxArg = std::max(int(arg->number()), maxArg);
+               maxArg = std::max(arg->number(), maxArg);
        }
        return maxArg;
 }
-- 
2.28.0.windows.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to