From 845654d8b7d17831976eb9fc6f2f7140a8e2d84e Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 9 Feb 2016 08:53:30 -0800 Subject: TCP: Use MIDDLE DOT for the flag placeholder. If you apply tcp.flags.str as a column you end up with a Wall Of Asterisks. Use Unicode MIDDLE DOT as a placeholder instead. Change-Id: I3e2bebd2a951cc516399e965ace6bf87501adc9e Reviewed-on: https://code.wireshark.org/review/13855 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-tcp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index e3617fbf7d..319a84d14e 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -4866,19 +4866,21 @@ tcp_flags_to_str(const struct tcpheader *tcph) static const char * tcp_flags_to_str_first_letter(const struct tcpheader *tcph) { - char *buf; + wmem_strbuf_t *buf = wmem_strbuf_new(wmem_packet_scope(), ""); unsigned i; const unsigned flags_count = 12; + const char first_letters[] = "RRRNCEUAPRSF"; /* upper three bytes are marked as reserved ('R'). */ - buf = wmem_strdup(wmem_packet_scope(), "RRRNCEUAPRSF"); for (i = 0; i < flags_count; i++) { - if (!((tcph->th_flags >> (flags_count - 1 - i)) & 1)) { - buf[i] = '*'; + if (((tcph->th_flags >> (flags_count - 1 - i)) & 1)) { + wmem_strbuf_append_c(buf, first_letters[i]); + } else { + wmem_strbuf_append(buf, UTF8_MIDDLE_DOT); } } - return buf; + return wmem_strbuf_finalize(buf); } static gboolean @@ -5833,7 +5835,7 @@ proto_register_tcp(void) NULL, HFILL }}, { &hf_tcp_flags_str, - { "TCP Flags", "tcp.flags.str", FT_STRING, BASE_NONE, NULL, 0x0, + { "TCP Flags", "tcp.flags.str", FT_STRING, STR_UNICODE, NULL, 0x0, NULL, HFILL }}, { &hf_tcp_window_size_value, -- cgit v1.2.3