Wireshark mailing list archives
Re: [Wireshark-commits] rev 51419: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-rtpproxy.c
From: Evan Huus <eapache () gmail com>
Date: Sun, 18 Aug 2013 19:29:19 -0400
On Sun, Aug 18, 2013 at 6:56 PM, Guy Harris <guy () alum mit edu> wrote:
On Aug 18, 2013, at 1:04 PM, eapache () wireshark org 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-bitvalue intoa 32-bit value I'm not quite sure what's going on here, all the values in use areeither gintor 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).
Right. I had it in my head for some reason that Mac was ILP64 (in which case size_t and *int would all be 64-bit) but that's clearly not the case. I'm not sure where I got that idea from. 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).
Premature optimization is the root of all evil, though I'm not sure I can say that with a straight face given how much time I've spent recently on wmem's block allocator :)
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Re: [Wireshark-commits] rev 51419: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-rtpproxy.c Guy Harris (Aug 18)
- Re: [Wireshark-commits] rev 51419: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-rtpproxy.c Evan Huus (Aug 18)