Get rid of some occurrences of Q_UNUSED

- Trivial by just doing it the C++ way
- Non-Trivial where the whole function can be put into the #ifdef instead of the variable use case

Change-Id: I034751b8a3c70211173f0c06c954def94450db46
Reviewed-on: https://code.wireshark.org/review/28311
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
This commit is contained in:
Joerg Mayer 2018-06-15 13:21:28 +02:00 committed by Jörg Mayer
parent 9ce3036037
commit f1c410275f
9 changed files with 15 additions and 35 deletions

View File

@ -277,12 +277,9 @@ void CaptureFile::captureFileEvent(int event, gpointer data)
}
}
#ifdef HAVE_LIBPCAP
void CaptureFile::captureSessionEvent(int event, capture_session *cap_session)
{
#ifndef HAVE_LIBPCAP
Q_UNUSED(event)
Q_UNUSED(cap_session)
#else
switch(event) {
case(capture_cb_capture_prepared):
emit captureEvent(CaptureEvent(CaptureEvent::Capture, CaptureEvent::Prepared, cap_session));
@ -317,8 +314,8 @@ void CaptureFile::captureSessionEvent(int event, capture_session *cap_session)
default:
qWarning() << "main_capture_callback: event " << event << " unknown";
}
#endif // HAVE_LIBPCAP
}
#endif // HAVE_LIBPCAP
/*
* Editor modelines

View File

@ -169,16 +169,14 @@ void CaptureInfoModel::updateInfo()
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
int CaptureInfoModel::rowCount(const QModelIndex &parent) const
int CaptureInfoModel::rowCount(const QModelIndex &) const
{
Q_UNUSED(parent)
if (!cap_info_) return 0;
return points_.keys().size() + 1;
}
int CaptureInfoModel::columnCount(const QModelIndex &parent) const
int CaptureInfoModel::columnCount(const QModelIndex &) const
{
Q_UNUSED(parent)
return 2;
}

View File

@ -1322,9 +1322,9 @@ void InterfaceTreeDelegate::snapshotLengthChanged(int value)
}
}
#ifdef SHOW_BUFFER_COLUMN
void InterfaceTreeDelegate::bufferSizeChanged(int value)
{
#ifdef SHOW_BUFFER_COLUMN
interface_t *device;
QTreeWidgetItem *ti = tree_->currentItem();
if (!ti) {
@ -1336,10 +1336,8 @@ void InterfaceTreeDelegate::bufferSizeChanged(int value)
return;
}
device->buffer = value;
#else
Q_UNUSED(value)
#endif
}
#endif
#endif /* HAVE_LIBPCAP */

View File

@ -429,9 +429,8 @@ void MainStatusBar::popProgressStatus()
progress_frame_.hide();
}
void MainStatusBar::selectedFrameChanged(int frameNum)
void MainStatusBar::selectedFrameChanged(int)
{
Q_UNUSED(frameNum);
showCaptureStatistics();
}

View File

@ -313,11 +313,13 @@ public slots:
void setTitlebarForCaptureFile();
void setWSWindowTitle(QString title = QString());
#ifdef HAVE_LIBPCAP
void captureCapturePrepared(capture_session *);
void captureCaptureUpdateStarted(capture_session *);
void captureCaptureUpdateFinished(capture_session *);
void captureCaptureFixedFinished(capture_session *cap_session);
void captureCaptureFailed(capture_session *);
#endif
void captureFileOpened();
void captureFileReadFinished();

View File

@ -486,8 +486,8 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
// Capture callbacks
void MainWindow::captureCapturePrepared(capture_session *) {
#ifdef HAVE_LIBPCAP
void MainWindow::captureCapturePrepared(capture_session *) {
setTitlebarForCaptureInProgress();
setWindowIcon(wsApp->captureIcon());
@ -500,11 +500,9 @@ void MainWindow::captureCapturePrepared(capture_session *) {
// /* Don't set up main window for a capture file. */
// main_set_for_capture_file(FALSE);
showCapture();
#endif // HAVE_LIBPCAP
}
void MainWindow::captureCaptureUpdateStarted(capture_session *session) {
#ifdef HAVE_LIBPCAP
/* We've done this in "prepared" above, but it will be cleared while
switching to the next multiple file. */
@ -513,12 +511,9 @@ void MainWindow::captureCaptureUpdateStarted(capture_session *session) {
setForCaptureInProgress(true, session->capture_opts->ifaces);
setForCapturedPackets(true);
#else
Q_UNUSED(session)
#endif // HAVE_LIBPCAP
}
void MainWindow::captureCaptureUpdateFinished(capture_session *) {
#ifdef HAVE_LIBPCAP
/* The capture isn't stopping any more - it's stopped. */
capture_stopping_ = false;
@ -538,11 +533,9 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *) {
// Don't pop up a dialog to ask for unsaved files etc.
exit(0);
}
#endif // HAVE_LIBPCAP
}
void MainWindow::captureCaptureFixedFinished(capture_session *) {
#ifdef HAVE_LIBPCAP
/* The capture isn't stopping any more - it's stopped. */
capture_stopping_ = false;
@ -562,11 +555,9 @@ void MainWindow::captureCaptureFixedFinished(capture_session *) {
// Don't pop up a dialog to ask for unsaved files etc.
exit(0);
}
#endif // HAVE_LIBPCAP
}
void MainWindow::captureCaptureFailed(capture_session *) {
#ifdef HAVE_LIBPCAP
/* Capture isn't stopping any more. */
capture_stopping_ = false;
@ -584,8 +575,8 @@ void MainWindow::captureCaptureFailed(capture_session *) {
// Don't pop up a dialog to ask for unsaved files etc.
exit(0);
}
#endif // HAVE_LIBPCAP
}
#endif // HAVE_LIBPCAP
// Callbacks from cfile.c and file.c via CaptureFile::captureFileCallback

View File

@ -33,10 +33,8 @@ void AStringListListModel::appendRow(const QStringList & display_strings, const
emit endInsertRows();
}
int AStringListListModel::rowCount(const QModelIndex &parent) const
int AStringListListModel::rowCount(const QModelIndex &) const
{
Q_UNUSED(parent);
return display_data_.count();
}

View File

@ -28,9 +28,8 @@ QModelIndex FilesetEntryModel::index(int row, int column, const QModelIndex &) c
return createIndex(row, column, const_cast<fileset_entry *>(entries_.at(row)));
}
int FilesetEntryModel::rowCount(const QModelIndex &parent) const
int FilesetEntryModel::rowCount(const QModelIndex &) const
{
Q_UNUSED(parent)
return entries_.count();
}

View File

@ -175,10 +175,8 @@ void WirelessTimeline::clip_tsf()
}
void WirelessTimeline::selectedFrameChanged(int frameNum)
void WirelessTimeline::selectedFrameChanged(int)
{
Q_UNUSED(frameNum);
if (isHidden())
return;