From 6cf82fbe626d61c2593d2e20c7705b2fc0a7189a Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 22 Sep 2016 16:35:05 +0200 Subject: [PATCH] fix -Wextra & -Wdeprecated in Spreadsheet --- src/Mod/Spreadsheet/App/PropertyColumnWidths.cpp | 1 + src/Mod/Spreadsheet/App/PropertyRowHeights.cpp | 1 + src/Mod/Spreadsheet/App/Sheet.cpp | 4 ++-- src/Mod/Spreadsheet/App/SheetPyImp.cpp | 5 ++++- src/Mod/Spreadsheet/Gui/Command.cpp | 15 +++++++++++++++ src/Mod/Spreadsheet/Gui/SheetModel.cpp | 3 ++- src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp | 4 +++- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 7 ++++++- 8 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/Mod/Spreadsheet/App/PropertyColumnWidths.cpp b/src/Mod/Spreadsheet/App/PropertyColumnWidths.cpp index b8d67adfd..3eab87862 100644 --- a/src/Mod/Spreadsheet/App/PropertyColumnWidths.cpp +++ b/src/Mod/Spreadsheet/App/PropertyColumnWidths.cpp @@ -44,6 +44,7 @@ PropertyColumnWidths::PropertyColumnWidths() } PropertyColumnWidths::PropertyColumnWidths(const PropertyColumnWidths &other) + : Property(), std::map(other) { std::map::const_iterator i = other.begin(); diff --git a/src/Mod/Spreadsheet/App/PropertyRowHeights.cpp b/src/Mod/Spreadsheet/App/PropertyRowHeights.cpp index 98cb85e37..7eba063b4 100644 --- a/src/Mod/Spreadsheet/App/PropertyRowHeights.cpp +++ b/src/Mod/Spreadsheet/App/PropertyRowHeights.cpp @@ -43,6 +43,7 @@ PropertyRowHeights::PropertyRowHeights() } PropertyRowHeights::PropertyRowHeights(const PropertyRowHeights &other) + : Property(), std::map(other) { } diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index 927785d9c..b3d188131 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -873,7 +873,7 @@ short Sheet::mustExecute(void) const * */ -void Sheet::clear(CellAddress address, bool all) +void Sheet::clear(CellAddress address, bool /*all*/) { Cell * cell = getCell(address); std::string addr = address.toString(); @@ -1286,7 +1286,7 @@ void Sheet::onRelabledDocument(const Document &document) * @param document */ -void Sheet::onRenamedDocument(const Document &document) +void Sheet::onRenamedDocument(const Document & /*document*/) { } diff --git a/src/Mod/Spreadsheet/App/SheetPyImp.cpp b/src/Mod/Spreadsheet/App/SheetPyImp.cpp index 0bcfa286e..ce892509a 100644 --- a/src/Mod/Spreadsheet/App/SheetPyImp.cpp +++ b/src/Mod/Spreadsheet/App/SheetPyImp.cpp @@ -154,6 +154,9 @@ PyObject* SheetPy::clear(PyObject *args) PyObject* SheetPy::clearAll(PyObject *args) { + if (!PyArg_ParseTuple(args, "")) + return 0; + this->getSheetPtr()->clearAll(); Py_Return; } @@ -912,7 +915,7 @@ PyObject *SheetPy::getCustomAttributes(const char* attr) const return prop->getPyObject(); } -int SheetPy::setCustomAttributes(const char* attr, PyObject* obj) +int SheetPy::setCustomAttributes(const char* , PyObject* ) { return 0; } diff --git a/src/Mod/Spreadsheet/Gui/Command.cpp b/src/Mod/Spreadsheet/Gui/Command.cpp index 655c1a46e..7d9bec106 100644 --- a/src/Mod/Spreadsheet/Gui/Command.cpp +++ b/src/Mod/Spreadsheet/Gui/Command.cpp @@ -68,6 +68,7 @@ CmdSpreadsheetMergeCells::CmdSpreadsheetMergeCells() void CmdSpreadsheetMergeCells::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -120,6 +121,7 @@ CmdSpreadsheetSplitCell::CmdSpreadsheetSplitCell() void CmdSpreadsheetSplitCell::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -175,6 +177,7 @@ CmdSpreadsheetImport::CmdSpreadsheetImport() void CmdSpreadsheetImport::activated(int iMsg) { + Q_UNUSED(iMsg); QString selectedFilter; QString formatList = QObject::tr("All (*)"); QString fileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), @@ -214,6 +217,7 @@ CmdSpreadsheetExport::CmdSpreadsheetExport() void CmdSpreadsheetExport::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -262,6 +266,7 @@ CmdSpreadsheetAlignLeft::CmdSpreadsheetAlignLeft() void CmdSpreadsheetAlignLeft::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -313,6 +318,7 @@ CmdSpreadsheetAlignCenter::CmdSpreadsheetAlignCenter() void CmdSpreadsheetAlignCenter::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -364,6 +370,7 @@ CmdSpreadsheetAlignRight::CmdSpreadsheetAlignRight() void CmdSpreadsheetAlignRight::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -415,6 +422,7 @@ CmdSpreadsheetAlignTop::CmdSpreadsheetAlignTop() void CmdSpreadsheetAlignTop::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -466,6 +474,7 @@ CmdSpreadsheetAlignBottom::CmdSpreadsheetAlignBottom() void CmdSpreadsheetAlignBottom::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -517,6 +526,7 @@ CmdSpreadsheetAlignVCenter::CmdSpreadsheetAlignVCenter() void CmdSpreadsheetAlignVCenter::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -568,6 +578,7 @@ CmdSpreadsheetStyleBold::CmdSpreadsheetStyleBold() void CmdSpreadsheetStyleBold::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -641,6 +652,7 @@ CmdSpreadsheetStyleItalic::CmdSpreadsheetStyleItalic() void CmdSpreadsheetStyleItalic::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -714,6 +726,7 @@ CmdSpreadsheetStyleUnderline::CmdSpreadsheetStyleUnderline() void CmdSpreadsheetStyleUnderline::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -787,6 +800,7 @@ CmdSpreadsheetSetAlias::CmdSpreadsheetSetAlias() void CmdSpreadsheetSetAlias::activated(int iMsg) { + Q_UNUSED(iMsg); if (getActiveGuiDocument()) { Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow(); SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast(activeWindow); @@ -849,6 +863,7 @@ CmdCreateSpreadsheet::CmdCreateSpreadsheet() void CmdCreateSpreadsheet::activated(int iMsg) { + Q_UNUSED(iMsg); std::string FeatName = getUniqueObjectName("Spreadsheet"); openCommand("Create Spreadsheet"); diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index 7863b90f6..d82a620d3 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -34,7 +34,6 @@ #include "../App/Sheet.h" #include #include -#include #include using namespace SpreadsheetGui; @@ -58,11 +57,13 @@ SheetModel::~SheetModel() int SheetModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return 16384; } int SheetModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return 26 * 26 + 26; } diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp index b21ec6e9c..b0d2a04bb 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp @@ -86,8 +86,10 @@ void SpreadsheetDelegate::setModelData(QWidget *editor, } } -QSize SpreadsheetDelegate::sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const +QSize SpreadsheetDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const { + Q_UNUSED(option); + Q_UNUSED(index); return QSize(); } diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 8b04280b9..4cdac0b8f 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -124,7 +124,7 @@ SheetView::~SheetView() //delete delegate; } -bool SheetView::onMsg(const char *pMsg, const char **ppReturn) +bool SheetView::onMsg(const char *pMsg, const char **) { if(strcmp("Undo",pMsg) == 0 ) { getGuiDocument()->undo(1); @@ -172,6 +172,7 @@ bool SheetView::onHasMsg(const char *pMsg) const void SheetView::setCurrentCell(QString str) { + Q_UNUSED(str); updateContentLine(); } @@ -260,11 +261,13 @@ void SheetView::modelUpdated(const QModelIndex &topLeft, const QModelIndex &bott void SheetView::columnResized(int col, int oldSize, int newSize) { + Q_UNUSED(oldSize); newColumnSizes[col] = newSize; } void SheetView::rowResized(int row, int oldSize, int newSize) { + Q_UNUSED(oldSize); newRowSizes[row] = newSize; } @@ -298,6 +301,8 @@ void SheetView::editingFinished() void SheetView::currentChanged ( const QModelIndex & current, const QModelIndex & previous ) { + Q_UNUSED(current); + Q_UNUSED(previous); updateContentLine(); }