aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/wsp_stat.c
diff options
context:
space:
mode:
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2004-03-13 15:15:26 +0000
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2004-03-13 15:15:26 +0000
commitbbf2c7fb05c996e634c63fbfec75d9f44bdde29c (patch)
tree2a63a504c6672fed9d3c15392cc5dbe9aa2238f5 /gtk/wsp_stat.c
parent17ecbf88d5f732e060318869aa47320dbb51255c (diff)
replaced sprintf / snprintf by g_snprintf,
various other string related changes git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10373 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/wsp_stat.c')
-rw-r--r--gtk/wsp_stat.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gtk/wsp_stat.c b/gtk/wsp_stat.c
index 45043edcf9..b8458df499 100644
--- a/gtk/wsp_stat.c
+++ b/gtk/wsp_stat.c
@@ -1,7 +1,7 @@
/* wsp_stat.c
* wsp_stat 2003 Jean-Michel FAYARD
*
- * $Id: wsp_stat.c,v 1.23 2004/03/13 12:09:27 ulfl Exp $
+ * $Id: wsp_stat.c,v 1.24 2004/03/13 15:15:26 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -88,8 +88,10 @@ wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_ )
* or create it if it don't exist.
*/
static void
-wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar * string_buff )
+wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar * unused _U_ )
{
+ char string_buff[256];
+
if ((data==NULL) || (data->packets==0))
return;
if (data->widget==NULL){ /* create an entry in the table */
@@ -99,13 +101,13 @@ wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar * string_buff
/* Maybe we should display the hexadecimal value ? */
- /* sprintf(string_buff, "%s (0X%x)", data->name, *key); */
+ /* g_snprintf(string_buff, 256, "%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);
- sprintf( string_buff, "%9d", data->packets );
+ g_snprintf( string_buff, 256, "%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);
@@ -114,7 +116,7 @@ wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar * string_buff
data->sp->index++;
} else {
/* Just update the label string */
- sprintf( string_buff, "%9d", data->packets );
+ g_snprintf( string_buff, 256, "%9d", data->packets );
gtk_label_set( GTK_LABEL(data->widget), string_buff);
}
}
@@ -209,12 +211,12 @@ wspstat_draw(void *psp)
for(i=1;i<=sp->num_pdus ; i++)
{
- sprintf(str, "%9d", sp->pdu_stats[i ].packets);
+ g_snprintf(str, 256, "%9d", sp->pdu_stats[i ].packets);
gtk_label_set( GTK_LABEL(sp->pdu_stats[i].widget), str);
}
index=sp->index;
- g_hash_table_foreach( sp->hash, (GHFunc) wsp_draw_statuscode, str );
+ g_hash_table_foreach( sp->hash, (GHFunc) wsp_draw_statuscode, NULL );
if (index != sp->index){
/* We have inserted a new entry corresponding to a status code ,
* let's resize the table */
@@ -283,7 +285,7 @@ wsp_init_table(wspstat_t *sp)
x=2;
}
/* Maybe we should display the hexadecimal value ? */
- /* snprintf(buffer, 50, "%s (0X%x)", match_strval( index2pdut( i ), vals_pdu_type), index2pdut(i) );*/
+ /* g_snprintf(buffer, 50, "%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,