93 lines
2.8 KiB
Diff
93 lines
2.8 KiB
Diff
diff --git a/epan/ftypes/ftype-integer.c b/epan/ftypes/ftype-integer.c
|
|
index 2bf81d6..3f9bbc1 100644
|
|
--- a/epan/ftypes/ftype-integer.c
|
|
+++ b/epan/ftypes/ftype-integer.c
|
|
@@ -230,7 +230,7 @@ integer_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_)
|
|
}
|
|
|
|
static void
|
|
-integer_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf)
|
|
+integer_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
|
|
{
|
|
guint32 val;
|
|
|
|
@@ -240,7 +240,12 @@ integer_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf)
|
|
} else
|
|
val = fv->value.sinteger;
|
|
|
|
- guint32_to_str_buf(val, buf, 11);
|
|
+ if (rtype == FTREPR_DISPLAY_HEX) {
|
|
+ // This format perfectly fits into 11 bytes.
|
|
+ g_sprintf(buf, "0x%08x", val);
|
|
+ } else {
|
|
+ guint32_to_str_buf(val, buf, 11);
|
|
+ }
|
|
}
|
|
|
|
static int
|
|
@@ -250,9 +255,14 @@ uinteger_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_)
|
|
}
|
|
|
|
static void
|
|
-uinteger_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf)
|
|
+uinteger_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
|
|
{
|
|
- guint32_to_str_buf(fv->value.uinteger, buf, 11);
|
|
+ if (rtype == FTREPR_DISPLAY_HEX) {
|
|
+ // This format perfectly fits into 11 bytes.
|
|
+ g_sprintf(buf, "0x%08x", fv->value.uinteger);
|
|
+ } else {
|
|
+ guint32_to_str_buf(fv->value.uinteger, buf, 11);
|
|
+ }
|
|
}
|
|
|
|
static gboolean
|
|
diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c
|
|
index 3893823..7e67292 100644
|
|
--- a/epan/ftypes/ftype-string.c
|
|
+++ b/epan/ftypes/ftype-string.c
|
|
@@ -57,6 +57,7 @@ string_repr_len(fvalue_t *fv, ftrepr_t rtype)
|
|
{
|
|
switch (rtype) {
|
|
case FTREPR_DISPLAY:
|
|
+ case FTREPR_DISPLAY_HEX:
|
|
return (int)strlen(fv->value.string);
|
|
|
|
case FTREPR_DFILTER:
|
|
@@ -71,6 +72,7 @@ string_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
|
|
{
|
|
switch (rtype) {
|
|
case FTREPR_DISPLAY:
|
|
+ case FTREPR_DISPLAY_HEX:
|
|
strcpy(buf, fv->value.string);
|
|
return;
|
|
|
|
diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h
|
|
index 5304277..63b7d0a 100644
|
|
--- a/epan/ftypes/ftypes.h
|
|
+++ b/epan/ftypes/ftypes.h
|
|
@@ -95,6 +95,7 @@ typedef struct _ftype_t ftype_t;
|
|
/* String representation types. */
|
|
enum ftrepr {
|
|
FTREPR_DISPLAY,
|
|
+ FTREPR_DISPLAY_HEX,
|
|
FTREPR_DFILTER
|
|
};
|
|
|
|
diff --git a/epan/print.c b/epan/print.c
|
|
index 5a7ed61..6dd2222 100644
|
|
--- a/epan/print.c
|
|
+++ b/epan/print.c
|
|
@@ -1799,7 +1799,10 @@ gchar* get_node_field_value(field_info* fi, epan_dissect_t* edt)
|
|
* FT_NONE can be checked when using -T fields */
|
|
return g_strdup("1");
|
|
default:
|
|
- dfilter_string = fvalue_to_string_repr(&fi->value, FTREPR_DISPLAY, NULL);
|
|
+ dfilter_string = fvalue_to_string_repr(
|
|
+ &fi->value,
|
|
+ fi->hfinfo->display == BASE_HEX ? FTREPR_DISPLAY_HEX : FTREPR_DISPLAY,
|
|
+ NULL);
|
|
if (dfilter_string != NULL) {
|
|
return dfilter_string;
|
|
} else {
|