ifdemo plugin: Compiler errors; support Qt5/Qt6 builds

Run through gitlab pipelines then disable ENABLE_PLUGIN_IFDEMO
Build with Qt5 or Qt6
Fix -Wdangling-gsl, -Wshorten-64-to-32
This commit is contained in:
Chuck Craft 2023-03-31 20:28:29 -05:00 committed by Alexis La Goutte
parent f6ff168522
commit 654b667329
2 changed files with 16 additions and 10 deletions

View File

@ -15,9 +15,15 @@ set_module_info(pluginifdemo 0 0 2 0)
SET(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTOUIC ON)
find_package(Qt6Core)
find_package(Qt6PrintSupport)
find_package(Qt6Widgets)
if(USE_qt6)
set(qtver "6")
else()
set(qtver "5")
endif()
find_package(Qt${qtver}Core)
find_package(Qt${qtver}PrintSupport)
find_package(Qt${qtver}Widgets)
set(DISSECTOR_SRC
pluginifdemo.c
@ -52,7 +58,7 @@ register_plugin_files(plugin.c
add_wireshark_plugin_library(pluginifdemo epan)
target_link_libraries(pluginifdemo epan Qt6::Core Qt6::Widgets Qt6::PrintSupport)
target_link_libraries(pluginifdemo epan Qt${qtver}::Core Qt${qtver}::Widgets Qt${qtver}::PrintSupport)
install_plugin(pluginifdemo epan)

View File

@ -42,7 +42,7 @@ void PluginIfTypeModel::addPluginIfType(const PluginIfType &ifType)
int PluginIfTypeModel::rowCount(const QModelIndex &) const
{
return m_pluginIfTypes.count();
return static_cast<int>(m_pluginIfTypes.count());
}
QVariant PluginIfTypeModel::data(const QModelIndex & idx, int role) const
@ -286,7 +286,7 @@ void PluginIFDemo_Main::on_btnRemoveItem_clicked()
bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
QString content = listModel->data(idx).toString();
int pos = content.indexOf(":");
int pos = static_cast<int>(content.indexOf(":"));
gchar * value = g_strdup(content.left(pos).toUtf8().constData() );
/* -2 because removal of : and space */
@ -314,11 +314,11 @@ void PluginIFDemo_Main::on_btnSendList_clicked()
for( int i = 0; i < listModel->rowCount(); i++ )
{
QString content = listModel->data(listModel->index(i, 0)).toString();
int pos = content.indexOf(":");
int pos = static_cast<int>(content.indexOf(":"));
ext_toolbar_value_t * valEntry = g_new0(ext_toolbar_value_t, 1);
valEntry->value = g_strdup(content.left(pos).toStdString().c_str() );
valEntry->display = g_strdup(content.right(content.size() - pos + 1).toStdString().c_str());
valEntry->value = g_strdup(content.left(pos).toUtf8().constData());
valEntry->display = g_strdup(content.right(content.size() - pos + 1).toUtf8().constData());
items = g_list_append(items, valEntry);
}
@ -360,7 +360,7 @@ void PluginIFDemo_Main::on_lstItems_clicked(const QModelIndex &idx)
bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
QString content = listModel->data(listModel->index(idx.row(), 0)).toString();
int pos = content.indexOf(":");
int pos = static_cast<int>(content.indexOf(":"));
gchar * idxData = g_strdup(content.left(pos).toUtf8().constData() );