Make the "value_string" array in "dissect_arp()" static, so it can be
initialized at compile time.
Compute the number of elements in that array at compile time.
Fix a typo ("Unkown" for "Unknown").
(Does anybody on this list not have access to the CVS tree, or want
patches sent out for any other reason? Here's this patch, and the
previous one:
*** packet-fddi.c 1998/10/10 18:23:43 1.2
--- packet-fddi.c 1998/10/13 05:17:16 1.3
***************
*** 87,96 ****
fc = (int) pd[FDDI_P_FC];
! if (fd->win_info[0]) {
! strcpy(fd->win_info[2], get_ether_name((u_char *)&pd[FDDI_P_DHOST]));
! strcpy(fd->win_info[1], get_ether_name((u_char *)&pd[FDDI_P_SHOST]));
! strcpy(fd->win_info[4], "FDDI");
}
if (tree) {
--- 87,96 ----
fc = (int) pd[FDDI_P_FC];
! if (fd->win_info[COL_NUM]) {
! strcpy(fd->win_info[COL_DESTINATION], get_ether_name((u_char *)&pd[FDDI_P_DHOST]));
! strcpy(fd->win_info[COL_SOURCE], get_ether_name((u_char *)&pd[FDDI_P_SHOST]));
! strcpy(fd->win_info[COL_INFO], "FDDI");
}
if (tree) {
Index: packet-arp.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-arp.c,v
retrieving revision 1.5
diff -c -r1.5 packet-arp.c
*** packet-arp.c 1998/10/12 01:40:52 1.5
--- packet-arp.c 1998/10/13 05:20:35
***************
*** 49,58 ****
e_ether_arp ea;
GtkWidget *arp_tree, *ti;
gchar *op_str;
! value_string op_vals[] = { {ARPOP_REQUEST, "ARP request" },
! {ARPOP_REPLY, "ARP reply" },
! {ARPOP_RREQUEST, "RARP request"},
! {ARPOP_RREPLY, "RARP reply" } };
/* To do: Check for {cap len,pkt len} < struct len */
ea.ar_hrd = pntohs(&pd[offset]);
--- 49,59 ----
e_ether_arp ea;
GtkWidget *arp_tree, *ti;
gchar *op_str;
! static value_string op_vals[] = { {ARPOP_REQUEST, "ARP request" },
! {ARPOP_REPLY, "ARP reply" },
! {ARPOP_RREQUEST, "RARP request"},
! {ARPOP_RREPLY, "RARP reply" } };
! #define N_OP_VALS (sizeof op_vals / sizeof op_vals[0])
/* To do: Check for {cap len,pkt len} < struct len */
ea.ar_hrd = pntohs(&pd[offset]);
***************
*** 68,78 ****
if (fd->win_info[COL_NUM]) { strcpy(fd->win_info[COL_PROTOCOL], "ARP"); }
if (tree) {
! if ((op_str = match_strval(ea.ar_op, op_vals, 4)))
ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28, op_str);
else
ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28,
! "Unkown ARP (opcode 0x%04x)", ea.ar_op);
arp_tree = gtk_tree_new();
add_subtree(ti, arp_tree, ETT_ARP);
add_item_to_tree(arp_tree, offset, 2,
--- 69,79 ----
if (fd->win_info[COL_NUM]) { strcpy(fd->win_info[COL_PROTOCOL], "ARP"); }
if (tree) {
! if ((op_str = match_strval(ea.ar_op, op_vals, N_OP_VALS)))
ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28, op_str);
else
ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28,
! "Unknown ARP (opcode 0x%04x)", ea.ar_op);
arp_tree = gtk_tree_new();
add_subtree(ti, arp_tree, ETT_ARP);
add_item_to_tree(arp_tree, offset, 2,