summaryrefslogtreecommitdiff
path: root/gtk/capture_info_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-11-17 20:00:37 +0000
committerGuy Harris <guy@alum.mit.edu>2003-11-17 20:00:37 +0000
commitdc69087b0cabf9c55d2528c319f633ca2dd9bab2 (patch)
tree673544c68f8ba2c9d8ec2f4e7caa5dede4c3adc7 /gtk/capture_info_dlg.c
parent08f3ea2cf35a04800e16babe3f34cfe7ebea99a4 (diff)
downloadwireshark-dc69087b0cabf9c55d2528c319f633ca2dd9bab2.tar.gz
Not all compilers allow array/structure/union members of automatic
variables to be initialized to non-constant values (C89 says that "All the expressions in an initializer for an object that has static storage duration or in an initializer list for an object that has aggregate or union type shall be constant expressions"; presumably the intent of the former was to avoid run-time initialization and of the latter was to let the initialization be done by copying from a compile-time-created blob of memory), so we have to initialize "info->counts" by hand. svn path=/trunk/; revision=8984
Diffstat (limited to 'gtk/capture_info_dlg.c')
-rw-r--r--gtk/capture_info_dlg.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/gtk/capture_info_dlg.c b/gtk/capture_info_dlg.c
index 351968959e..574996ead3 100644
--- a/gtk/capture_info_dlg.c
+++ b/gtk/capture_info_dlg.c
@@ -1,7 +1,7 @@
/* capture_info_dlg.c
* Routines for packet capture info dialog
*
- * $Id: capture_info_dlg.c,v 1.2 2003/11/17 00:27:33 guy Exp $
+ * $Id: capture_info_dlg.c,v 1.3 2003/11/17 20:00:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -93,25 +93,31 @@ capture_info *cinfo)
GtkWidget *iface_lb, *iface_name_lb, *iface_descr_lb;
capture_info_ui_t *info;
-
- const capture_info_counts_t counts_init[CAPTURE_PACKET_COUNTS] = {
- { "Total", &(cinfo->counts->total), NULL, NULL, NULL, NULL },
- { "SCTP", &(cinfo->counts->sctp), NULL, NULL, NULL, NULL },
- { "TCP", &(cinfo->counts->tcp), NULL, NULL, NULL, NULL },
- { "UDP", &(cinfo->counts->udp), NULL, NULL, NULL, NULL },
- { "ICMP", &(cinfo->counts->icmp), NULL, NULL, NULL, NULL },
- { "ARP", &(cinfo->counts->arp), NULL, NULL, NULL, NULL },
- { "OSPF", &(cinfo->counts->ospf), NULL, NULL, NULL, NULL },
- { "GRE", &(cinfo->counts->gre), NULL, NULL, NULL, NULL },
- { "NetBIOS", &(cinfo->counts->netbios), NULL, NULL, NULL, NULL },
- { "IPX", &(cinfo->counts->ipx), NULL, NULL, NULL, NULL },
- { "VINES", &(cinfo->counts->vines), NULL, NULL, NULL, NULL },
- { "Other", &(cinfo->counts->other), NULL, NULL, NULL, NULL }
- };
-
-
- info = g_malloc(sizeof(capture_info_ui_t));
- memcpy(info->counts, counts_init, sizeof(counts_init));
+ info = g_malloc0(sizeof(capture_info_ui_t));
+ info->counts[0].title = "Total";
+ info->counts[0].value_ptr = &(cinfo->counts->total);
+ info->counts[1].title = "SCTP";
+ info->counts[1].value_ptr = &(cinfo->counts->sctp);
+ info->counts[2].title = "TCP";
+ info->counts[2].value_ptr = &(cinfo->counts->tcp);
+ info->counts[3].title = "UDP";
+ info->counts[3].value_ptr = &(cinfo->counts->udp);
+ info->counts[4].title = "ICMP";
+ info->counts[4].value_ptr = &(cinfo->counts->icmp);
+ info->counts[5].title = "ARP";
+ info->counts[5].value_ptr = &(cinfo->counts->arp);
+ info->counts[6].title = "OSPF";
+ info->counts[6].value_ptr = &(cinfo->counts->ospf);
+ info->counts[7].title = "GRE";
+ info->counts[7].value_ptr = &(cinfo->counts->gre);
+ info->counts[8].title = "NetBIOS";
+ info->counts[8].value_ptr = &(cinfo->counts->netbios);
+ info->counts[9].title = "IPX";
+ info->counts[9].value_ptr = &(cinfo->counts->ipx);
+ info->counts[10].title = "VINES";
+ info->counts[10].value_ptr = &(cinfo->counts->vines);
+ info->counts[11].title = "Other";
+ info->counts[11].value_ptr = &(cinfo->counts->other);
info->cap_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(info->cap_w), "Ethereal: Capture");