aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2021-04-19 12:02:31 -0700
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-04-20 06:11:40 +0000
commitcd81255da229580146fe9638f9151c29a097ac57 (patch)
tree8b6ccfde0d2654bdf797996ebbdaa38705db818c
parent26c56359731e2017ab400ea0f4e078601aea7758 (diff)
Qt: Fix various compiler warnings.
Fix const-qual and missing-prototypes warnings found by Clang.
-rw-r--r--ui/qt/credentials_dialog.cpp2
-rw-r--r--ui/qt/lte_rlc_statistics_dialog.cpp4
-rw-r--r--ui/qt/main_window.cpp8
-rw-r--r--ui/qt/manager/wireshark_preference.cpp8
-rw-r--r--ui/qt/models/credentials_model.cpp2
-rw-r--r--ui/qt/models/credentials_model.h2
-rw-r--r--ui/qt/models/expert_info_model.cpp2
-rw-r--r--ui/qt/models/pref_delegate.cpp2
-rw-r--r--ui/qt/models/uat_delegate.cpp4
-rw-r--r--ui/qt/voip_calls_dialog.cpp4
10 files changed, 23 insertions, 15 deletions
diff --git a/ui/qt/credentials_dialog.cpp b/ui/qt/credentials_dialog.cpp
index 9c513800f8..cd7419568e 100644
--- a/ui/qt/credentials_dialog.cpp
+++ b/ui/qt/credentials_dialog.cpp
@@ -92,7 +92,7 @@ void CredentialsDialog::tapReset(void *tapdata)
tap_packet_status CredentialsDialog::tapPacket(void *tapdata, _packet_info *, epan_dissect *, const void *data)
{
CredentialsDialog * d = (CredentialsDialog*) tapdata;
- d->model_->addRecord((tap_credential_t*)data);
+ d->model_->addRecord((const tap_credential_t*)data);
return TAP_PACKET_REDRAW;
}
diff --git a/ui/qt/lte_rlc_statistics_dialog.cpp b/ui/qt/lte_rlc_statistics_dialog.cpp
index ee413bff5e..ae36c4e4f4 100644
--- a/ui/qt/lte_rlc_statistics_dialog.cpp
+++ b/ui/qt/lte_rlc_statistics_dialog.cpp
@@ -998,9 +998,13 @@ static stat_tap_ui lte_rlc_statistics_ui = {
};
extern "C" {
+
+void register_tap_listener_qt_lte_rlc_statistics(void);
+
void
register_tap_listener_qt_lte_rlc_statistics(void)
{
register_stat_tap_ui(&lte_rlc_statistics_ui, NULL);
}
+
}
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 9f0f8947da..3fc49c5be1 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -120,9 +120,10 @@ static void plugin_if_mainwindow_preference(GHashTable * data_set)
const char * pref_name;
const char * pref_value;
- if (g_hash_table_lookup_extended(data_set, "pref_module", NULL, (void**)&module_name) &&
- g_hash_table_lookup_extended(data_set, "pref_key", NULL, (void**)&pref_name) &&
- g_hash_table_lookup_extended(data_set, "pref_value", NULL, (void**)&pref_value))
+DIAG_OFF_CAST_AWAY_CONST
+ if (g_hash_table_lookup_extended(data_set, "pref_module", NULL, (gpointer *)&module_name) &&
+ g_hash_table_lookup_extended(data_set, "pref_key", NULL, (gpointer *)&pref_name) &&
+ g_hash_table_lookup_extended(data_set, "pref_value", NULL, (gpointer *)&pref_value))
{
unsigned int changed_flags = prefs_store_ext(module_name, pref_name, pref_value);
if (changed_flags) {
@@ -130,6 +131,7 @@ static void plugin_if_mainwindow_preference(GHashTable * data_set)
wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
}
}
+DIAG_ON_CAST_AWAY_CONST
}
static void plugin_if_mainwindow_gotoframe(GHashTable * data_set)
diff --git a/ui/qt/manager/wireshark_preference.cpp b/ui/qt/manager/wireshark_preference.cpp
index ef54201443..761589d6dd 100644
--- a/ui/qt/manager/wireshark_preference.cpp
+++ b/ui/qt/manager/wireshark_preference.cpp
@@ -51,7 +51,7 @@ public:
BoolPreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {}
virtual QWidget * editor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index)
{
- ((QAbstractItemModel*)index.model())->setData(index, QString("BOOL"), Qt::EditRole);
+ const_cast<QAbstractItemModel*>(index.model())->setData(index, QString("BOOL"), Qt::EditRole);
return WiresharkPreference::editor(parent, option, index);
}
};
@@ -180,7 +180,7 @@ public:
QString filename = WiresharkFileDialog::getSaveFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
index.model()->data(index, Qt::DisplayRole).toString());
if (!filename.isEmpty()) {
- ((QAbstractItemModel*)index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
+ const_cast<QAbstractItemModel*>(index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
}
return WiresharkPreference::editor(parent, option, index);
}
@@ -196,7 +196,7 @@ public:
QString filename = WiresharkFileDialog::getOpenFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
index.model()->data(index, Qt::DisplayRole).toString());
if (!filename.isEmpty()) {
- ((QAbstractItemModel*)index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
+ const_cast<QAbstractItemModel*>(index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
}
return WiresharkPreference::editor(parent, option, index);
}
@@ -212,7 +212,7 @@ public:
QString filename = WiresharkFileDialog::getExistingDirectory(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
index.model()->data(index, Qt::DisplayRole).toString());
if (!filename.isEmpty()) {
- ((QAbstractItemModel*)index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
+ const_cast<QAbstractItemModel*>(index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
}
return WiresharkPreference::editor(parent, option, index);
}
diff --git a/ui/qt/models/credentials_model.cpp b/ui/qt/models/credentials_model.cpp
index 1496ef00af..5530514a5e 100644
--- a/ui/qt/models/credentials_model.cpp
+++ b/ui/qt/models/credentials_model.cpp
@@ -99,7 +99,7 @@ QVariant CredentialsModel::data(const QModelIndex &index, int role) const
return QVariant();
}
-void CredentialsModel::addRecord(tap_credential_t* auth)
+void CredentialsModel::addRecord(const tap_credential_t* auth)
{
emit beginInsertRows(QModelIndex(), rowCount(), rowCount() + 1);
diff --git a/ui/qt/models/credentials_model.h b/ui/qt/models/credentials_model.h
index abd9dd41aa..bdb62d7764 100644
--- a/ui/qt/models/credentials_model.h
+++ b/ui/qt/models/credentials_model.h
@@ -30,7 +30,7 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- void addRecord(tap_credential_t* rec);
+ void addRecord(const tap_credential_t *rec);
void clear();
enum {
diff --git a/ui/qt/models/expert_info_model.cpp b/ui/qt/models/expert_info_model.cpp
index bdfaea80e4..2b4dc73a33 100644
--- a/ui/qt/models/expert_info_model.cpp
+++ b/ui/qt/models/expert_info_model.cpp
@@ -116,7 +116,9 @@ void ExpertInfoModel::clear()
ExpertPacketItem* ExpertInfoModel::createRootItem()
{
static const char* rootName = "ROOT";
+DIAG_OFF_CAST_AWAY_CONST
static expert_info_t root_expert = { 0, -1, -1, -1, rootName, (gchar*)rootName, NULL };
+DIAG_ON_CAST_AWAY_CONST
return new ExpertPacketItem(root_expert, NULL, NULL);
}
diff --git a/ui/qt/models/pref_delegate.cpp b/ui/qt/models/pref_delegate.cpp
index 6cae167f3e..e33bb13f23 100644
--- a/ui/qt/models/pref_delegate.cpp
+++ b/ui/qt/models/pref_delegate.cpp
@@ -37,7 +37,7 @@ QWidget *AdvancedPrefDelegate::createEditor(QWidget *parent, const QStyleOptionV
case AdvancedPrefsModel::colType:
//If user clicks on any of these columns, reset preference back to default
//There is no need to launch an editor
- ((QAbstractItemModel*)index.model())->setData(index, QVariant(), Qt::EditRole);
+ const_cast<QAbstractItemModel*>(index.model())->setData(index, QVariant(), Qt::EditRole);
break;
case AdvancedPrefsModel::colValue:
pref = indexToPref(index);
diff --git a/ui/qt/models/uat_delegate.cpp b/ui/qt/models/uat_delegate.cpp
index b1964153a2..11eb5fd0ab 100644
--- a/ui/qt/models/uat_delegate.cpp
+++ b/ui/qt/models/uat_delegate.cpp
@@ -184,7 +184,7 @@ void UatDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
if (qobject_cast<QColorDialog *>(editor))
{
QColor newColor = qobject_cast<QColorDialog *>(editor)->currentColor();
- ((QAbstractItemModel *)index.model())->setData(index, newColor.name(), Qt::EditRole);
+ const_cast<QAbstractItemModel *>(index.model())->setData(index, newColor.name(), Qt::EditRole);
}
break;
@@ -197,6 +197,6 @@ void UatDelegate::applyFilename(const QModelIndex& index)
{
if (index.isValid()) {
EditorFileDialog* fileDialog = static_cast<EditorFileDialog*>(sender());
- ((QAbstractItemModel *)index.model())->setData(index, fileDialog->text(), Qt::EditRole);
+ const_cast<QAbstractItemModel *>(index.model())->setData(index, fileDialog->text(), Qt::EditRole);
}
}
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index 5aad77f265..09c2531649 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -321,8 +321,8 @@ void VoipCallsDialog::tapDraw(void *tapinfo_ptr)
gint VoipCallsDialog::compareCallNums(gconstpointer a, gconstpointer b)
{
- voip_calls_info_t *call_a = (voip_calls_info_t *)a;
- voip_calls_info_t *call_b = (voip_calls_info_t *)b;
+ const voip_calls_info_t *call_a = (const voip_calls_info_t *)a;
+ const voip_calls_info_t *call_b = (const voip_calls_info_t *)b;
return (call_a->call_num != call_b->call_num);
}