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>
This commit is contained in:
Gerald Combs 2017-12-14 14:13:39 -08:00
parent afc6e773dc
commit 90102ad12e
5 changed files with 21 additions and 33 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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 */