X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=gtk%2Fwsp_stat.c;h=d49146ff58c5119e2a1be79308d0a52f40d1247a;hb=8692203f9756192fb8b0b9eceaabd16b644a62bc;hp=da7b3761db523a233104b1d3f65260cf86397602;hpb=dde308b9bf77e4d88afa705b48ccf19cf98c6e27;p=obnox%2Fwireshark%2Fwip.git diff --git a/gtk/wsp_stat.c b/gtk/wsp_stat.c index da7b3761db..d49146ff58 100644 --- a/gtk/wsp_stat.c +++ b/gtk/wsp_stat.c @@ -37,7 +37,6 @@ #include #include "../simple_dialog.h" -#include "../register.h" #include "../globals.h" #include "../stat_menu.h" @@ -101,13 +100,13 @@ wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar * unused _U_ /* Maybe we should display the hexadecimal value ? */ - /* g_snprintf(string_buff, 256, "%s (0X%x)", data->name, *key); */ + /* g_snprintf(string_buff, sizeof(string_buff), "%s (0X%x)", data->name, *key); */ tmp = gtk_label_new( data->name /* string_buff */ ); gtk_table_attach_defaults(GTK_TABLE(data->sp->table_status_code), tmp, x, x+1, y, y+1); gtk_label_set_justify(GTK_LABEL(tmp), GTK_JUSTIFY_LEFT); gtk_widget_show(tmp); - g_snprintf( string_buff, 256, "%9d", data->packets ); + g_snprintf( string_buff, sizeof(string_buff), "%9d", data->packets ); data->widget = gtk_label_new( string_buff ); gtk_table_attach_defaults(GTK_TABLE(data->sp->table_status_code), data->widget, x+1, x+2, y, y+1); gtk_label_set_justify(GTK_LABEL(data->widget), GTK_JUSTIFY_LEFT); @@ -116,7 +115,7 @@ wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar * unused _U_ data->sp->index++; } else { /* Just update the label string */ - g_snprintf( string_buff, 256, "%9d", data->packets ); + g_snprintf( string_buff, sizeof(string_buff), "%9d", data->packets ); gtk_label_set_text( GTK_LABEL(data->widget), string_buff); } } @@ -162,7 +161,7 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const { wspstat_t *sp=psp; const wsp_info_value_t *value=pri; - gint index = pdut2index(value->pdut); + gint idx = pdut2index(value->pdut); int retour=0; if (value->status_code != 0) { @@ -191,8 +190,8 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const - if (index!=0) { - sp->pdu_stats[ index ].packets++; + if (idx!=0) { + sp->pdu_stats[ idx ].packets++; retour = 1; } return retour; @@ -207,17 +206,17 @@ wspstat_draw(void *psp) wspstat_t *sp=psp; guint32 i; char str[256]; - guint index; + guint idx; for(i=1;i<=sp->num_pdus ; i++) { - g_snprintf(str, 256, "%9d", sp->pdu_stats[i ].packets); + g_snprintf(str, sizeof(str), "%9d", sp->pdu_stats[i ].packets); gtk_label_set_text( GTK_LABEL(sp->pdu_stats[i].widget), str); } - index=sp->index; + idx=sp->index; g_hash_table_foreach( sp->hash, (GHFunc) wsp_draw_statuscode, NULL ); - if (index != sp->index){ + if (idx != sp->index){ /* We have inserted a new entry corresponding to a status code , * let's resize the table */ gtk_table_resize ( GTK_TABLE(sp->table_status_code), sp->index % 2 , 4); @@ -250,7 +249,7 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) } static void -add_table_entry(wspstat_t *sp, const char *str, int x, int y, int index) +add_table_entry(wspstat_t *sp, const char *str, int x, int y, int idx) { GtkWidget *tmp; @@ -258,8 +257,8 @@ add_table_entry(wspstat_t *sp, const char *str, int x, int y, int index) gtk_table_attach_defaults(GTK_TABLE(sp->table_pdu_types), tmp, x, x+1, y, y+1); gtk_label_set_justify(GTK_LABEL(tmp), GTK_JUSTIFY_LEFT); gtk_widget_show(tmp); - if (index != 0) { - sp->pdu_stats [index] .widget = GTK_LABEL( tmp ) ; + if (idx != 0) { + sp->pdu_stats [idx] .widget = GTK_LABEL( tmp ) ; } } @@ -283,7 +282,7 @@ wsp_init_table(wspstat_t *sp) x=2; } /* Maybe we should display the hexadecimal value ? */ - /* g_snprintf(buffer, 50, "%s (0X%x)", match_strval( index2pdut( i ), vals_pdu_type), index2pdut(i) );*/ + /* g_snprintf(buffer, sizeof(buffer), "%s (0X%x)", match_strval( index2pdut( i ), vals_pdu_type), index2pdut(i) );*/ add_table_entry( sp, match_strval(index2pdut(i), vals_pdu_type), /* or buffer, */ x, @@ -323,7 +322,9 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_) } sp = g_malloc( sizeof(wspstat_t) ); - sp->win = window_new(GTK_WINDOW_TOPLEVEL, "wsp-stat"); + sp->win = dlg_window_new("wsp-stat"); /* transient_for top_level */ + gtk_window_set_destroy_with_parent (GTK_WINDOW(sp->win), TRUE); + sp->hash = g_hash_table_new( g_int_hash, g_int_equal); for (i=0 ; vals_status[i].strptr ; i++ ) { @@ -385,6 +386,7 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_) "wsp", sp, filter, + 0, wspstat_reset, wspstat_packet, wspstat_draw); @@ -411,7 +413,7 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_) gtk_widget_show_all(sp->win); window_present(sp->win); - cf_retap_packets(&cfile, FALSE); + cf_retap_packets(&cfile); gdk_window_raise(sp->win->window); } @@ -425,6 +427,6 @@ static tap_dfilter_dlg wsp_stat_dlg = { void register_tap_listener_gtkwspstat(void) { - register_dfilter_stat(&wsp_stat_dlg, "WAP-WSP", + register_dfilter_stat(&wsp_stat_dlg, "_WAP-WSP", REGISTER_STAT_GROUP_TELEPHONY); }