aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-05-07 22:39:34 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-05-07 20:52:48 +0000
commit301f5ffde09f2eb0f5481dbea77c1a0eee4321e4 (patch)
tree3597ed0f4c12dbc41786d470c65a4e29e61145a4 /epan/ftypes
parente55ac64077be6044292dd8eeda4cd6412386caeb (diff)
ftypes: display 64 bits BASE_HEX fields as hexadecimal
Change-Id: Ie9bedf6c17c0a941ebaabd5144460a42eb4ca1ed Reviewed-on: https://code.wireshark.org/review/8336 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/ftypes')
-rw-r--r--epan/ftypes/ftype-integer.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/epan/ftypes/ftype-integer.c b/epan/ftypes/ftype-integer.c
index f74759b053..d77cb1ec25 100644
--- a/epan/ftypes/ftype-integer.c
+++ b/epan/ftypes/ftype-integer.c
@@ -582,13 +582,25 @@ integer64_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char
static int
uinteger64_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_)
{
- return 20; /* enough for 2^64-1, in decimal */
+ return 20; /* enough for 2^64-1, in decimal or 0xXXXXXXXXXXXXXXXX */
}
static void
uinteger64_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf)
{
- guint64_to_str_buf(fv->value.uinteger64, buf, 21);
+ if (field_display == BASE_HEX)
+ {
+ /* This format perfectly fits into 19 bytes. */
+ *buf++ = '0';
+ *buf++ = 'x';
+
+ buf = qword_to_hex(buf, fv->value.uinteger64);
+ *buf++ = '\0';
+ }
+ else
+ {
+ guint64_to_str_buf(fv->value.uinteger64, buf, 21);
+ }
}
static gboolean