aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-12-14 14:13:39 -0800
committerGerald Combs <gerald@wireshark.org>2017-12-14 23:43:38 +0000
commit90102ad12ec601abcc2270e4779f8d2fc1c0c937 (patch)
tree49a63bad606de772ae1500e06d8e55a5ffeb65d5
parentafc6e773dc84ddcf57af59e0fd87ab1625204786 (diff)
Remove a plugin_if_gui_cb type conversion.
We always pass a GHashTable * to plugin_if_gui_cb so don't cast it to a gconstpointer. This should fix the following and related warnings: main_window.cpp: In function ‘void plugin_if_mainwindow_apply_filter(gconstpointer)’: main_window.cpp:121:44: warning: cast from type ‘gconstpointer {aka const void*}’ to type ‘GHashTable* {aka _GHashTable*}’ casts away qualifiers [-Wcast-qual] GHashTable * data_set = (GHashTable *) user_data; Fix another const warning while we're here. Change-Id: Ia9225188bfb913feb4fef4369f10fd5791fc8dc9 Reviewed-on: https://code.wireshark.org/review/24830 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--epan/plugin_if.h2
-rw-r--r--ui/gtk/main_filter_toolbar.c7
-rw-r--r--ui/gtk/main_menubar.c7
-rw-r--r--ui/gtk/main_toolbar.c8
-rw-r--r--ui/qt/main_window.cpp30
5 files changed, 21 insertions, 33 deletions
diff --git a/epan/plugin_if.h b/epan/plugin_if.h
index 8cd0c6a..78ebeda 100644
--- a/epan/plugin_if.h
+++ b/epan/plugin_if.h
@@ -400,7 +400,7 @@ typedef enum
} plugin_if_callback_t;
-typedef void (*plugin_if_gui_cb)(gconstpointer user_data);
+typedef void (*plugin_if_gui_cb)(GHashTable * data_set);
WS_DLL_PUBLIC void plugin_if_register_gui_cb(plugin_if_callback_t actionType, plugin_if_gui_cb callback);
diff --git a/ui/gtk/main_filter_toolbar.c b/ui/gtk/main_filter_toolbar.c
index 24b8c86..4ab9dc3 100644
--- a/ui/gtk/main_filter_toolbar.c
+++ b/ui/gtk/main_filter_toolbar.c
@@ -113,7 +113,7 @@ filter_save_cb(GtkWidget *w _U_, GtkWindow *parent_w)
}
static void
-plugin_if_filter_apply(gconstpointer user_data)
+plugin_if_filter_apply(GHashTable * dataSet)
{
/* code is derived from voip_calls_dlg.c::voip_calls_on_filter */
@@ -121,11 +121,8 @@ plugin_if_filter_apply(gconstpointer user_data)
size_t max_filter_length = 2048;
gchar *filter_string;
- if ( main_display_filter_widget != 0 )
+ if ( main_display_filter_widget != 0 && dataSet != 0 )
{
-
- GHashTable * dataSet = (GHashTable *) user_data;
-
if ( g_hash_table_lookup_extended(dataSet, "filter_string", NULL, NULL ) )
{
filter_string = g_strndup((const char *)g_hash_table_lookup(dataSet, "filter_string"), max_filter_length);
diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c
index 31720ad..7b482f4 100644
--- a/ui/gtk/main_menubar.c
+++ b/ui/gtk/main_menubar.c
@@ -141,7 +141,7 @@ static void colorize_cb(GtkWidget *w, gpointer d);
static void rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences,
GtkUIManager *ui_menu, const char *path);
-static void plugin_if_menubar_preference(gconstpointer user_data);
+static void plugin_if_menubar_preference(GHashTable *dataSet);
/* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
@@ -5404,11 +5404,10 @@ ws_menubar_external_menus(void)
}
}
-void plugin_if_menubar_preference(gconstpointer user_data)
+void plugin_if_menubar_preference(GHashTable *dataSet)
{
- if ( user_data != NULL )
+ if ( dataSet != NULL )
{
- GHashTable * dataSet = (GHashTable *) user_data;
const char * module_name;
const char * pref_name;
const char * pref_value;
diff --git a/ui/gtk/main_toolbar.c b/ui/gtk/main_toolbar.c
index bec7e1e..a1f05c0 100644
--- a/ui/gtk/main_toolbar.c
+++ b/ui/gtk/main_toolbar.c
@@ -268,10 +268,9 @@ toolbar_auto_scroll_live_changed(gboolean auto_scroll_live_lcl) {
#endif
static void
-plugin_if_maintoolbar_goto_frame(gconstpointer user_data)
+plugin_if_maintoolbar_goto_frame(GHashTable * data_set)
{
- if (user_data) {
- GHashTable * data_set = (GHashTable *) user_data;
+ if (data_set) {
gpointer framenr;
if (g_hash_table_lookup_extended(data_set, "frame_nr", NULL, &framenr)) {
@@ -283,9 +282,8 @@ plugin_if_maintoolbar_goto_frame(gconstpointer user_data)
#ifdef HAVE_LIBPCAP
-static void plugin_if_maintoolbar_get_ws_info(gconstpointer user_data)
+static void plugin_if_maintoolbar_get_ws_info(GHashTable * data_set)
{
- GHashTable * data_set = (GHashTable *)user_data;
ws_info_t *ws_info = NULL;
capture_file *cf;
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 83c07d7..bfd40ed 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -113,25 +113,22 @@ void pipe_input_set_handler(gint source, gpointer user_data, ws_process_id *chil
gbl_cur_main_window_->setPipeInputHandler(source, user_data, child_process, input_cb);
}
-static void plugin_if_mainwindow_apply_filter(gconstpointer user_data)
+static void plugin_if_mainwindow_apply_filter(GHashTable * data_set)
{
- if (!gbl_cur_main_window_ || !user_data)
+ if (!gbl_cur_main_window_ || !data_set)
return;
- GHashTable * data_set = (GHashTable *) user_data;
-
if (g_hash_table_lookup_extended(data_set, "filter_string", NULL, NULL)) {
QString filter((const char *)g_hash_table_lookup(data_set, "filter_string"));
gbl_cur_main_window_->filterPackets(filter);
}
}
-static void plugin_if_mainwindow_preference(gconstpointer user_data)
+static void plugin_if_mainwindow_preference(GHashTable * data_set)
{
- if (!gbl_cur_main_window_ || !user_data)
+ if (!gbl_cur_main_window_ || !data_set)
return;
- GHashTable * data_set = (GHashTable *) user_data;
const char * module_name;
const char * pref_name;
const char * pref_value;
@@ -147,12 +144,11 @@ static void plugin_if_mainwindow_preference(gconstpointer user_data)
}
}
-static void plugin_if_mainwindow_gotoframe(gconstpointer user_data)
+static void plugin_if_mainwindow_gotoframe(GHashTable * data_set)
{
- if (!gbl_cur_main_window_ || !user_data)
+ if (!gbl_cur_main_window_ || !data_set)
return;
- GHashTable * data_set = (GHashTable *) user_data;
gpointer framenr;
if (g_hash_table_lookup_extended(data_set, "frame_nr", NULL, &framenr)) {
@@ -163,12 +159,11 @@ static void plugin_if_mainwindow_gotoframe(gconstpointer user_data)
#ifdef HAVE_LIBPCAP
-static void plugin_if_mainwindow_get_ws_info(gconstpointer user_data)
+static void plugin_if_mainwindow_get_ws_info(GHashTable * data_set)
{
- if (!gbl_cur_main_window_ || !user_data)
+ if (!gbl_cur_main_window_ || !data_set)
return;
- GHashTable * data_set = (GHashTable *)user_data;
ws_info_t *ws_info = NULL;
if (!g_hash_table_lookup_extended(data_set, "ws_info", NULL, (void**)&ws_info))
@@ -241,12 +236,11 @@ static void plugin_if_mainwindow_get_ws_info(gconstpointer user_data)
#endif /* HAVE_LIBPCAP */
-static void plugin_if_mainwindow_update_toolbars(gconstpointer user_data)
+static void plugin_if_mainwindow_update_toolbars(GHashTable * data_set)
{
- if (!gbl_cur_main_window_ || ! user_data)
+ if (!gbl_cur_main_window_ || ! data_set)
return;
- GHashTable * data_set = (GHashTable *)user_data;
if (g_hash_table_lookup_extended(data_set, "toolbar_name", NULL, NULL)) {
QString toolbarName((const char *)g_hash_table_lookup(data_set, "toolbar_name"));
gbl_cur_main_window_->removeAdditionalToolbar(toolbarName);
@@ -1084,11 +1078,11 @@ void MainWindow::dropEvent(QDropEvent *event)
return;
}
- char **in_filenames = (char **)g_malloc(sizeof(char*) * local_files.size());
+ char **in_filenames = (char **) g_malloc(sizeof(char*) * local_files.size());
char *tmpname = NULL;
for (int i = 0; i < local_files.size(); i++) {
- in_filenames[i] = (char *) local_files.at(i).constData();
+ in_filenames[i] = const_cast<char *>(local_files.at(i).constData());
}
/* merge the files in chronological order */