Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] SVN 24544 build fails on Windows

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 04 Mar 2008 01:13:36 -0800
Maynard, Chris wrote:
Here's the warning that stops the build:
packet-ptp.c(2183) : error C2220: warning treated as error - no object
file generated
packet-ptp.c(2183) : warning C4244: 'function' : conversion from
'__int64 ' to 'double ', possible loss of data

Attached is a proposed patch to correct the problem.

That patch replaces calls to proto_tree_add_double_format() with calls to proto_tree_add_uint64_format_value(). That's only valid if the hf_ value being passed is for an FT_UINT64 value, in which case the proto_tree_add_double_format() is and has always been wrong; if the hf_ value being passed in is for an FT_DOUBLE value, a call to proto_tree_add_uint64_format_value() would be wrong.

It appears that, in at least one call to dissect_ptp_v2_timeInterval(), the value passed in is hf_ptp_v2_correction, which is an FT_DOUBLE value, so changing the proto_tree_add_double_format() to proto_tree_add_uint64_format_value() would be wrong.

Given that the mantissa of a double is, in most if not all platforms, less than 64 bits long, the right type for the "nanoseconds" part of the time stamp is probably an FT_UINT64, not an FT_DOUBLE, so your change should be combined with changes to fix all the hf_ values passed in to dissect_ptp_v2_timeInterval() for the nanosecond part of the time interval to be FT_UINT64.

P.S. I also noticed the following "duplicate field", which should
probably also be corrected?:

I've checked in a change that should fix that particular problem.

However, the CIGI dissector should perhaps not register separate CIGI 3.0 and 3.2 fields when the fields are otherwise identical. (It might also be interesting to see whether that's also the case for CIGI 2 and CIGI 3.)