diff options
author | Anders Broman <anders.broman@ericsson.com> | 2013-03-11 06:47:34 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2013-03-11 06:47:34 +0000 |
commit | ac2515ee6f4bc1fef73356802282d9a4dc5e9a53 (patch) | |
tree | d1aa091e583e1868cbcb8f26d91a752b2d222499 /ui | |
parent | 01c1661412b60c8f233fd0cba090c83c52f73f0e (diff) |
Use explicit casts.
svn path=/trunk/; revision=48239
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/gui_utils.c | 2 | ||||
-rw-r--r-- | ui/gtk/hostlist_table.c | 68 | ||||
-rw-r--r-- | ui/gtk/main.c | 43 |
3 files changed, 57 insertions, 56 deletions
diff --git a/ui/gtk/gui_utils.c b/ui/gtk/gui_utils.c index 43270711a9..eb1c2b2ee6 100644 --- a/ui/gtk/gui_utils.c +++ b/ui/gtk/gui_utils.c @@ -1244,7 +1244,7 @@ switch_to_fixed_col(GtkTreeView *view) columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(view)); list = columns; while(columns) { - column = columns->data; + column = (GtkTreeViewColumn *)columns->data; size = gtk_tree_view_column_get_width(column); gtk_tree_view_column_set_sizing(column,GTK_TREE_VIEW_COLUMN_FIXED); if (size > gtk_tree_view_column_get_fixed_width(column)) diff --git a/ui/gtk/hostlist_table.c b/ui/gtk/hostlist_table.c index f5582b8312..5fb4300050 100644 --- a/ui/gtk/hostlist_table.c +++ b/ui/gtk/hostlist_table.c @@ -248,7 +248,7 @@ reset_hostlist_table_data(hostlist_table *hosts) static void reset_hostlist_table_data_cb(void *arg) { - reset_hostlist_table_data(arg); + reset_hostlist_table_data((hostlist_table *)arg); } static void @@ -300,7 +300,7 @@ hostlist_sort_column(GtkTreeModel *model, { guint32 idx1, idx2; gint data_column = GPOINTER_TO_INT(user_data); - hostlist_table *hl = g_object_get_data(G_OBJECT(model), HOST_PTR_KEY); + hostlist_table *hl = (hostlist_table *)g_object_get_data(G_OBJECT(model), HOST_PTR_KEY); hostlist_talker_t *host1 = NULL; hostlist_talker_t *host2 = NULL; @@ -557,7 +557,7 @@ static const char *ui_desc_hostlist_table_popup = * GCallback callback; The function to call when the action is activated. * */ -static const GtkActionEntry service_resp_t__popup_entries[] = { +static const GtkActionEntry service_resp_t_popup_entries[] = { { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL }, { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL }, { "/Find Frame", NULL, "Find Frame", NULL, NULL, NULL }, @@ -595,8 +595,8 @@ hostlist_create_popup_menu(hostlist_table *hl) action_group = gtk_action_group_new ("HostlistTablePopupActionGroup"); gtk_action_group_add_actions (action_group, /* the action group */ - (gpointer)service_resp_t__popup_entries, /* an array of action descriptions */ - G_N_ELEMENTS(service_resp_t__popup_entries),/* the number of entries */ + service_resp_t_popup_entries, /* an array of action descriptions */ + G_N_ELEMENTS(service_resp_t_popup_entries),/* the number of entries */ hl); /* data to pass to the action callbacks */ ui_manager = gtk_ui_manager_new (); @@ -725,7 +725,7 @@ draw_hostlist_table_data(hostlist_table *hl) const gchar *title_p; gint id; - column = columns->data; + column = (GtkTreeViewColumn *)columns->data; title_p = gtk_tree_view_column_get_title(column); id = gtk_tree_view_column_get_sort_column_id(column); if (title_p[0] != 0 && id >= GEOIP1_COLUMN) { @@ -744,7 +744,7 @@ draw_hostlist_table_data(hostlist_table *hl) geoip[j] = g_strdup(name); } else if (host->address.type == AT_IPv6 && j < geoip_db_num_dbs()) { const guchar *name; - const struct e_in6_addr *addr = (struct e_in6_addr *) host->address.data; + const struct e_in6_addr *addr = (const struct e_in6_addr *) host->address.data; name = geoip_db_lookup_ipv6(j, *addr, "-"); geoip[j] = g_strdup(name); @@ -817,7 +817,7 @@ draw_hostlist_table_data(hostlist_table *hl) static void draw_hostlist_table_data_cb(void *arg) { - draw_hostlist_table_data(arg); + draw_hostlist_table_data((hostlist_table *)arg); } typedef struct { @@ -886,7 +886,7 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) GtkListStore *store; csv_t csv; - csv.talkers=g_object_get_data(G_OBJECT(copy_bt), HOST_PTR_KEY); + csv.talkers=(hostlist_table *)g_object_get_data(G_OBJECT(copy_bt), HOST_PTR_KEY); if (!csv.talkers) return; @@ -898,7 +898,7 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) list = columns; csv.nb_cols = 0; while(columns) { - column = columns->data; + column = (GtkTreeViewColumn *)columns->data; if (gtk_tree_view_column_get_visible(column)) { csv.columns_order[csv.nb_cols] = gtk_tree_view_column_get_sort_column_id(column); if (csv.nb_cols) @@ -1057,7 +1057,7 @@ open_as_map_cb(GtkWindow *copy_bt, gpointer data _U_) map_t map; FILE *tpl_file; - map.talkers =g_object_get_data(G_OBJECT(copy_bt), HOST_PTR_KEY); + map.talkers = (hostlist_table *)g_object_get_data(G_OBJECT(copy_bt), HOST_PTR_KEY); if (!map.talkers) return; @@ -1068,7 +1068,7 @@ open_as_map_cb(GtkWindow *copy_bt, gpointer data _U_) list = columns; map.nb_cols = 0; while(columns) { - column = columns->data; + column = (GtkTreeViewColumn *)columns->data; i = gtk_tree_view_column_get_sort_column_id(column); if(strcmp(map.talkers->default_titles[i], "Latitude") == 0) { map.col_lat = i; @@ -1141,7 +1141,7 @@ open_as_map_cb(GtkWindow *copy_bt, gpointer data _U_) } store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(map.talkers->table))); - tpl_line = g_malloc(MAX_TPL_LINE_LEN); + tpl_line = (char *)g_malloc(MAX_TPL_LINE_LEN); while (fgets(tpl_line, MAX_TPL_LINE_LEN, tpl_file) != NULL) { fputs(tpl_line, map.out_file); @@ -1396,7 +1396,7 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap GtkWidget *map_bt; #endif - hosttable=g_malloc(sizeof(hostlist_table)); + hosttable=g_new(hostlist_table,1); hosttable->name=table_name; hosttable->filter=filter; @@ -1434,16 +1434,16 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE); + close_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE); window_set_cancel_button(hosttable->win, close_bt, window_cancel_button_cb); - copy_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY); + copy_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY); gtk_widget_set_tooltip_text(copy_bt, "Copy all statistical values of this page to the clipboard in CSV (Comma Separated Values) format."); g_object_set_data(G_OBJECT(copy_bt), HOST_PTR_KEY, hosttable); g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), NULL); #ifdef HAVE_GEOIP - map_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_MAP); + map_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_MAP); if(map_bt != NULL) { gtk_widget_set_tooltip_text(map_bt, "Show a map of the IP addresses (internet connection required)."); g_object_set_data(G_OBJECT(map_bt), HOST_PTR_KEY, hosttable); @@ -1451,7 +1451,7 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap } #endif /* HAVE_GEOIP */ - help_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP); + help_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP); g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_STATS_ENDPOINTS_DIALOG); g_signal_connect(hosttable->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL); @@ -1469,7 +1469,7 @@ static void ct_nb_switch_page_cb(GtkNotebook *nb, gpointer *pg _U_, guint page, gpointer data) { GtkWidget *copy_bt = (GtkWidget *) data; - void ** pages = g_object_get_data(G_OBJECT(nb), NB_PAGES_KEY); + void ** pages = (void **)g_object_get_data(G_OBJECT(nb), NB_PAGES_KEY); page++; @@ -1483,7 +1483,7 @@ static void ct_nb_map_switch_page_cb(GtkNotebook *nb, gpointer *pg _U_, guint page, gpointer data) { GtkWidget *map_bt = (GtkWidget *) data; - void ** pages = g_object_get_data(G_OBJECT(nb), NB_PAGES_KEY); + void ** pages = (void **)g_object_get_data(G_OBJECT(nb), NB_PAGES_KEY); page++; @@ -1503,7 +1503,7 @@ ct_nb_map_switch_page_cb(GtkNotebook *nb, gpointer *pg _U_, guint page, gpointer static void hostlist_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) { - void ** pages = data; + void ** pages = (void **)data; int page; /* first "page" contains the number of pages */ @@ -1524,7 +1524,7 @@ init_hostlist_notebook_page_cb(gboolean hide_ports, const char *table_name, cons GtkWidget *page_vbox; hostlist_table *hosttable; - hosttable=g_malloc(sizeof(hostlist_table)); + hosttable=g_new(hostlist_table,1); hosttable->name=table_name; hosttable->filter=filter; hosttable->use_dfilter=FALSE; @@ -1559,7 +1559,7 @@ register_hostlist_table(gboolean hide_ports, const char *table_name, const char { register_hostlist_t *table; - table = g_malloc(sizeof(register_hostlist_t)); + table = g_new(register_hostlist_t,1); table->hide_ports = hide_ports; table->table_name = table_name; @@ -1575,7 +1575,7 @@ static void hostlist_resolve_toggle_dest(GtkWidget *widget, gpointer data) { int page; - void ** pages = data; + void ** pages = (void **)data; gboolean resolve_names; hostlist_table *hosttable; @@ -1583,7 +1583,7 @@ hostlist_resolve_toggle_dest(GtkWidget *widget, gpointer data) resolve_names = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)); for (page=1; page<=GPOINTER_TO_INT(pages[0]); page++) { - hosttable = pages[page]; + hosttable = (hostlist_table *)pages[page]; hosttable->resolve_names = resolve_names; draw_hostlist_table_addresses(hosttable); } @@ -1594,14 +1594,14 @@ static void hostlist_filter_toggle_dest(GtkWidget *widget, gpointer data) { int page; - void ** pages = data; + void ** pages = (void **)data; gboolean use_filter; hostlist_table *hosttable = NULL; use_filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)); for (page=1; page<=GPOINTER_TO_INT(pages[0]); page++) { - hosttable = pages[page]; + hosttable = (hostlist_table *)pages[page]; hosttable->use_dfilter = use_filter; reset_hostlist_table_data(hosttable); } @@ -1638,7 +1638,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) #endif - pages = g_malloc(sizeof(void *) * (g_slist_length(registered_hostlist_tables) + 1)); + pages = (void **)g_malloc(sizeof(void *) * (g_slist_length(registered_hostlist_tables) + 1)); win = dlg_window_new("hostlist"); /* transient_for top_level */ gtk_window_set_destroy_with_parent (GTK_WINDOW(win), TRUE); @@ -1661,7 +1661,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) current_table = registered_hostlist_tables; while(current_table) { - registered = current_table->data; + registered = (register_hostlist_t *)current_table->data; page_lb = gtk_label_new(""); hosttable = init_hostlist_notebook_page_cb(registered->hide_ports, registered->table_name, registered->tap_name, registered->filter, registered->packet_func); @@ -1702,16 +1702,16 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) #endif gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE); + close_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE); window_set_cancel_button(win, close_bt, window_cancel_button_cb); - copy_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY); + copy_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY); gtk_widget_set_tooltip_text(copy_bt, "Copy all statistical values of this page to the clipboard in CSV (Comma Separated Values) format."); g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), NULL); g_object_set_data(G_OBJECT(copy_bt), HOST_PTR_KEY, pages[page]); #ifdef HAVE_GEOIP - map_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_MAP); + map_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_MAP); gtk_widget_set_tooltip_text(map_bt, "Show a map of the IP addresses (internet connection required)."); g_object_set_data(G_OBJECT(map_bt), HOST_PTR_KEY, pages[page]); g_signal_connect(map_bt, "clicked", G_CALLBACK(open_as_map_cb), NULL); @@ -1721,7 +1721,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) g_signal_connect(nb, "switch-page", G_CALLBACK(ct_nb_switch_page_cb), copy_bt); - help_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP); + help_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP); g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_STATS_ENDPOINTS_DIALOG); g_signal_connect(win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL); @@ -1825,7 +1825,7 @@ add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, g talker=&g_array_index(hl->hosts, hostlist_talker_t, talker_idx); /* hl->hosts address is not a constant but address.data is */ - new_key = g_malloc(sizeof (host_key_t)); + new_key = g_new(host_key_t,1); SET_ADDRESS(&new_key->address, talker->address.type, talker->address.len, talker->address.data); new_key->port = port; g_hash_table_insert(hl->hashtable, new_key, GUINT_TO_POINTER(talker_idx +1)); diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 78e50e782f..488706dfb1 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -334,7 +334,7 @@ match_selected_ptree_cb(gpointer data, MATCH_SELECTED_E action) if (cfile.finfo_selected) { filter = proto_construct_match_selected_string(cfile.finfo_selected, cfile.edt); - match_selected_cb_do(g_object_get_data(G_OBJECT(data), E_DFILTER_TE_KEY), action, filter); + match_selected_cb_do((GtkWidget *)g_object_get_data(G_OBJECT(data), E_DFILTER_TE_KEY), action, filter); } } @@ -370,7 +370,7 @@ colorize_selected_ptree_cb(GtkWidget *w _U_, gpointer data _U_, guint8 filt_nr) static void selected_ptree_info_answered_cb(gpointer dialog _U_, gint btn, gpointer data) { gchar *selected_proto_url; - gchar *proto_abbrev = data; + gchar *proto_abbrev = (gchar *)data; switch(btn) { @@ -450,7 +450,7 @@ selected_ptree_info_cb(GtkWidget *widget _U_, gpointer data _U_) static void selected_ptree_ref_answered_cb(gpointer dialog _U_, gint btn, gpointer data) { gchar *selected_proto_url; - gchar *proto_abbrev = data; + gchar *proto_abbrev = (gchar *)data; switch(btn) { case(ESD_BTN_OK): @@ -632,7 +632,7 @@ match_selected_plist_cb(gpointer data, MATCH_SELECTED_E action) { match_selected_cb_do(g_object_get_data(G_OBJECT(data), E_DFILTER_TE_KEY), action, - get_filter_from_packet_list_row_and_column(data)); + get_filter_from_packet_list_row_and_column((GtkWidget *)data)); } /* This function allows users to right click in the details window and copy the text @@ -743,7 +743,7 @@ reftime_frame_cb(GtkWidget *w _U_, gpointer data _U_, REFTIME_ACTION_E action) case REFTIME_TOGGLE: if (cfile.current_frame) { if(recent.gui_time_format != TS_RELATIVE && cfile.current_frame->flags.ref_time==0) { - reftime_dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO, + reftime_dialog = (GtkWidget *)simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO, "%sSwitch to the appropriate Time Display Format?%s\n\n" "Time References don't work well with the currently selected Time Display Format.\n\n" "Do you want to switch to \"Seconds Since Beginning of Capture\" now?", @@ -1567,7 +1567,7 @@ main_capture_set_main_window_title(capture_options *capture_opts) GString *title = g_string_new(""); g_string_append(title, "Capturing "); - g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf)); + g_string_append_printf(title, "from %s ", cf_get_tempfile_source((capture_file *)capture_opts->cf)); main_set_window_name(title->str); g_string_free(title, TRUE); } @@ -1614,7 +1614,7 @@ main_capture_cb_capture_update_started(capture_options *capture_opts) static void main_capture_cb_capture_update_finished(capture_options *capture_opts) { - capture_file *cf = capture_opts->cf; + capture_file *cf = (capture_file *)capture_opts->cf; static GList *icon_list = NULL; /* The capture isn't stopping any more - it's stopped. */ @@ -1742,7 +1742,7 @@ main_capture_cb_capture_failed(capture_options *capture_opts _U_) static void main_cf_cb_packet_selected(gpointer data) { - capture_file *cf = data; + capture_file *cf = (capture_file *)data; /* Display the GUI protocol tree and packet bytes. XXX - why do we dump core if we call "proto_tree_draw()" @@ -1790,55 +1790,56 @@ main_cf_cb_field_unselected(capture_file *cf) static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_) { + capture_file *cf = (capture_file *)data; switch(event) { case(cf_cb_file_opened): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Opened"); - fileset_file_opened(data); + fileset_file_opened(cf); break; case(cf_cb_file_closing): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closing"); - main_cf_cb_file_closing(data); + main_cf_cb_file_closing(cf); break; case(cf_cb_file_closed): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closed"); - main_cf_cb_file_closed(data); + main_cf_cb_file_closed(cf); fileset_file_closed(); break; case(cf_cb_file_read_started): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read started"); - main_cf_cb_file_read_started(data); + main_cf_cb_file_read_started(cf); break; case(cf_cb_file_read_finished): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read finished"); - main_cf_cb_file_read_finished(data); + main_cf_cb_file_read_finished(cf); break; case(cf_cb_file_reload_started): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Reload started"); - main_cf_cb_file_read_started(data); + main_cf_cb_file_read_started(cf); break; case(cf_cb_file_reload_finished): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Reload finished"); - main_cf_cb_file_read_finished(data); + main_cf_cb_file_read_finished(cf); break; case(cf_cb_file_rescan_started): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Rescan started"); break; case(cf_cb_file_rescan_finished): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Rescan finished"); - main_cf_cb_file_rescan_finished(data); + main_cf_cb_file_rescan_finished(cf); break; case(cf_cb_file_fast_save_finished): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Fast save finished"); - main_cf_cb_file_rescan_finished(data); + main_cf_cb_file_rescan_finished(cf); break; case(cf_cb_packet_selected): - main_cf_cb_packet_selected(data); + main_cf_cb_packet_selected(cf); break; case(cf_cb_packet_unselected): - main_cf_cb_packet_unselected(data); + main_cf_cb_packet_unselected(cf); break; case(cf_cb_field_unselected): - main_cf_cb_field_unselected(data); + main_cf_cb_field_unselected(cf); break; case(cf_cb_file_save_started): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Save started"); @@ -3546,7 +3547,7 @@ void main_widgets_rearrange(void) { static void is_widget_visible(GtkWidget *widget, gpointer data) { - gboolean *is_visible = data; + gboolean *is_visible = ( gboolean *)data; if (!*is_visible) { if (gtk_widget_get_visible(widget)) |