Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 51419: /trunk/epan/dissectors/ /trun

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 18 Aug 2013 15:56:06 -0700
On Aug 18, 2013, at 1:04 PM, eapache@xxxxxxxxxxxxx wrote:

> http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=51419
> 
> User: eapache
> Date: 2013/08/18 01:04 PM
> 
> Log:
> Add a cast to try and fix
> packet-rtpproxy.c:226: warning: implicit conversion shortens 64-bit value into
> a 32-bit value
> 
> I'm not quite sure what's going on here, all the values in use are either gint
> or guint so they should all be the same size?

In

	new_offset = tvb_skip_wsp(tvb, offset + (strlen("VF") + 1), -1);

one of the values - the return value of strlen() - is size_t, which isn't necessarily gint or guint (or, as Mountain Lion's autocorrect would have it, "hint or guilt" :-)), as it's 64-bit in most if not all 64-bit C implementations (including MSVC when compiling 64-bit).

I'd make it "(gint)strlen("VF")" (and then I might make it "(sizeof "VF" - 1)", for the benefit of compilers that don't do that for you at compile time).