aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorOlivier Biot <obiot.ethereal@gmail.com>2003-12-20 12:03:35 +0000
committerOlivier Biot <obiot.ethereal@gmail.com>2003-12-20 12:03:35 +0000
commit44ea0de58f1f1154d1ed9b716284460d1fdfa161 (patch)
tree6d975c24d6d760415085f990f502059b1de6dd06 /gtk
parent20d1488b6567fe531ca03c64afd4d1a929d7417c (diff)
Move display filter into filtered packets frame.
Fix NaN when a capture and/or a filter don't have any matching packets so the average packet size is obtained by dividing by zero. svn path=/trunk/; revision=9369
Diffstat (limited to 'gtk')
-rw-r--r--gtk/summary_dlg.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index 841de24c39..a197b4d6b2 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -1,7 +1,7 @@
/* summary_dlg.c
* Routines for capture file summary window
*
- * $Id: summary_dlg.c,v 1.19 2003/09/02 22:10:32 guy Exp $
+ * $Id: summary_dlg.c,v 1.20 2003/12/20 12:03:35 obiot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -145,7 +145,8 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
}
/* Packet size */
- snprintf(string_buff, SUM_STR_MAX, "Avg. packet size: %.3f bytes", (float) summary.bytes/summary.packet_count);
+ snprintf(string_buff, SUM_STR_MAX, "Avg. packet size: %.3f bytes",
+ summary.packet_count ? (float)summary.bytes/summary.packet_count : 0.0);
add_string_to_box(string_buff, data_box);
/* Dropped count */
@@ -169,22 +170,24 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
add_string_to_box(string_buff, data_box);
}
- /* Filter frame */
- if (summary.dfilter) {
- double seconds;
+ /* Filtered packets frame */
+ filter_fr = gtk_frame_new("Data in filtered packets");
+ gtk_container_add(GTK_CONTAINER(main_vb), filter_fr);
+ gtk_widget_show(filter_fr);
- seconds = (summary.filtered_stop - summary.filtered_start);
+ filter_box = gtk_vbox_new( FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(filter_fr), filter_box);
+ gtk_widget_show(filter_box);
- /* Filtered packets frame */
- filter_fr = gtk_frame_new("Data in filtered packets");
- gtk_container_add(GTK_CONTAINER(main_vb), filter_fr);
- gtk_widget_show(filter_fr);
+ if (summary.dfilter) {
+ double seconds;
- filter_box = gtk_vbox_new( FALSE, 3);
- gtk_container_add(GTK_CONTAINER(filter_fr), filter_box);
- gtk_widget_show(filter_box);
+ /* Display filter */
+ snprintf(string_buff, SUM_STR_MAX, "Display filter: %s", summary.dfilter);
+ add_string_to_box(string_buff, filter_box);
/* seconds */
+ seconds = (summary.filtered_stop - summary.filtered_start);
snprintf(string_buff, SUM_STR_MAX, "Between first and last packet: %.3f seconds", seconds);
add_string_to_box(string_buff, filter_box);
@@ -199,7 +202,8 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
}
/* Packet size */
- snprintf(string_buff, SUM_STR_MAX, "Avg. packet size: %.3f bytes", (float) summary.filtered_bytes/summary.filtered_count);
+ snprintf(string_buff, SUM_STR_MAX, "Avg. packet size: %.3f bytes",
+ summary.filtered_count ? (float) summary.filtered_bytes/summary.filtered_count : 0.0);
add_string_to_box(string_buff, filter_box);
/* Byte count */
@@ -216,6 +220,10 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
summary.filtered_bytes * 8.0 / (seconds * 1000.0 * 1000.0));
add_string_to_box(string_buff, filter_box);
}
+ } else {
+ /* Display filter */
+ snprintf(string_buff, SUM_STR_MAX, "Display filter: none");
+ add_string_to_box(string_buff, filter_box);
}
/* Capture Frame */
@@ -235,14 +243,6 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
}
add_string_to_box(string_buff, capture_box);
- /* Display filter */
- if (summary.dfilter) {
- snprintf(string_buff, SUM_STR_MAX, "Display filter: %s", summary.dfilter);
- } else {
- sprintf(string_buff, "Display filter: none");
- }
- add_string_to_box(string_buff, capture_box);
-
#ifdef HAVE_LIBPCAP
/* Capture filter */
if (summary.cfilter && summary.cfilter[0] != '\0') {