From a53545c0c81ac71aaa10ae91d080f1640551b5b8 Mon Sep 17 00:00:00 2001 From: Roland Knall Date: Wed, 14 Aug 2019 10:18:51 +0200 Subject: 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 Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall --- ui/qt/sctp_all_assocs_dialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/qt/sctp_all_assocs_dialog.cpp') diff --git a/ui/qt/sctp_all_assocs_dialog.cpp b/ui/qt/sctp_all_assocs_dialog.cpp index 1fff6824e8..b7b10a8a65 100644 --- a/ui/qt/sctp_all_assocs_dialog.cpp +++ b/ui/qt/sctp_all_assocs_dialog.cpp @@ -61,19 +61,19 @@ void SCTPAllAssocsDialog::fillTable() cf_retap_packets(cap_file_); } numAssocs = 0; - ui->assocList->setRowCount(g_list_length(sctp_assocs->assoc_info_list)); + ui->assocList->setRowCount(static_cast(g_list_length(sctp_assocs->assoc_info_list))); list = g_list_first(sctp_assocs->assoc_info_list); while (list) { - assinfo = (const sctp_assoc_info_t*)(list->data); + assinfo = gxx_list_data(const sctp_assoc_info_t*, list); ui->assocList->setItem(numAssocs, 0, new QTableWidgetItem(QString("%1").arg(assinfo->assoc_id))); ui->assocList->setItem(numAssocs, 1, new QTableWidgetItem(QString("%1").arg(assinfo->port1))); ui->assocList->setItem(numAssocs, 2, new QTableWidgetItem(QString("%1").arg(assinfo->port2))); ui->assocList->setItem(numAssocs, 3, new QTableWidgetItem(QString("%1").arg(assinfo->n_packets))); ui->assocList->setItem(numAssocs, 4, new QTableWidgetItem(QString("%1").arg(assinfo->n_data_chunks))); ui->assocList->setItem(numAssocs, 5, new QTableWidgetItem(QString("%1").arg(assinfo->n_data_bytes))); - list = g_list_next(list); + list = gxx_list_next(list); numAssocs++; } ui->analyseButton->setEnabled(false); -- cgit v1.2.3