diff options
author | Jan Kaisrlik <j.kaisrlik@seznam.cz> | 2014-03-15 19:58:40 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-03-19 17:08:32 +0000 |
commit | 2aebb94aa6dcd741ebd0ad3d5a48091424dd87db (patch) | |
tree | 3c727bc9e5361c737de3918b57186e008e955766 /ui/gtk | |
parent | 7e423a3a1f136ede404b7af40c96279e5a7c7940 (diff) |
fix of bug 9836. Avg. packet size in Statistics -> Summary is rounded to nearest. GTK QT
Change-Id: I34e84e6cf4587fee999764435fa1a407c8aa04bb
Reviewed-on: https://code.wireshark.org/review/687
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/summary_dlg.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index d3ceee562a..473ba17df3 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -518,24 +518,21 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) /* Average packet size */ if (summary.packet_count > 1) { - g_snprintf(cap_buf, SUM_STR_MAX, "%.3f bytes", - /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */ - (float) ((gint64) summary.bytes)/summary.packet_count); + g_snprintf(cap_buf, SUM_STR_MAX, "%" G_GUINT64_FORMAT " bytes", + (guint64) ((double)summary.bytes/summary.packet_count + 0.5) ); } else { cap_buf[0] = '\0'; } if (summary.dfilter && summary.filtered_count > 1) { - g_snprintf(disp_buf, SUM_STR_MAX, "%.3f bytes", - /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */ - (float) ((gint64) summary.filtered_bytes)/summary.filtered_count); + g_snprintf(disp_buf, SUM_STR_MAX, "%" G_GUINT64_FORMAT " bytes", + (guint64) ((double)summary.filtered_bytes/summary.filtered_count + 0.5)); } else { disp_buf[0] = '\0'; } disp_pct_buf[0] = '\0'; if (summary.marked_count > 1) { - g_snprintf(mark_buf, SUM_STR_MAX, "%.3f bytes", - /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */ - (float) ((gint64) summary.marked_bytes)/summary.marked_count); + g_snprintf(mark_buf, SUM_STR_MAX, "%" G_GUINT64_FORMAT " bytes", + (guint64) ((double)summary.marked_bytes/summary.marked_count + 0.5)); } else { mark_buf[0] = '\0'; } |