forked from osmocom/wireshark
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>
This commit is contained in:
parent
7e423a3a1f
commit
2aebb94aa6
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -570,9 +570,8 @@ void SummaryDialog::UpdateValues()
|
|||
ui->tbDisplay->setItem(ui->tbDisplay->rowCount()-1, 0, new QTableWidgetItem(tr("Avg. packet size")));
|
||||
if (summary_.packet_count > 1)
|
||||
{
|
||||
output = output.sprintf(tr("%.3f bytes").toStdString().c_str(),
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
(float) ((gint64) summary_.bytes)/summary_.packet_count);
|
||||
output = output.sprintf(tr("%" G_GUINT64_FORMAT " bytes").toStdString().c_str(),
|
||||
(guint64) ((double)summary_.bytes/summary_.packet_count + 0.5));
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -584,9 +583,8 @@ void SummaryDialog::UpdateValues()
|
|||
|
||||
if (summary_.dfilter && summary_.filtered_count > 1)
|
||||
{
|
||||
output = output.sprintf(tr("%.3f bytes").toStdString().c_str(),
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
(float) ((gint64) summary_.filtered_bytes)/summary_.filtered_count);
|
||||
output = output.sprintf(tr("%" G_GUINT64_FORMAT " bytes").toStdString().c_str(),
|
||||
(guint64) ((double)summary_.filtered_bytes/summary_.filtered_count + 0.5));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -597,9 +595,8 @@ void SummaryDialog::UpdateValues()
|
|||
|
||||
if (summary_.marked_count > 1)
|
||||
{
|
||||
output = output.sprintf(tr("%.3f bytes").toStdString().c_str(),
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
(float) ((gint64) summary_.marked_bytes)/summary_.marked_count);
|
||||
output = output.sprintf(tr("%" G_GUINT64_FORMAT " bytes").toStdString().c_str(),
|
||||
(guint64) ((double)summary_.marked_bytes/summary_.marked_count + 0.5));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue