Wireshark-dev: Re: [Wireshark-dev] Capture file properties numbers
From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Wed, 3 Jan 2018 09:46:19 -0800
It's supposed to be rounded as described in bug 9836 but it looks like I
broke that in a later change. Fix inbound in change 25129.

On 1/3/18 2:25 AM, Dario Lombardo wrote:
> 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@xxxxxxxxxxxxx>
> Archives:    https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>