From f2c2b9687d4dbcb8cd83e84c8f073b4285bb7f72 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 3 Dec 2019 16:51:29 -0800 Subject: [PATCH] README.dissector: Add a note about integer promotion. Change-Id: Ie3b6dfcea7b1cee3b0bda3d9ec2cc9a6857578fc Reviewed-on: https://code.wireshark.org/review/35308 Reviewed-by: Gerald Combs --- doc/README.dissector | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/README.dissector b/doc/README.dissector index 16bbba6cde..a35089728c 100644 --- a/doc/README.dissector +++ b/doc/README.dissector @@ -329,6 +329,13 @@ gint64 tvb_get_letohi56(tvbuff_t *tvb, const gint offset); guint64 tvb_get_letoh64(tvbuff_t *tvb, const gint offset); gint64 tvb_get_letohi64(tvbuff_t *tvb, const gint offset); +NOTE: Although each of the integer accessors above return types with +specific sizes, the returned values are subject to C's integer promotion +rules. It's often safer and more useful to use int or guint for 32-bit +and smaller types, and gint64 or guint64 for 40-bit and larger types. +Just because a value occupied 16 bits on the wire or over the air +doesn't mean it will within Wireshark. + Single-precision and double-precision IEEE floating-point numbers: gfloat tvb_get_letohieee_float(tvbuff_t *tvb, const gint offset);