(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/camel_counter.c) |
| |
| 152 | | | static void gtk_camelcounter_init(const char *optarg, void *userdata _U_) |
| 153 | | | { |
| 154 | | | struct camelcounter_t *p_camelcounter; |
| 155 | | | const char *filter=NULL; |
| 156 | | | const char *emptyfilter=""; |
| 157 | | | GString *error_string; |
| 158 | | | GtkWidget *bbox; |
| 159 | | | GtkWidget *close_bt; |
| 160 | | | |
| 161 | | | if(strncmp(optarg,"camel,counter,",14) == 0){ |
| 162 | | | filter=optarg+14; |
| 163 | | | } else { |
| 164 | | | filter=NULL; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 165 | | | } |
| 166 | | | |
| 167 | | | p_camelcounter=g_malloc(sizeof(struct camelcounter_t)); |
| 168 | | | p_camelcounter->filter=g_strdup(filter); |
| 169 | | | |
| 170 | | | gtk_camelcounter_reset(p_camelcounter); |
| 171 | | | |
| 172 | | | p_camelcounter->win=window_new(GTK_WINDOW_TOPLEVEL, "Wireshark: CAMEL counters"); |
| 173 | | | gtk_window_set_default_size(GTK_WINDOW(p_camelcounter->win), 500, 300);
x /usr/include/gtk-2.0/gtk/gtkwindow.h |
| |
42 | #define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkwindow.h |
| |
41 | #define GTK_TYPE_WINDOW (gtk_window_get_type ()) |
| |
|
| 174 | | | |
| 175 | | | p_camelcounter->vbox=gtk_vbox_new(FALSE, 3); |
| 176 | | | gtk_container_set_border_width(GTK_CONTAINER(p_camelcounter->vbox), 12);
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
42 | #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
41 | #define GTK_TYPE_CONTAINER (gtk_container_get_type ()) |
| |
|
| 177 | | | |
| 178 | | | init_main_stat_window(p_camelcounter->win, p_camelcounter->vbox, "CAMEL Messages Counters", filter); |
| 179 | | | |
| 180 | | | |
| 181 | | | p_camelcounter->scrolled_window = scrolled_window_new(NULL, NULL); |
| 182 | | | |
| 183 | | | p_camelcounter->table = create_stat_table(p_camelcounter->scrolled_window, p_camelcounter->vbox, 2, titles); |
| 184 | | | |
| 185 | | | if (filter) { |
| 186 | | | error_string=register_tap_listener("CAMEL", p_camelcounter, filter, |
| 187 | | | gtk_camelcounter_reset, |
| 188 | | | gtk_camelcounter_packet, |
| 189 | | | gtk_camelcounter_draw); |
| 190 | | | } else { |
| 191 | | | error_string=register_tap_listener("CAMEL", p_camelcounter, emptyfilter, |
| 192 | | | gtk_camelcounter_reset, |
| 193 | | | gtk_camelcounter_packet, |
| 194 | | | gtk_camelcounter_draw); |
| 195 | | | } |
| 196 | | | |
| 197 | | | if(error_string){ |
| 198 | | | simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); |
| 199 | | | g_string_free(error_string, TRUE); |
| 200 | | | g_free(p_camelcounter); |
| 201 | | | return; |
| 202 | | | } |
| 203 | | | |
| 204 | | | |
| 205 | | | bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL);
x /usr/include/gtk-2.0/gtk/gtkstock.h |
| |
146 | #define GTK_STOCK_CLOSE "gtk-close" |
| |
|
| 206 | | | gtk_box_pack_end(GTK_BOX(p_camelcounter->vbox), bbox, FALSE, FALSE, 0);
x /usr/include/gtk-2.0/gtk/gtkbox.h |
| |
42 | #define GTK_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOX, GtkBox)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkbox.h |
| |
41 | #define GTK_TYPE_BOX (gtk_box_get_type ()) |
| |
|
| 207 | | | |
| 208 | | | close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
x /usr/include/glib-2.0/gobject/gobject.h |
| |
52 | #define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
181 | #define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
222 | #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) |
| |
x /usr/include/gtk-2.0/gtk/gtkstock.h |
| |
146 | #define GTK_STOCK_CLOSE "gtk-close" |
| |
|
| 209 | | | window_set_cancel_button(p_camelcounter->win, close_bt, window_cancel_button_cb); |
| 210 | | | |
| 211 | | | g_signal_connect(p_camelcounter->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
x /usr/include/glib-2.0/gobject/gsignal.h |
| |
421 | #define g_signal_connect(instance, detailed_signal, c_handler, data) \ |
422 | g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0) |
| |
x /usr/include/glib-2.0/gobject/gclosure.h |
| |
72 | #define G_CALLBACK(f) ((GCallback) (f)) |
| |
|
| 212 | | | g_signal_connect(p_camelcounter->win, "destroy", G_CALLBACK(win_destroy_cb), p_camelcounter);
x /usr/include/glib-2.0/gobject/gsignal.h |
| |
421 | #define g_signal_connect(instance, detailed_signal, c_handler, data) \ |
422 | g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0) |
| |
x /usr/include/glib-2.0/gobject/gclosure.h |
| |
72 | #define G_CALLBACK(f) ((GCallback) (f)) |
| |
|
| 213 | | | |
| 214 | | | gtk_widget_show_all(p_camelcounter->win); |
| 215 | | | window_present(p_camelcounter->win); |
| 216 | | | |
| 217 | | | cf_retap_packets(&cfile, FALSE); |
| 218 | | | gdk_window_raise(p_camelcounter->win->window); |
| 219 | | | } |
| |