Wireshark mailing list archives

Capture file properties numbers


From: Dario Lombardo <dario.lombardo.ml () gmail com>
Date: Wed, 3 Jan 2018 11:25:55 +0100

Hi guys
I'm looking at the code for the dialog window that prints the "capture file
properties" (ui/qt/capture_file_properties_dialog.c:422)
I've found this assignment

captured_str = QString("%1").arg(summary.bytes/summary.packet_count + 0.5,
1, 'f', 1);

to compute the average packet size, that looks a bit weird to me. With a
capture file of 3 packets, with sizes 10, 5 and 5, I would expect to have
(10 + 5 + 5)/3 = 6.66.
Instead, with the above code, I get 6.5 (integer division + 0.5). With a
capture file of 3 packets, 10 bytes each, I would expect to have 10,
instead I get 10.5.

The other values in the same method compute just the integer division, that
could be enough, or the floating division, that would work better imho. No
other values are computer like this.

Is there any reason for that? Am I missing something?
Should I submit a change?
Dario.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: