aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-couchbase.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-19 21:58:34 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-20 05:59:06 +0000
commit8a173c9812dd2396258012ddbd13c37ea9c61a18 (patch)
tree3fe4faa3cd5150ee4c9cf2f2f6aef82ba6d578d9 /epan/dissectors/packet-couchbase.c
parenta8ff1335f99e91569ad8eaf497bc565f980dd8e4 (diff)
Clean up the way we handle the server recv->send duration.
There's no guarantee that it'll be integral, and the spec doesn't seem to imply that it's necessarily integral, so don't convert it to an integer. Given that it's a floating-point number, we might as well represent it as an FT_DOUBLE. (XXX - we should support units for FT_FLOAT and FT_DOUBLE.) Change-Id: Ica43510ac147231f5530359cc78bb467f8d3be24 Reviewed-on: https://code.wireshark.org/review/25915 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-couchbase.c')
-rw-r--r--epan/dissectors/packet-couchbase.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/epan/dissectors/packet-couchbase.c b/epan/dissectors/packet-couchbase.c
index 098ad05e50..78c5fd3fb1 100644
--- a/epan/dissectors/packet-couchbase.c
+++ b/epan/dissectors/packet-couchbase.c
@@ -2107,17 +2107,16 @@ static void dissect_flexible_framing_extras(tvbuff_t* tvb,
}
if (id == FLEX_ID_RX_TX_DURATION) {
- // Decode the u16 time value into a string
+ // Decode the u16 time value into a double
guint16 encoded_micros = tvb_get_ntohs(tvb, offset);
- char str[32];
- guint64 decoded_micros = (guint64)pow(encoded_micros, 1.74) / 2;
- g_snprintf(str, 32, "%" G_GUINT64_FORMAT "us", decoded_micros);
- proto_tree_add_string(frame_tree,
- hf_flex_frame_tracing_duration,
- tvb,
- offset,
- 2,
- str);
+ double decoded_micros = pow(encoded_micros, 1.74) / 2;
+ proto_tree_add_double_format(frame_tree,
+ hf_flex_frame_tracing_duration,
+ tvb,
+ offset,
+ 2,
+ decoded_micros,
+ "%g us", decoded_micros);
} else {
expert_add_info_format(pinfo,
frame,
@@ -2365,7 +2364,7 @@ proto_register_couchbase(void)
{ &hf_flex_frame_id_esc, {"Flexible Frame ID (escaped)", "couchbase.flex_frame.frame.id", FT_UINT16, BASE_DEC, VALS(flex_frame_ids), 0xF0, NULL, HFILL } },
{ &hf_flex_frame_len, {"Flexible Frame Len", "couchbase.flex_frame.frame.len", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL } },
{ &hf_flex_frame_len_esc, {"Flexible Frame Len (escaped)", "couchbase.flex_frame.frame.len", FT_UINT16, BASE_DEC, NULL, 0x0F, NULL, HFILL } },
- { &hf_flex_frame_tracing_duration, {"Server Recv->Send duration", "couchbase.flex_frame.frame.duration", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
+ { &hf_flex_frame_tracing_duration, {"Server Recv->Send duration", "couchbase.flex_frame.frame.duration", FT_DOUBLE, BASE_NONE, NULL, 0, NULL, HFILL } },
{ &hf_extras, { "Extras", "couchbase.extras", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_flags, { "Flags", "couchbase.extras.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },