(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/wsp_stat.c) |
| |
| 306 | | | gtk_wspstat_init(const char *optarg, void *userdata _U_) |
| 307 | | | { |
| 308 | | | wspstat_t *sp; |
| 309 | | | const char *filter=NULL; |
| 310 | | | char *title=NULL; |
| 311 | | | GString *error_string; |
| 312 | | | GtkWidget *main_vb, *pdutypes_fr, *statuscode_fr ; |
| 313 | | | GtkWidget *bt_close; |
| 314 | | | GtkWidget *bbox; |
| 315 | | | guint32 i; |
| 316 | | | wsp_status_code_t *sc; |
| 317 | | | |
| 318 | | | |
| 319 | | | if (strncmp (optarg, "wsp,stat,", 9) == 0){ |
| 320 | | | filter=optarg+9; |
| 321 | | | } else { |
| 322 | | | filter=NULL; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 323 | | | } |
| 324 | | | |
| 325 | | | sp = g_malloc( sizeof(wspstat_t) ); |
| 326 | | | sp->win = window_new(GTK_WINDOW_TOPLEVEL, "wsp-stat"); |
| 327 | | | sp->hash = g_hash_table_new( g_int_hash, g_int_equal); |
| 328 | | | for (i=0 ; vals_status[i].strptr ; i++ ) |
| 329 | | | { |
| 330 | | | gint *key; |
| 331 | | | sc=g_malloc( sizeof(wsp_status_code_t) ); |
| 332 | | | key=g_malloc( sizeof(gint) ); |
| 333 | | | sc->name=vals_status[i].strptr; |
| 334 | | | sc->packets=0; |
| 335 | | | sc->widget=NULL; |
| 336 | | | sc->sp = sp; |
| 337 | | | *key=vals_status[i].value; |
| 338 | | | g_hash_table_insert( |
| 339 | | | sp->hash, |
| 340 | | | key, |
| 341 | | | sc); |
| 342 | | | } |
| 343 | | | sp->num_pdus = 16; |
| 344 | | | sp->pdu_stats=g_malloc( (sp->num_pdus+1) * sizeof( wsp_pdu_t) ); |
| 345 | | | if(filter){ |
| 346 | | | sp->filter=g_strdup(filter); |
| 347 | | | title=g_strdup_printf("Wireshark: WAP-WSP statistics with filter: %s", filter); |
| 348 | | | } else { |
| 349 | | | sp->filter=NULL; |
| 350 | | | title=g_strdup("Wireshark: WAP-WSP statistics"); |
| 351 | | | } |
| 352 | | | for (i=0;i<=sp->num_pdus; i++) |
| 353 | | | { |
| 354 | | | sp->pdu_stats[i].packets=0; |
| 355 | | | } |
| 356 | | | |
| 357 | | | gtk_window_set_title(GTK_WINDOW(sp->win), title);
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 ()) |
| |
|
| 358 | | | g_free(title); |
| 359 | | | |
| 360 | | | |
| 361 | | | main_vb = gtk_vbox_new(FALSE, 3); |
| 362 | | | gtk_container_set_border_width(GTK_CONTAINER(main_vb), 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 ()) |
| |
|
| 363 | | | gtk_container_add(GTK_CONTAINER(sp->win), main_vb);
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 ()) |
| |
|
| 364 | | | |
| 365 | | | |
| 366 | | | pdutypes_fr = gtk_frame_new("Summary of PDU Types (wsp.pdu_type)"); |
| 367 | | | gtk_container_add(GTK_CONTAINER(main_vb), pdutypes_fr);
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 ()) |
| |
|
| 368 | | | |
| 369 | | | sp->table_pdu_types = gtk_table_new( (sp->num_pdus+1) / 2 + 1, 4, FALSE); |
| 370 | | | gtk_container_add( GTK_CONTAINER( pdutypes_fr), sp->table_pdu_types);
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 ()) |
| |
|
| 371 | | | gtk_container_set_border_width( GTK_CONTAINER(sp->table_pdu_types) , 10);
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 ()) |
| |
|
| 372 | | | |
| 373 | | | wsp_init_table(sp); |
| 374 | | | |
| 375 | | | |
| 376 | | | statuscode_fr = gtk_frame_new("Summary of Status Code (wsp.reply.status)"); |
| 377 | | | gtk_container_add(GTK_CONTAINER(main_vb), statuscode_fr);
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 ()) |
| |
|
| 378 | | | |
| 379 | | | sp->table_status_code = gtk_table_new( 0, 4, FALSE); |
| 380 | | | gtk_container_add( GTK_CONTAINER( statuscode_fr), sp->table_status_code);
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 ()) |
| |
|
| 381 | | | gtk_container_set_border_width( GTK_CONTAINER(sp->table_status_code) , 10);
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 ()) |
| |
|
| 382 | | | sp->index = 0; |
| 383 | | | |
| 384 | | | error_string = register_tap_listener( |
| 385 | | | "wsp", |
| 386 | | | sp, |
| 387 | | | filter, |
| 388 | | | wspstat_reset, |
| 389 | | | wspstat_packet, |
| 390 | | | wspstat_draw); |
| 391 | | | if (error_string){ |
| 392 | | | |
| 393 | | | simple_dialog( ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str ); |
| 394 | | | g_free(sp->pdu_stats); |
| 395 | | | g_free(sp->filter); |
| 396 | | | g_free(sp); |
| 397 | | | g_string_free(error_string, TRUE); |
| 398 | | | return ; |
| 399 | | | } |
| 400 | | | |
| 401 | | | |
| 402 | | | 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" |
| |
|
| 403 | | | gtk_box_pack_start(GTK_BOX(main_vb), 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 ()) |
| |
|
| 404 | | | |
| 405 | | | bt_close = 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" |
| |
|
| 406 | | | window_set_cancel_button(sp->win, bt_close, window_cancel_button_cb); |
| 407 | | | |
| 408 | | | g_signal_connect(sp->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)) |
| |
|
| 409 | | | g_signal_connect(sp->win, "destroy", G_CALLBACK(win_destroy_cb), sp);
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)) |
| |
|
| 410 | | | |
| 411 | | | gtk_widget_show_all(sp->win); |
| 412 | | | window_present(sp->win); |
| 413 | | | |
| 414 | | | cf_retap_packets(&cfile, FALSE); |
| 415 | | | gdk_window_raise(sp->win->window); |
| 416 | | | } |
| |