From 21754f43e1e7139bcd3d673714c2a191681a63e9 Mon Sep 17 00:00:00 2001 From: Joerg Mayer Date: Tue, 7 Jul 2015 08:24:50 +0200 Subject: [PATCH] Starting to get rid of Q_UNUSED declarations for unused function parameters. The official C++ way is to leave out the variable name instead. This has the advantage to be reliable: In one case a variable declared unused was later used. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I1c96636f7fa7a621d1594d1e9cacaec75c561faa Reviewed-on: https://code.wireshark.org/review/9532 Reviewed-by: Jörg Mayer --- ui/qt/packet_format_group_box.cpp | 6 ++---- ui/qt/packet_list.cpp | 7 ++----- ui/qt/packet_range_group_box.cpp | 3 +-- ui/qt/preferences_dialog.cpp | 19 +++++-------------- ui/qt/print_dialog.cpp | 5 +---- ui/qt/profile_dialog.cpp | 4 +--- ui/qt/proto_tree.cpp | 4 +--- ui/qt/remote_capture_dialog.cpp | 5 +---- ui/qt/rtp_stream_dialog.cpp | 3 +-- ui/qt/sequence_diagram.cpp | 15 ++++----------- ui/qt/sequence_dialog.cpp | 9 +++------ ui/qt/sparkline_delegate.cpp | 5 +---- ui/qt/splash_overlay.cpp | 8 ++------ ui/qt/tcp_stream_dialog.cpp | 7 ++----- ui/qt/time_shift_dialog.cpp | 25 ++++++++----------------- ui/qt/traffic_table_dialog.cpp | 3 +-- ui/qt/traffic_table_dialog.h | 2 +- ui/qt/uat_dialog.cpp | 2 -- ui/qt/voip_calls_dialog.cpp | 8 ++------ 19 files changed, 39 insertions(+), 101 deletions(-) diff --git a/ui/qt/packet_format_group_box.cpp b/ui/qt/packet_format_group_box.cpp index d62c55d31a..fbc424d1f2 100644 --- a/ui/qt/packet_format_group_box.cpp +++ b/ui/qt/packet_format_group_box.cpp @@ -75,9 +75,8 @@ bool PacketFormatGroupBox::allExpandedEnabled() return pf_ui_->allExpandedButton->isChecked(); } -void PacketFormatGroupBox::on_summaryCheckBox_toggled(bool checked) +void PacketFormatGroupBox::on_summaryCheckBox_toggled(bool) { - Q_UNUSED(checked); emit formatChanged(); } @@ -89,9 +88,8 @@ void PacketFormatGroupBox::on_detailsCheckBox_toggled(bool checked) emit formatChanged(); } -void PacketFormatGroupBox::on_bytesCheckBox_toggled(bool checked) +void PacketFormatGroupBox::on_bytesCheckBox_toggled(bool) { - Q_UNUSED(checked); emit formatChanged(); } diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index c6bea960bd..2cacdcb0fa 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -77,10 +77,8 @@ const int max_comments_to_fetch_ = 20000000; // Arbitrary const int tail_update_interval_ = 100; // Milliseconds. guint -packet_list_append(column_info *cinfo, frame_data *fdata) +packet_list_append(column_info *, frame_data *fdata) { - Q_UNUSED(cinfo); - if (!gbl_cur_packet_list) return 0; @@ -150,9 +148,8 @@ packet_list_clear(void) } void -packet_list_enable_color(gboolean enable) +packet_list_enable_color(gboolean) { - Q_UNUSED(enable); if (gbl_cur_packet_list && gbl_cur_packet_list->packetListModel()) { gbl_cur_packet_list->packetListModel()->resetColorized(); gbl_cur_packet_list->update(); diff --git a/ui/qt/packet_range_group_box.cpp b/ui/qt/packet_range_group_box.cpp index adf733cbb3..a7ceefbea6 100644 --- a/ui/qt/packet_range_group_box.cpp +++ b/ui/qt/packet_range_group_box.cpp @@ -279,9 +279,8 @@ void PacketRangeGroupBox::updateCounts() { // Slots -void PacketRangeGroupBox::on_rangeLineEdit_textChanged(const QString &range_str) +void PacketRangeGroupBox::on_rangeLineEdit_textChanged(const QString &) { - Q_UNUSED(range_str) if (!pr_ui_->rangeButton->isChecked()) { pr_ui_->rangeButton->setChecked(true); } else { diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp index 75705e5222..58e7a8cbc5 100644 --- a/ui/qt/preferences_dialog.cpp +++ b/ui/qt/preferences_dialog.cpp @@ -123,10 +123,8 @@ extern "C" { // Callbacks prefs routines static guint -pref_exists(pref_t *pref, gpointer user_data) +pref_exists(pref_t *, gpointer) { - Q_UNUSED(pref) - Q_UNUSED(user_data) return 1; } @@ -231,10 +229,8 @@ module_prefs_unstash(module_t *module, gpointer data) } static guint -module_prefs_clean_stash(module_t *module, gpointer unused) +module_prefs_clean_stash(module_t *module, gpointer) { - Q_UNUSED(unused); - for (GList *pref_l = module->prefs; pref_l && pref_l->data; pref_l = g_list_next(pref_l)) { pref_t *pref = (pref_t *) pref_l->data; @@ -354,9 +350,8 @@ void PreferencesDialog::setPane(const QString module_name) } } -void PreferencesDialog::showEvent(QShowEvent *evt) +void PreferencesDialog::showEvent(QShowEvent *) { - Q_UNUSED(evt); QStyleOption style_opt; int new_prefs_tree_width = pd_ui_->prefsTree->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &style_opt).left(); QList sizes = pd_ui_->splitter->sizes(); @@ -511,10 +506,8 @@ void PreferencesDialog::updateItem(QTreeWidgetItem &item) item.setText(3, cur_value); } -void PreferencesDialog::on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) +void PreferencesDialog::on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *) { - Q_UNUSED(previous) - if (!current) return; QWidget *new_item = current->data(0, Qt::UserRole).value(); if (new_item) { @@ -566,10 +559,8 @@ void PreferencesDialog::on_advancedSearchLineEdit_textEdited(const QString &sear } } -void PreferencesDialog::on_advancedTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) +void PreferencesDialog::on_advancedTree_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *previous) { - Q_UNUSED(current); - if (previous && pd_ui_->advancedTree->itemWidget(previous, 3)) { pd_ui_->advancedTree->removeItemWidget(previous, 3); } diff --git a/ui/qt/print_dialog.cpp b/ui/qt/print_dialog.cpp index 73aa2da719..324050414c 100644 --- a/ui/qt/print_dialog.cpp +++ b/ui/qt/print_dialog.cpp @@ -36,11 +36,8 @@ extern "C" { // Page element callbacks static gboolean -print_preamble_pd(print_stream_t *self, gchar *filename, const char *version_string ) +print_preamble_pd(print_stream_t *self, gchar *, const char *) { - Q_UNUSED(filename); - Q_UNUSED(version_string); - if (!self) return FALSE; PrintDialog *print_dlg = static_cast(self->data); if (!print_dlg) return FALSE; diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp index 8a02f5bfef..72b262632c 100644 --- a/ui/qt/profile_dialog.cpp +++ b/ui/qt/profile_dialog.cpp @@ -189,10 +189,8 @@ void ProfileDialog::updateWidgets() ok_button_->setEnabled(enable_ok); } -void ProfileDialog::on_profileTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) +void ProfileDialog::on_profileTreeWidget_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *) { - Q_UNUSED(current); - Q_UNUSED(previous); if (pd_ui_->profileTreeWidget->updatesEnabled()) updateWidgets(); } diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index 05bd726ad4..0bee28656b 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -495,9 +495,7 @@ void ProtoTree::collapseAll() QTreeWidget::collapseAll(); } -void ProtoTree::itemDoubleClick(QTreeWidgetItem *item, int column) { - Q_UNUSED(column); - +void ProtoTree::itemDoubleClick(QTreeWidgetItem *item, int) { field_info *fi; fi = item->data(0, Qt::UserRole).value(); diff --git a/ui/qt/remote_capture_dialog.cpp b/ui/qt/remote_capture_dialog.cpp index 5090445be6..a157a55a32 100644 --- a/ui/qt/remote_capture_dialog.cpp +++ b/ui/qt/remote_capture_dialog.cpp @@ -76,11 +76,8 @@ void RemoteCaptureDialog::hostChanged(QString host) } -static void fillBox(gpointer key, gpointer value, gpointer user_data) +static void fillBox(gpointer key, gpointer, gpointer) { - Q_UNUSED(value); - Q_UNUSED(user_data); - QComboBox *cb = (QComboBox *)user_data; cb->addItem(QString((gchar*)key)); } diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp index 0d2f6650a8..0685bcaf8e 100644 --- a/ui/qt/rtp_stream_dialog.cpp +++ b/ui/qt/rtp_stream_dialog.cpp @@ -283,9 +283,8 @@ RtpStreamDialog::~RtpStreamDialog() remove_tap_listener_rtp_stream(&tapinfo_); } -bool RtpStreamDialog::eventFilter(QObject *obj, QEvent *event) +bool RtpStreamDialog::eventFilter(QObject *, QEvent *event) { - Q_UNUSED(obj) if (ui->streamTreeWidget->hasFocus() && event->type() == QEvent::KeyPress) { QKeyEvent &keyEvent = static_cast(*event); switch(keyEvent.key()) { diff --git a/ui/qt/sequence_diagram.cpp b/ui/qt/sequence_diagram.cpp index 0f421d72f5..6ba46b50f3 100644 --- a/ui/qt/sequence_diagram.cpp +++ b/ui/qt/sequence_diagram.cpp @@ -167,11 +167,8 @@ _seq_analysis_item *SequenceDiagram::itemForPosY(int ypos) return NULL; } -double SequenceDiagram::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const +double SequenceDiagram::selectTest(const QPointF &pos, bool, QVariant *) const { - Q_UNUSED(details); - Q_UNUSED(onlySelectable); - double key_pos = qRound(key_axis_->pixelToCoord(pos.y())); if (key_pos >= 0 && key_pos < data_->size()) { @@ -292,15 +289,12 @@ void SequenceDiagram::draw(QCPPainter *painter) } } -void SequenceDiagram::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const +void SequenceDiagram::drawLegendIcon(QCPPainter *, const QRectF &) const { - Q_UNUSED(painter); - Q_UNUSED(rect); } -QCPRange SequenceDiagram::getKeyRange(bool &validRange, QCPAbstractPlottable::SignDomain inSignDomain) const +QCPRange SequenceDiagram::getKeyRange(bool &validRange, QCPAbstractPlottable::SignDomain) const { - Q_UNUSED(inSignDomain); QCPRange range; bool valid = false; @@ -321,9 +315,8 @@ QCPRange SequenceDiagram::getKeyRange(bool &validRange, QCPAbstractPlottable::Si return range; } -QCPRange SequenceDiagram::getValueRange(bool &validRange, QCPAbstractPlottable::SignDomain inSignDomain) const +QCPRange SequenceDiagram::getValueRange(bool &validRange, QCPAbstractPlottable::SignDomain) const { - Q_UNUSED(inSignDomain); QCPRange range; bool valid = false; diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp index f70bf8b5d7..8630146e2b 100644 --- a/ui/qt/sequence_dialog.cpp +++ b/ui/qt/sequence_dialog.cpp @@ -152,15 +152,13 @@ void SequenceDialog::updateWidgets() { } -void SequenceDialog::showEvent(QShowEvent *event) +void SequenceDialog::showEvent(QShowEvent *) { - Q_UNUSED(event); resetAxes(); } -void SequenceDialog::resizeEvent(QResizeEvent *event) +void SequenceDialog::resizeEvent(QResizeEvent *) { - Q_UNUSED(event); resetAxes(true); } @@ -288,9 +286,8 @@ void SequenceDialog::mouseMoved(QMouseEvent *event) ui->hintLabel->setText(hint); } -void SequenceDialog::mouseReleased(QMouseEvent *event) +void SequenceDialog::mouseReleased(QMouseEvent *) { - Q_UNUSED(event); if (ui->sequencePlot->cursor().shape() == Qt::ClosedHandCursor) { ui->sequencePlot->setCursor(QCursor(Qt::OpenHandCursor)); } diff --git a/ui/qt/sparkline_delegate.cpp b/ui/qt/sparkline_delegate.cpp index 8ea141e8b3..3407dc3e40 100644 --- a/ui/qt/sparkline_delegate.cpp +++ b/ui/qt/sparkline_delegate.cpp @@ -101,11 +101,8 @@ QSize SparkLineDelegate::sizeHint(const QStyleOptionViewItem &option, return QSize(option.fontMetrics.height() * SPARKLINE_MIN_EM_WIDTH, QStyledItemDelegate::sizeHint(option, index).height()); } -QWidget *SparkLineDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const +QWidget *SparkLineDelegate::createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const { - Q_UNUSED(parent) - Q_UNUSED(option) - Q_UNUSED(index) return NULL; } diff --git a/ui/qt/splash_overlay.cpp b/ui/qt/splash_overlay.cpp index 4d891acc00..18242ed0ad 100644 --- a/ui/qt/splash_overlay.cpp +++ b/ui/qt/splash_overlay.cpp @@ -37,9 +37,7 @@ */ int info_update_freq_ = 100; -void splash_update(register_action_e action, const char *message, void *dummy) { - Q_UNUSED(dummy); - +void splash_update(register_action_e action, const char *message, void *) { emit wsApp->registerUpdate(action, message); } @@ -176,10 +174,8 @@ void SplashOverlay::splashUpdate(register_action_e action, const char *message) time_.restart(); } -void SplashOverlay::paintEvent(QPaintEvent *event) +void SplashOverlay::paintEvent(QPaintEvent *) { - Q_UNUSED(event); - QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp index 8c16ec9d39..acc939a03c 100644 --- a/ui/qt/tcp_stream_dialog.cpp +++ b/ui/qt/tcp_stream_dialog.cpp @@ -224,9 +224,8 @@ TCPStreamDialog::~TCPStreamDialog() delete ui; } -void TCPStreamDialog::showEvent(QShowEvent *event) +void TCPStreamDialog::showEvent(QShowEvent *) { - Q_UNUSED(event); resetAxes(); } @@ -815,10 +814,8 @@ void TCPStreamDialog::graphClicked(QMouseEvent *event) } } -void TCPStreamDialog::axisClicked(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event) +void TCPStreamDialog::axisClicked(QCPAxis *axis, QCPAxis::SelectablePart, QMouseEvent *) { - Q_UNUSED(part) - Q_UNUSED(event) QCustomPlot *sp = ui->streamPlot; if (axis == sp->xAxis) { diff --git a/ui/qt/time_shift_dialog.cpp b/ui/qt/time_shift_dialog.cpp index 7002e62081..bbfbf05a0c 100644 --- a/ui/qt/time_shift_dialog.cpp +++ b/ui/qt/time_shift_dialog.cpp @@ -163,27 +163,23 @@ void TimeShiftDialog::checkDateTime(SyntaxLineEdit &time_le) } } -void TimeShiftDialog::on_shiftAllButton_toggled(bool checked) +void TimeShiftDialog::on_shiftAllButton_toggled(bool) { - Q_UNUSED(checked); enableWidgets(); } -void TimeShiftDialog::on_setOneButton_toggled(bool checked) +void TimeShiftDialog::on_setOneButton_toggled(bool) { - Q_UNUSED(checked); enableWidgets(); } -void TimeShiftDialog::on_unshiftAllButton_toggled(bool checked) +void TimeShiftDialog::on_unshiftAllButton_toggled(bool) { - Q_UNUSED(checked); enableWidgets(); } -void TimeShiftDialog::on_setTwoCheckBox_toggled(bool checked) +void TimeShiftDialog::on_setTwoCheckBox_toggled(bool) { - Q_UNUSED(checked); enableWidgets(); } @@ -208,34 +204,29 @@ void TimeShiftDialog::on_shiftAllTimeLineEdit_textChanged(const QString &sa_text enableWidgets(); } -void TimeShiftDialog::on_setOneFrameLineEdit_textChanged(const QString &frame_text) +void TimeShiftDialog::on_setOneFrameLineEdit_textChanged(const QString &) { - Q_UNUSED(frame_text); checkFrameNumber(*ts_ui_->setOneFrameLineEdit); ts_ui_->setOneButton->setChecked(true); enableWidgets(); } -void TimeShiftDialog::on_setOneTimeLineEdit_textChanged(const QString &so_text) +void TimeShiftDialog::on_setOneTimeLineEdit_textChanged(const QString &) { - Q_UNUSED(so_text); checkDateTime(*ts_ui_->setOneTimeLineEdit); ts_ui_->setOneButton->setChecked(true); enableWidgets(); } -void TimeShiftDialog::on_setTwoFrameLineEdit_textChanged(const QString &frame_text) +void TimeShiftDialog::on_setTwoFrameLineEdit_textChanged(const QString &) { - Q_UNUSED(frame_text); - Q_UNUSED(frame_text); checkFrameNumber(*ts_ui_->setTwoFrameLineEdit); if (ts_ui_->setTwoCheckBox->isEnabled()) ts_ui_->setTwoCheckBox->setChecked(true); enableWidgets(); } -void TimeShiftDialog::on_setTwoTimeLineEdit_textChanged(const QString &st_text) +void TimeShiftDialog::on_setTwoTimeLineEdit_textChanged(const QString &) { - Q_UNUSED(st_text); checkDateTime(*ts_ui_->setTwoTimeLineEdit); if (ts_ui_->setTwoCheckBox->isEnabled()) ts_ui_->setTwoCheckBox->setChecked(true); diff --git a/ui/qt/traffic_table_dialog.cpp b/ui/qt/traffic_table_dialog.cpp index 908765df14..bc4af92086 100644 --- a/ui/qt/traffic_table_dialog.cpp +++ b/ui/qt/traffic_table_dialog.cpp @@ -144,9 +144,8 @@ QPushButton *TrafficTableDialog::enabledTypesPushButton() const return ui->enabledTypesPushButton; } -void TrafficTableDialog::on_nameResolutionCheckBox_toggled(bool checked) +void TrafficTableDialog::on_nameResolutionCheckBox_toggled(bool) { - Q_UNUSED(checked); updateWidgets(); } diff --git a/ui/qt/traffic_table_dialog.h b/ui/qt/traffic_table_dialog.h index acf8d1342e..a17b38b294 100644 --- a/ui/qt/traffic_table_dialog.h +++ b/ui/qt/traffic_table_dialog.h @@ -129,7 +129,7 @@ protected: const QList defaultProtos() const; void fillTypeMenu(QList &enabled_protos); // Adds a conversation tree. Returns true if the tree was freshly created, false if it was cached. - virtual bool addTrafficTable(register_ct_t* table) { Q_UNUSED(table) return false; } + virtual bool addTrafficTable(register_ct_t*) { return false; } // UI getters QDialogButtonBox *buttonBox() const; diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp index e5f8bc3e06..76fbc6b614 100644 --- a/ui/qt/uat_dialog.cpp +++ b/ui/qt/uat_dialog.cpp @@ -234,8 +234,6 @@ void UatDialog::activateLastItem() void UatDialog::on_uatTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) { - Q_UNUSED(current) - for (int col = 0; col < ui->uatTreeWidget->columnCount(); col++) { if (previous && ui->uatTreeWidget->itemWidget(previous, col)) { ui->uatTreeWidget->removeItemWidget(previous, col); diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp index 837b078d4d..907c885fb3 100644 --- a/ui/qt/voip_calls_dialog.cpp +++ b/ui/qt/voip_calls_dialog.cpp @@ -231,17 +231,13 @@ void VoipCallsDialog::changeEvent(QEvent *event) QDialog::changeEvent(event); } -//void VoipCallsDialog::tapReset(void *tapinfo_ptr) +//void VoipCallsDialog::tapReset(void *) //{ -// Q_UNUSED(tapinfo_ptr) // voip_calls_tapinfo_t *tapinfo = (voip_calls_tapinfo_t *) tapinfo_ptr; //} -gboolean VoipCallsDialog::tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data) +gboolean VoipCallsDialog::tapPacket(void *, packet_info *, epan_dissect_t *, const void *) { - Q_UNUSED(tapinfo_ptr) - Q_UNUSED(pinfo) - Q_UNUSED(data) #ifdef QT_MULTIMEDIAWIDGETS_LIB // voip_calls_tapinfo_t *tapinfo = (voip_calls_tapinfo_t *) tapinfo_ptr; // add_rtp_packet for voip player. -- 2.34.1