diff options
author | Roland Knall <rknall@gmail.com> | 2019-08-14 10:18:51 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-08-30 13:37:25 +0000 |
commit | a53545c0c81ac71aaa10ae91d080f1640551b5b8 (patch) | |
tree | 77bf1f42dfa8d10607a05b69929f5efcaa36c6eb /ui/qt/sctp_assoc_analyse_dialog.cpp | |
parent | b43ff704446cd7a3b4c5dc3fa4268f5ebac2c326 (diff) |
Qt: Add macro for g_list_next for C++
Using a simple (type *) cast on g_list_next results in a warning
with modern compilers "old-style cast"
Adding a warning for g_list_next and data access to avoid the warning
A good overview why reinterpret_cast has been used can be found here:
https://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-const-cast-and-reinterpret-cast-be-used
It is a 1:1 replacement in this case, but does not use any of the new
cast styles and therefore should be used with caution.
Change-Id: I989f237afc39aaf40133a788b1c0bbd7a51bf974
Reviewed-on: https://code.wireshark.org/review/34284
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/sctp_assoc_analyse_dialog.cpp')
-rw-r--r-- | ui/qt/sctp_assoc_analyse_dialog.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ui/qt/sctp_assoc_analyse_dialog.cpp b/ui/qt/sctp_assoc_analyse_dialog.cpp index 9d401a0961..4886c4e30e 100644 --- a/ui/qt/sctp_assoc_analyse_dialog.cpp +++ b/ui/qt/sctp_assoc_analyse_dialog.cpp @@ -60,7 +60,7 @@ const sctp_assoc_info_t* SCTPAssocAnalyseDialog::findAssocForPacket(capture_file list = g_list_first(sctp_stat_get_info()->assoc_info_list); while (list) { - assoc = (const sctp_assoc_info_t*)(list->data); + assoc = gxx_list_data(const sctp_assoc_info_t*, list); framelist = g_list_first(assoc->frame_numbers); guint32 fn; @@ -70,12 +70,12 @@ const sctp_assoc_info_t* SCTPAssocAnalyseDialog::findAssocForPacket(capture_file frame_found = TRUE; break; } - framelist = g_list_next(framelist); + framelist = gxx_list_next(framelist); } if (frame_found) { return assoc; } else { - list = g_list_next(list); + list = gxx_list_next(list); } } @@ -84,7 +84,7 @@ const sctp_assoc_info_t* SCTPAssocAnalyseDialog::findAssocForPacket(capture_file msgBox.setText(tr("No Association found for this packet.")); msgBox.exec(); } - return NULL; + return Q_NULLPTR; } const _sctp_assoc_info* SCTPAssocAnalyseDialog::findAssoc(QWidget *parent, guint16 assoc_id) @@ -118,20 +118,20 @@ void SCTPAssocAnalyseDialog::fillTabs(const sctp_assoc_info_t* selected_assoc) else ui->labelEP1->setText(QString(tr("List of used IP-Addresses"))); - if (selected_assoc->addr1 != NULL) { + if (selected_assoc->addr1 != Q_NULLPTR) { GList *list; list = g_list_first(selected_assoc->addr1); while (list) { address *store; - store = (address *)(list->data); + store = gxx_list_data(address *, list); if (store->type != AT_NONE) { if ((store->type == AT_IPv4) || (store->type == AT_IPv6)) { ui->listWidgetEP1->addItem(address_to_qstring(store)); } } - list = g_list_next(list); + list = gxx_list_next(list); } } else { return; @@ -170,20 +170,20 @@ void SCTPAssocAnalyseDialog::fillTabs(const sctp_assoc_info_t* selected_assoc) else ui->labelEP2->setText(QString(tr("List of used IP-Addresses"))); - if (selected_assoc->addr2 != NULL) { + if (selected_assoc->addr2 != Q_NULLPTR) { GList *list; list = g_list_first(selected_assoc->addr2); while (list) { address *store; - store = (address *)(list->data); + store = gxx_list_data(address *, list); if (store->type != AT_NONE) { if ((store->type == AT_IPv4) || (store->type == AT_IPv6)) { ui->listWidgetEP2->addItem(address_to_qstring(store)); } } - list = g_list_next(list); + list = gxx_list_next(list); } } else { return; |