diff options
author | Michael Mann <mmann78@netscape.net> | 2013-09-30 15:21:09 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-09-30 15:21:09 +0000 |
commit | cf804429123802edb55003ebfd21ebea5718d10b (patch) | |
tree | d2a468c4f0aeb706413a6c50c2e12026673a6b34 /epan/dissectors | |
parent | 2211ab0fba17d71cc25f6b0d026f04d241bbced1 (diff) |
Convert some proto_tree_add_string_format calls to something more appropriate.
There seem to be several cases of proto_tree_add_string_format where a "string" value/filter doesn't really make sense because it's always empty, and is just being used as a "filterable subtree header (placeholder)". They appear to be more for "presense" than "value" and should probably be FT_NONE, although I'd almost argue for removing the filter in favor of proto_tree_add_text.
svn path=/trunk/; revision=52296
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-ajp13.c | 36 | ||||
-rw-r--r-- | epan/dissectors/packet-ansi_a.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ber.c | 196 | ||||
-rw-r--r-- | epan/dissectors/packet-dcerpc-eventlog.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-dmp.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-epl.c | 46 | ||||
-rw-r--r-- | epan/dissectors/packet-gtpv2.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-hsrp.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-isis-lsp.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-nfs.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-pktc.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-rtnet.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-sip.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-slsk.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-t30.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-tnef.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-vtp.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-windows-common.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-x11.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-zrtp.c | 10 |
20 files changed, 190 insertions, 220 deletions
diff --git a/epan/dissectors/packet-ajp13.c b/epan/dissectors/packet-ajp13.c index f7ac4fdb69..e1f2be9a1e 100644 --- a/epan/dissectors/packet-ajp13.c +++ b/epan/dissectors/packet-ajp13.c @@ -401,7 +401,6 @@ display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree, ajp13_con const gchar *hval; guint16 hval_len, hname_len; const gchar* hname = NULL; - header_field_info *hfinfo; int hpos = pos; /* int cl = 0; TODO: Content-Length header (encoded by 0x08) is special */ @@ -419,12 +418,9 @@ display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree, ajp13_con hval = ajp13_get_nstring(tvb, pos, &hval_len); - if (ajp13_tree) { - hfinfo = proto_registrar_get_nth(*rsp_headers[hid]); - proto_tree_add_string_format(ajp13_tree, *rsp_headers[hid], + proto_tree_add_string_format_value(ajp13_tree, *rsp_headers[hid], tvb, hpos, 2+hval_len+2, hval, - "%s: %s", hfinfo->name, hval); - } + "%s", hval); pos+=hval_len+2; #if 0 /* TODO: Content-Length header (encoded by 0x08) is special */ @@ -437,12 +433,10 @@ display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree, ajp13_con hval = ajp13_get_nstring(tvb, pos, &hval_len); - if (ajp13_tree) { - proto_tree_add_string_format(ajp13_tree, hf_ajp13_additional_header, + proto_tree_add_string_format(ajp13_tree, hf_ajp13_additional_header, tvb, hpos, hname_len+2+hval_len+2, wmem_strdup_printf(wmem_packet_scope(), "%s: %s", hname, hval), "%s: %s", hname, hval); - } pos+=hval_len+2; } } @@ -650,7 +644,6 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, guint8 hcd; guint8 hid; const gchar* hname = NULL; - header_field_info *hfinfo; int hpos = pos; int cl = 0; const gchar *hval; @@ -670,12 +663,9 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, hval = ajp13_get_nstring(tvb, pos, &hval_len); - if (ajp13_tree) { - hfinfo = proto_registrar_get_nth(*req_headers[hid]); - proto_tree_add_string_format(ajp13_tree, *req_headers[hid], + proto_tree_add_string_format(ajp13_tree, *req_headers[hid], tvb, hpos, 2+hval_len+2, hval, - "%s: %s", hfinfo->name, hval); - } + "%s", hval); pos+=hval_len+2; if (hid == 0x08) @@ -686,12 +676,10 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, hval = ajp13_get_nstring(tvb, pos, &hval_len); - if (ajp13_tree) { - proto_tree_add_string_format(ajp13_tree, hf_ajp13_additional_header, + proto_tree_add_string_format(ajp13_tree, hf_ajp13_additional_header, tvb, hpos, hname_len+2+hval_len+2, wmem_strdup_printf(wmem_packet_scope(), "%s: %s", hname, hval), "%s: %s", hname, hval); - } pos+=hval_len+2; } @@ -709,7 +697,6 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, const gchar* aval; guint16 aval_len, aname_len; - header_field_info *hfinfo; int apos = pos; /* ATTRIBUTE CODE/NAME @@ -730,12 +717,10 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, aval = ajp13_get_nstring(tvb, pos, &aval_len); pos+=aval_len+2; - if (ajp13_tree) { - proto_tree_add_string_format(ajp13_tree, hf_ajp13_req_attribute, + proto_tree_add_string_format(ajp13_tree, hf_ajp13_req_attribute, tvb, apos, 1+aname_len+2+aval_len+2, wmem_strdup_printf(wmem_packet_scope(), "%s: %s", aname, aval), "%s: %s", aname, aval); - } } else if (aid == 0x0B ) { /* ssl_key_length */ if (ajp13_tree) { @@ -748,15 +733,12 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, if (aid >= array_length(req_attributes)) aid = 0; - hfinfo = proto_registrar_get_nth(*req_attributes[aid]); aval = ajp13_get_nstring(tvb, pos, &aval_len); pos+=aval_len+2; - if (ajp13_tree) { - proto_tree_add_string_format(ajp13_tree, *req_attributes[aid], + proto_tree_add_string_format(ajp13_tree, *req_attributes[aid], tvb, apos, 1+aval_len+2, aval, - "%s: %s", hfinfo->name, aval); - } + "%s", aval); } } } diff --git a/epan/dissectors/packet-ansi_a.c b/epan/dissectors/packet-ansi_a.c index f07fd4c3aa..45b4589ed9 100644 --- a/epan/dissectors/packet-ansi_a.c +++ b/epan/dissectors/packet-ansi_a.c @@ -1976,11 +1976,11 @@ elem_mid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset curr_offset += len - (curr_offset - offset); - proto_tree_add_string_format(tree, + proto_tree_add_string_format_value(tree, hf_ansi_a_meid, tvb, offset + 1, len - 1, a_bigbuf, - "MEID: %s", + "%s", a_bigbuf); g_snprintf(add_string, string_len, " - %s (%s)", diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 07758ccb1b..9d5ccf6898 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -599,9 +599,9 @@ printf("dissect_ber_tagged_type(%s) entered\n", name); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &tmp_len, NULL); if ((tmp_cls != tag_cls) || (tmp_tag != tag_tag)) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, tmp_len, "wrong_tag", - "BER Error: Wrong tag in tagged type - expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d", + "Wrong tag in tagged type - expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d", val_to_str_const(tag_cls, ber_class_codes, "Unknown"), tag_cls, tag_tag, @@ -786,9 +786,9 @@ try_dissect_unknown_ber(packet_info *pinfo, tvbuff_t *tvb, volatile int offset, offset = dissect_ber_identifier(pinfo, tree, tvb, start_offset, &ber_class, &pc, &tag); offset = dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL); } - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "illegal_length", - "BER Error: length:%u longer than tvb_length_remaining:%d", + "length:%u longer than tvb_length_remaining:%d", len, tvb_length_remaining(tvb, offset)); expert_add_info(pinfo, cause, &ei_ber_error_length); @@ -891,9 +891,9 @@ try_dissect_unknown_ber(packet_info *pinfo, tvbuff_t *tvb, volatile int offset, default: offset = dissect_ber_identifier(pinfo, tree, tvb, start_offset, &ber_class, &pc, &tag); offset = dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "unknown_universal_tag", - "BER Error: can not handle universal tag:%d", + "can not handle universal tag:%d", tag); expert_add_info(pinfo, cause, &ei_ber_universal_tag_unknown); offset += len; @@ -1492,9 +1492,9 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n", name); if ( (ber_class != BER_CLASS_UNI) || ((tag < BER_UNI_TAG_NumericString) && (tag != BER_UNI_TAG_OCTETSTRING) && (tag != BER_UNI_TAG_UTF8String)) ) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "octetstring_expected", - "BER Error: OctetString expected but class:%s(%d) %s tag:%d was unexpected", + "OctetString expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -1527,9 +1527,9 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n", name); * error - short frame, or this item runs past the * end of the item containing it */ - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "illegal_length", - "BER Error: length:%u longer than tvb_length_remaining:%d", + "length:%u longer than tvb_length_remaining:%d", len, len_remain); expert_add_info(actx->pinfo, cause, &ei_ber_error_length); @@ -1631,9 +1631,9 @@ dissect_ber_null(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbu offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag); if (pc || (!implicit_tag && ((ber_class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_NULL)))) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset_old, offset - offset_old, "null_expected", - "BER Error: NULL expected but class:%s(%d) %s tag:%d was unexpected", + "NULL expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -1644,13 +1644,13 @@ dissect_ber_null(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbu offset_old = offset; offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); if (len) { - proto_tree_add_string_format( + proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset_old, offset - offset_old, "illegal_length", - "BER Error: NULL expect zero length but Length=%d", + "NULL expect zero length but Length=%d", len); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "unexpected_data", - "BER Error: unexpected data in NULL type"); + "unexpected data in NULL type"); expert_add_info(actx->pinfo, cause, &ei_ber_expected_null_zero_length); offset += len; } @@ -1752,9 +1752,9 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im if (hf_id >= 0) { /* */ if ((len < 1) || (len > 9) || ((len == 9) && (first != 0))) { - proto_item *pi = proto_tree_add_string_format( + proto_item *pi = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-len, len, "invalid length", - "BER Error: Can't handle integer length: %u", + "Can't handle integer length: %u", len); expert_add_info_format(actx->pinfo, pi, &ei_ber_error_length, "BER Error: Illegal integer length: %u", len); @@ -1988,9 +1988,9 @@ printf("SEQUENCE dissect_ber_sequence(%s) entered\n", name); if (!pcx || (!implicit_tag && ((classx != BER_CLASS_UNI) || (tagx != BER_UNI_TAG_SEQUENCE)))) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, "sequence_expected", - "BER Error: Sequence expected but class:%s(%d) %s tag:%d was unexpected", + "Sequence expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(classx, ber_class_codes, "Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -2053,9 +2053,9 @@ ber_sequence_try_again: /* it was not, move to the next one and try again */ offset = dissect_ber_identifier(actx->pinfo, tree, tvb, hoffset, NULL, NULL, NULL); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, NULL, NULL); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "unknown_field", - "BER Error: This field lies beyond the end of the known sequence definition."); + "This field lies beyond the end of the known sequence definition."); expert_add_info(actx->pinfo, cause, &ei_ber_unknown_field_sequence); if (decode_unexpected) { proto_tree *unknown_tree = proto_item_add_subtree(cause, ett_ber_unknown); @@ -2090,9 +2090,9 @@ ber_sequence_try_again: offset = dissect_ber_identifier(actx->pinfo, tree, tvb, hoffset, NULL, NULL, NULL); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, NULL, NULL); if (seq->ber_class == BER_CLASS_UNI) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in SEQUENCE expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d", + "Wrong field in SEQUENCE expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2102,9 +2102,9 @@ ber_sequence_try_again: tag); expert_add_info(actx->pinfo, cause, &ei_ber_sequence_field_wrong); } else { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in SEQUENCE expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", + "Wrong field in SEQUENCE expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2136,9 +2136,9 @@ ber_sequence_try_again: offset = dissect_ber_identifier(actx->pinfo, tree, tvb, hoffset, NULL, NULL, NULL); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, NULL, NULL); if ( seq->ber_class == BER_CLASS_UNI) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in sequence expected class:%s(%d) tag:%d(%s) but found class:%s(%d) tag:%d", + "Wrong field in sequence expected class:%s(%d) tag:%d(%s) but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2147,9 +2147,9 @@ ber_sequence_try_again: ber_class, tag); expert_add_info(actx->pinfo, cause, &ei_ber_sequence_field_wrong); } else { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in sequence expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", + "Wrong field in sequence expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2269,9 +2269,9 @@ printf("SEQUENCE dissect_ber_sequence(%s) subdissector ate %d bytes\n", name, co /* if we didnt end up at exactly offset, then we ate too many bytes */ if (offset != end_offset) { tvb_ensure_bytes_exist(tvb, offset-2, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-2, 2, "illegal_length", - "BER Error: Sequence ate %d too many bytes", + "Sequence ate %d too many bytes", offset - end_offset); expert_add_info_format(actx->pinfo, cause, &ei_ber_error_length, "BER Error: too many bytes in Sequence"); @@ -2352,9 +2352,9 @@ printf("SEQUENCE dissect_ber_old_sequence(%s) entered\n", name); if (!pcx || (!implicit_tag && ((classx != BER_CLASS_UNI) || (tagx != BER_UNI_TAG_SEQUENCE)))) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, "sequence_expected", - "BER Error: Sequence expected but class:%s(%d) %s tag:%d was unexpected", + "Sequence expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(classx, ber_class_codes, "Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -2415,9 +2415,9 @@ ber_old_sequence_try_again: /* it was not, move to the next one and try again */ offset = dissect_ber_identifier(actx->pinfo, tree, tvb, hoffset, NULL, NULL, NULL); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, NULL, NULL); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "illegal_length", - "BER Error: This field lies beyond the end of the known sequence definition."); + "This field lies beyond the end of the known sequence definition."); expert_add_info(actx->pinfo, cause, &ei_ber_unknown_field_sequence); if (decode_unexpected) { proto_tree *unknown_tree = proto_item_add_subtree(cause, ett_ber_unknown); @@ -2452,9 +2452,9 @@ ber_old_sequence_try_again: offset = dissect_ber_identifier(actx->pinfo, tree, tvb, hoffset, NULL, NULL, NULL); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, NULL, NULL); if ( seq->ber_class == BER_CLASS_UNI) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in SEQUENCE expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d", + "Wrong field in SEQUENCE expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2464,9 +2464,9 @@ ber_old_sequence_try_again: tag); expert_add_info(actx->pinfo, cause, &ei_ber_sequence_field_wrong); } else { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field" - "BER Error: Wrong field in SEQUENCE expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", + "Wrong field in SEQUENCE expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2498,9 +2498,9 @@ ber_old_sequence_try_again: offset = dissect_ber_identifier(actx->pinfo, tree, tvb, hoffset, NULL, NULL, NULL); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, NULL, NULL); if ( seq->ber_class == BER_CLASS_UNI) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in sequence expected class:%s(%d) tag:%d(%s) but found class:%s(%d) tag:%d", + "Wrong field in sequence expected class:%s(%d) tag:%d(%s) but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2510,9 +2510,9 @@ ber_old_sequence_try_again: tag); expert_add_info(actx->pinfo, cause, &ei_ber_sequence_field_wrong); } else { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in sequence expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", + "Wrong field in sequence expected class:%s(%d) tag:%d but found class:%s(%d) tag:%d", val_to_str_const(seq->ber_class, ber_class_codes, "Unknown"), seq->ber_class, seq->tag, @@ -2628,9 +2628,9 @@ printf("SEQUENCE dissect_ber_old_sequence(%s) subdissector ate %d bytes\n", name /* if we didnt end up at exactly offset, then we ate too many bytes */ if (offset != end_offset) { tvb_ensure_bytes_exist(tvb, offset-2, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-2, 2, "illegal_length", - "BER Error: Sequence ate %d too many bytes", + "Sequence ate %d too many bytes", offset - end_offset); expert_add_info_format(actx->pinfo, cause, &ei_ber_error_length, "BER Error: too many bytes in Sequence"); @@ -2707,9 +2707,9 @@ printf("SET dissect_ber_set(%s) entered\n", name); || (!implicit_tag && ((classx != BER_CLASS_UNI) || (tagx != BER_UNI_TAG_SET)))) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, "set_expected", - "BER Error: SET expected but class:%s(%d) %s tag:%d was found", + "SET expected but class:%s(%d) %s tag:%d was found", val_to_str_const(classx, ber_class_codes, "Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -2869,9 +2869,9 @@ printf("SET dissect_ber_set(%s) calling subdissector\n", name); if (!cset->func) { /* we didn't find a match */ - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "unknown_field", - "BER Error: Unknown field in SET class:%s(%d) tag:%d", + "Unknown field in SET class:%s(%d) tag:%d", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, tag); @@ -2891,9 +2891,9 @@ printf("SET dissect_ber_set(%s) calling subdissector\n", name); for (set_idx = 0; (cset = &set[set_idx])->func && (set_idx < MAX_SET_ELEMENTS); set_idx++) { if (mandatory_fields & (1 << set_idx)) { /* here is something we should have seen - but didn't! */ - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, "missing_field", - "BER Error: Missing field in SET class:%s(%d) tag:%d expected", + "Missing field in SET class:%s(%d) tag:%d expected", val_to_str_const(cset->ber_class, ber_class_codes, "Unknown"), cset->ber_class, cset->tag); @@ -2907,9 +2907,9 @@ printf("SET dissect_ber_set(%s) calling subdissector\n", name); /* if we didnt end up at exactly offset, then we ate too many bytes */ if (offset != end_offset) { tvb_ensure_bytes_exist(tvb, offset-2, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-2, 2, "illegal_length", - "BER Error: SET ate %d too many bytes", + "SET ate %d too many bytes", offset - end_offset); expert_add_info_format(actx->pinfo, cause, &ei_ber_error_length, "BER Error: too many bytes in SET"); @@ -2987,9 +2987,9 @@ printf("SET dissect_old_ber_set(%s) entered\n", name); || (!implicit_tag && ((classx != BER_CLASS_UNI) || (tagx != BER_UNI_TAG_SET)))) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, "set_expected", - "BER Error: SET expected but class:%s(%d) %s tag:%d was found", + "SET expected but class:%s(%d) %s tag:%d was found", val_to_str_const(classx, ber_class_codes, "Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -3145,9 +3145,9 @@ printf("SET dissect_old_ber_set(%s) calling subdissector\n", name); if (!cset->func) { /* we didn't find a match */ - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "unknown_field", - "BER Error: Unknown field in SET class:%s(%d) tag:%d", + "Unknown field in SET class:%s(%d) tag:%d", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, tag); @@ -3167,9 +3167,9 @@ printf("SET dissect_old_ber_set(%s) calling subdissector\n", name); for (set_idx = 0; (cset = &set[set_idx])->func && (set_idx < MAX_SET_ELEMENTS); set_idx++) { if (mandatory_fields & (1 << set_idx)) { /* here is something we should have seen - but didn't! */ - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, "missing_field", - "BER Error: Missing field in SET class:%s(%d) tag:%d expected", + "Missing field in SET class:%s(%d) tag:%d expected", val_to_str_const(cset->ber_class, ber_class_codes, "Unknown"), cset->ber_class, cset->tag); @@ -3181,9 +3181,9 @@ printf("SET dissect_old_ber_set(%s) calling subdissector\n", name); /* if we didnt end up at exactly offset, then we ate too many bytes */ if (offset != end_offset) { tvb_ensure_bytes_exist(tvb, offset-2, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-2, 2, "illegal_length", - "BER Error: SET ate %d too many bytes", + "SET ate %d too many bytes", offset - end_offset); expert_add_info_format(actx->pinfo, cause, &ei_ber_error_length, "BER Error: too many bytes in SET"); @@ -3251,9 +3251,9 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n", name, tvb_length_remain } if (tvb_length_remaining(tvb, offset) == 0) { - item = proto_tree_add_string_format( + item = proto_tree_add_string_format_value( parent_tree, hf_ber_error, tvb, offset, 0, "empty_choice", - "BER Error: Empty choice was found"); + "Empty choice was found"); expert_add_info(actx->pinfo, item, &ei_ber_empty_choice); return offset; } @@ -3435,9 +3435,9 @@ printf("CHOICE dissect_ber_choice(%s) trying again\n", name); /* oops no more entries and we still havent found * our guy :-( */ - item = proto_tree_add_string_format( + item = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "missing_choice_field", - "BER Error: This choice field was not found."); + "This choice field was not found."); expert_add_info(actx->pinfo, item, &ei_ber_choice_not_found); return end_offset; #endif @@ -3482,9 +3482,9 @@ printf("CHOICE dissect_ber_old_choice(%s) entered len:%d\n", name, tvb_length_re start_offset = offset; if (tvb_length_remaining(tvb, offset) == 0) { - item = proto_tree_add_string_format( + item = proto_tree_add_string_format_value( parent_tree, hf_ber_error, tvb, offset, 0, "empty_choice", - "BER Error: Empty choice was found"); + "Empty choice was found"); expert_add_info(actx->pinfo, item, &ei_ber_empty_choice); return offset; } @@ -3668,9 +3668,9 @@ printf("CHOICE dissect_ber_old_choice(%s) trying again\n", name); /* oops no more entries and we still havent found * our guy :-( */ - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "missing_choice_field", - "BER Error: This choice field was not found."); + "This choice field was not found."); expert_add_info(actx->pinfo, item, &ei_ber_choice_not_found); return end_offset; #endif @@ -3712,9 +3712,9 @@ dissect_ber_GeneralString(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int if ( (ber_class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_GENSTR) ) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "generalstring_expected", - "BER Error: GeneralString expected but class:%s(%d) %s tag:%d was unexpected", + "GeneralString expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag); @@ -3779,9 +3779,9 @@ printf("RESTRICTED STRING dissect_ber_octet_string(%s) entered\n", name); if ( (ber_class != BER_CLASS_UNI) || (tag != type) ) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "string_expected", - "BER Error: String with tag=%d expected but class:%s(%d) %s tag:%d was unexpected", + "String with tag=%d expected but class:%s(%d) %s tag:%d was unexpected", type, val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -3876,9 +3876,9 @@ printf("OBJECT IDENTIFIER dissect_ber_object_identifier(%s) entered\n", name); if ( (ber_class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_OID) ) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "oid_expected", - "BER Error: Object Identifier expected but class:%s(%d) %s tag:%d was unexpected", + "Object Identifier expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -3995,10 +3995,10 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n", name); || (!implicit_tag && ((classx != BER_CLASS_UNI) || (tagx != type)))) { tvb_ensure_bytes_exist(tvb, hoffsetx, 2); - causex = proto_tree_add_string_format( + causex = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, (type == BER_UNI_TAG_SEQUENCE) ? "set_of_expected" : "sequence_of_expected", - "BER Error: %s Of expected but class:%s(%d) %s tag:%d was unexpected", + "%s Of expected but class:%s(%d) %s tag:%d was unexpected", (type == BER_UNI_TAG_SEQUENCE) ? "Set" : "Sequence", val_to_str_const(classx, ber_class_codes, "Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -4118,9 +4118,9 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n", name); if ((seq->ber_class != ber_class) || (seq->tag != tag) ) { if (!(seq->flags & BER_FLAGS_NOTCHKTAG)) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in SQ OF(tag %u expected %u)", + "Wrong field in SQ OF(tag %u expected %u)", tag, seq->tag); expert_add_info_format( @@ -4170,9 +4170,9 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n", name); /* if we didnt end up at exactly offset, then we ate too many bytes */ if (offset != end_offset) { tvb_ensure_bytes_exist(tvb, offset-2, 2); - causex = proto_tree_add_string_format( + causex = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-2, 2, "illegal_length", - "BER Error: %s Of ate %d too many bytes", + "%s Of ate %d too many bytes", (type == BER_UNI_TAG_SEQUENCE) ? "Set" : "Sequence", offset - end_offset); expert_add_info_format(actx->pinfo, causex, &ei_ber_error_length, @@ -4235,10 +4235,10 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n", name); || (!implicit_tag && ((classx != BER_CLASS_UNI) || (tagx != type)))) { tvb_ensure_bytes_exist(tvb, hoffsetx, 2); - causex = proto_tree_add_string_format( + causex = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, lenx, (type == BER_UNI_TAG_SEQUENCE) ? "set_of_expected" : "sequence_of_expected", - "BER Error: %s Of expected but class:%s(%d) %s tag:%d was unexpected", + "%s Of expected but class:%s(%d) %s tag:%d was unexpected", (type == BER_UNI_TAG_SEQUENCE) ? "Set" : "Sequence", val_to_str_const(classx, ber_class_codes, "Unknown"), classx, @@ -4355,9 +4355,9 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n", name); if ((seq->ber_class != ber_class) || (seq->tag != tag) ) { if (!(seq->flags & BER_FLAGS_NOTCHKTAG)) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "wrong_field", - "BER Error: Wrong field in SQ OF"); + "Wrong field in SQ OF"); expert_add_info_format( actx->pinfo, cause, &ei_ber_sequence_field_wrong, "BER Error: Wrong field in Sequence Of"); @@ -4401,9 +4401,9 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n", name); /* if we didn't end up at exactly offset, then we ate too many bytes */ if (offset != end_offset) { tvb_ensure_bytes_exist(tvb, offset-2, 2); - causex =proto_tree_add_string_format( + causex =proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset-2, 2, "illegal_length", - "BER Error: %s Of ate %d too many bytes", + "%s Of ate %d too many bytes", (type == BER_UNI_TAG_SEQUENCE) ? "Set" : "Sequence", offset-end_offset); expert_add_info_format(actx->pinfo, causex, &ei_ber_error_length, @@ -4474,9 +4474,9 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree if ( (ber_class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_GeneralizedTime)) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "generalized_time_expected", - "BER Error: GeneralizedTime expected but class:%s(%d) %s tag:%d was unexpected", + "GeneralizedTime expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -4494,9 +4494,9 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree } if ((len < 14) || (len > 23)) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "illegal_length", - "BER Error: GeneralizedTime invalid length: %u", + "GeneralizedTime invalid length: %u", len); expert_add_info_format(actx->pinfo, cause, &ei_ber_error_length, "BER Error: GeneralizedTime invalid length"); @@ -4519,9 +4519,9 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree ret = sscanf( tmpstr, "%14d%1[.,+-Z]%4d%1[+-Z]%4d", &tmp_int, first_delim, &first_digits, second_delim, &second_digits); /* tmp_int does not contain valid value bacause of overflow but we use it just for format checking */ if (ret < 1) { - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "invalid_generalized_time", - "BER Error: GeneralizedTime invalid format: %s", + "GeneralizedTime invalid format: %s", tmpstr); expert_add_info(actx->pinfo, cause, &ei_ber_invalid_format_generalized_time); if (decode_unexpected) { @@ -4596,9 +4596,9 @@ dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, t /* sanity check: we only handle UTCTime */ if ( (ber_class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_UTCTime) ) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( tree, hf_ber_error, tvb, offset, len, "utctime_expected", - "BER Error: UTCTime expected but class:%s(%d) %s tag:%d was unexpected", + "UTCTime expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, @@ -4756,9 +4756,9 @@ dissect_ber_constrained_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto if ( (ber_class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_BITSTRING) ) { tvb_ensure_bytes_exist(tvb, hoffset, 2); - cause = proto_tree_add_string_format( + cause = proto_tree_add_string_format_value( parent_tree, hf_ber_error, tvb, offset, len, "bitstring_expected", - "BER Error: BitString expected but class:%s(%d) %s tag:%d was unexpected", + "BitString expected but class:%s(%d) %s tag:%d was unexpected", val_to_str_const(ber_class, ber_class_codes, "Unknown"), ber_class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag); diff --git a/epan/dissectors/packet-dcerpc-eventlog.c b/epan/dissectors/packet-dcerpc-eventlog.c index 55b906e444..8f36ec482c 100644 --- a/epan/dissectors/packet-dcerpc-eventlog.c +++ b/epan/dissectors/packet-dcerpc-eventlog.c @@ -408,7 +408,7 @@ eventlog_dissect_element_Record_strings(tvbuff_t *tvb, int offset, packet_info * int len; len=eventlog_get_unicode_string_length(tvb, string_offset); str=tvb_get_faked_unicode(wmem_packet_scope(), tvb, string_offset, len, TRUE); - proto_tree_add_string_format(tree, hf_eventlog_Record_string, tvb, string_offset, len*2, str, "string: %s", str); + proto_tree_add_string_format_value(tree, hf_eventlog_Record_string, tvb, string_offset, len*2, str, "%s", str); string_offset+=len*2; num_of_strings--; diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index 7917f51c46..4b7dd74027 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -1730,9 +1730,9 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, value = tvb_get_ntohs (tvb, offset); failure = dmp_dec_xbyte_sic (value, sic, 3, FALSE); - sf = proto_tree_add_string_format (message_tree, hf_message_sic, tvb, + sf = proto_tree_add_string_format_value(message_tree, hf_message_sic, tvb, offset, 2, sic, - "SIC: %s [A-Z0-9 only]%s", sic, + "%s [A-Z0-9 only]%s", sic, failure ? " (invalid)": ""); if (failure) { expert_add_info(pinfo, sf, &ei_message_sic_illegal); @@ -1745,9 +1745,9 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, value = tvb_get_ntohl (tvb, offset); value = (value >> 8) & 0x48FFFF; failure = dmp_dec_xbyte_sic (value, sic, 3, TRUE); - sf = proto_tree_add_string_format (message_tree, hf_message_sic, tvb, + sf = proto_tree_add_string_format_value(message_tree, hf_message_sic, tvb, offset, 3, sic, - "SIC: %s [any character]%s", sic, + "%s [any character]%s", sic, failure ? " (invalid)": ""); if (failure) { expert_add_info(pinfo, sf, &ei_message_sic_illegal); diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index 71eacaa5f9..4c971fe479 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -682,6 +682,15 @@ gboolean show_soc_flags = FALSE; /* Define the tap for epl */ /*static gint epl_tap = -1;*/ +static void +elp_version( gchar *result, guint32 version ) +{ +/* + proto_tree_add_string_format_value(epl_tree, hf_epl_soa_eplv, tvb, offset, + 1, "", "EPLVersion %d.%d", hi_nibble(eplversion), lo_nibble(eplversion)); +*/ + g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%d", hi_nibble(version), lo_nibble(version)); +} /* Code to actually dissect the packets */ static int @@ -927,8 +936,7 @@ dissect_epl_preq(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint o offset += 2; pdoversion = tvb_get_guint8(tvb, offset); - proto_tree_add_string_format(epl_tree, hf_epl_preq_pdov, tvb, offset, - 1, "", "PDOVersion %d.%d", hi_nibble(pdoversion), lo_nibble(pdoversion)); + proto_tree_add_item(epl_tree, hf_epl_preq_pdov, tvb, offset, 1, ENC_NA); offset += 2; /* get size of payload */ @@ -979,8 +987,7 @@ dissect_epl_pres(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 offset += 1; pdoversion = tvb_get_guint8(tvb, offset); - proto_tree_add_string_format(epl_tree, hf_epl_pres_pdov, tvb, offset, - 1, "", "PDOVersion %d.%d", hi_nibble(pdoversion), lo_nibble(pdoversion)); + proto_tree_add_item(epl_tree, hf_epl_pres_pdov, tvb, offset, 1, ENC_NA); offset += 2; /* get size of payload */ @@ -1005,7 +1012,6 @@ dissect_epl_pres(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 gint dissect_epl_soa(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 epl_src, gint offset) { - guint8 eplversion; guint8 svid, target; if (epl_src != EPL_MN_NODEID) /* check if CN or MN */ @@ -1036,9 +1042,7 @@ dissect_epl_soa(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 target, val_to_str(svid, soa_svid_vals, "Unknown (%d)")); } - eplversion = tvb_get_guint8(tvb, offset); - proto_tree_add_string_format(epl_tree, hf_epl_soa_eplv, tvb, offset, - 1, "", "EPLVersion %d.%d", hi_nibble(eplversion), lo_nibble(eplversion)); + proto_tree_add_item(epl_tree, hf_epl_soa_eplv, tvb, offset, 1, ENC_NA); offset += 1; return offset; @@ -1092,7 +1096,7 @@ dissect_epl_asnd(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 gint dissect_epl_ainv(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 epl_src, gint offset) { - guint8 svid, svtg, eplversion; + guint8 svid; proto_item *item; proto_tree *subtree; @@ -1138,14 +1142,9 @@ dissect_epl_ainv(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 break; case EPL_SOA_UNSPECIFIEDINVITE: - svtg = tvb_get_guint8(tvb, offset); - proto_tree_add_uint (epl_tree, hf_epl_asnd_svtg, tvb, offset, 1, svtg ); + proto_tree_add_item(epl_tree, hf_epl_asnd_svtg, tvb, offset, 1, ENC_NA ); offset += 1; - - eplversion = tvb_get_guint8(tvb, offset); - proto_tree_add_string_format(epl_tree, hf_epl_soa_eplv, tvb, offset, - 1, "", "EPLVersion %d.%d", hi_nibble(eplversion), lo_nibble(eplversion)); - + proto_tree_add_item(epl_tree, hf_epl_soa_eplv, tvb, offset, 1, ENC_NA); break; case EPL_ASND_SDO: @@ -1220,7 +1219,6 @@ dissect_epl_asnd_nmtcmd(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint dissect_epl_asnd_ires(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 epl_src, gint offset) { - guint8 eplversion; guint16 profile,additional; guint32 epl_asnd_identresponse_ipa, epl_asnd_identresponse_snm, epl_asnd_identresponse_gtw; guint32 epl_asnd_ires_feat; @@ -1245,9 +1243,7 @@ dissect_epl_asnd_ires(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, g } offset += 2; - eplversion = tvb_get_guint8(tvb, offset); - proto_tree_add_string_format(epl_tree, hf_epl_asnd_identresponse_ever, tvb, offset, - 1, "", "EPLVersion %d.%d", hi_nibble(eplversion), lo_nibble(eplversion)); + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_ever, tvb, offset, 1, ENC_NA); offset += 2; /* decode FeatureFlags */ @@ -1284,8 +1280,8 @@ dissect_epl_asnd_ires(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, g profile = tvb_get_letohs(tvb, offset); additional = tvb_get_letohs(tvb, offset+2); - proto_tree_add_string_format(epl_tree, hf_epl_asnd_identresponse_dt, tvb, offset, - 4, "", "Device Type: Profile %d (%s), Additional Information: 0x%4.4X", + proto_tree_add_string_format_value(epl_tree, hf_epl_asnd_identresponse_dt, tvb, offset, + 4, "", "Profile %d (%s), Additional Information: 0x%4.4X", profile, val_to_str_const(profile, epl_device_profiles, "Unknown Profile"), additional); proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_profile, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -1821,7 +1817,7 @@ proto_register_epl(void) }, { &hf_epl_preq_pdov, { "PDOVersion", "epl.preq.pdov", - FT_STRING, BASE_NONE, NULL, 0x00, + FT_UINT8, BASE_CUSTOM, elp_version, 0x00, NULL, HFILL } }, { &hf_epl_preq_size, @@ -1920,7 +1916,7 @@ proto_register_epl(void) }, { &hf_epl_soa_eplv, { "EPLVersion", "epl.soa.eplv", - FT_STRING, BASE_NONE, NULL, 0x00, + FT_UINT8, BASE_CUSTOM, elp_version, 0x00, NULL, HFILL } }, @@ -1975,7 +1971,7 @@ proto_register_epl(void) }, { &hf_epl_asnd_identresponse_ever, { "EPLVersion", "epl.asnd.ires.eplver", - FT_STRING, BASE_NONE, NULL, 0x00, + FT_UINT8, BASE_CUSTOM, elp_version, 0x00, NULL, HFILL } }, { &hf_epl_asnd_identresponse_feat, diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index a553b8c475..235ca2919a 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -4534,7 +4534,7 @@ dissect_gtpv2_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre real_nr = (guint16)binary_nr + 1; /* 3GPP TS 29.061 17.7.6 MBMS-Service-Area AVP */ - proto_tree_add_string_format(tree, hf_gtpv2_mbms_service_area_nr, tvb, offset, 1, "", "Number of MBMS Service Area codes: %d", real_nr); + proto_tree_add_uint(tree, hf_gtpv2_mbms_service_area_nr, tvb, offset, 1, real_nr); offset += 1; /* A consecutive list of MBMS Service Area Identities follow, each with a length of two octets. */ @@ -4747,7 +4747,7 @@ dissect_gtpv2_mbms_time_to_data_xfer(tvbuff_t *tvb, packet_info *pinfo _U_, prot binary_secs = tvb_get_guint8(tvb, offset); real_secs = (guint16)binary_secs + 1; - proto_tree_add_string_format(tree, hf_gtpv2_time_to_data_xfer, tvb, offset, 1, "", "MBMS Time to Data Transfer: %d second(s)", real_secs); + proto_tree_add_string_format_value(tree, hf_gtpv2_time_to_data_xfer, tvb, offset, 1, "", "%d second(s)", real_secs); proto_item_append_text(item, " %u second(s)", real_secs); offset += 1; if (length > 1) @@ -6753,7 +6753,7 @@ void proto_register_gtpv2(void) }, { &hf_gtpv2_mbms_service_area_nr, {"Number of MBMS Service Area codes", "gtpv2.mbms_service_area_nr", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} }, { &hf_gtpv2_mbms_service_area_id, diff --git a/epan/dissectors/packet-hsrp.c b/epan/dissectors/packet-hsrp.c index 8b2d6e3d3b..08953f464e 100644 --- a/epan/dissectors/packet-hsrp.c +++ b/epan/dissectors/packet-hsrp.c @@ -398,8 +398,8 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ offset++; tvb_memcpy(tvb, auth_buf, offset, 8); auth_buf[sizeof auth_buf - 1] = '\0'; - proto_tree_add_string_format(hsrp_tree, hf_hsrp_auth_data, tvb, offset, 8, auth_buf, - "Authentication Data: %sDefault (%s)", + proto_tree_add_string_format_value(hsrp_tree, hf_hsrp_auth_data, tvb, offset, 8, auth_buf, + "%sDefault (%s)", (tvb_strneql(tvb, offset, "cisco", strlen("cisco"))) == 0 ? "" : "Non-", auth_buf); offset += 8; @@ -546,8 +546,8 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ tvb_memcpy(tvb, auth_buf, offset, 8); auth_buf[sizeof auth_buf - 1] = '\0'; - proto_tree_add_string_format(text_auth_tlv, hf_hsrp2_auth_data, tvb, offset, 8, auth_buf, - "Authentication Data: %sDefault (%s)", + proto_tree_add_string_format_value(text_auth_tlv, hf_hsrp2_auth_data, tvb, offset, 8, auth_buf, + "%sDefault (%s)", (tvb_strneql(tvb, offset, "cisco", strlen("cisco"))) == 0 ? "" : "Non-", auth_buf); /* offset += 8; */ diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index 129c502549..ede2f3c972 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -2703,9 +2703,9 @@ isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o if (tree) { char* value = print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2); - proto_tree_add_string_format(lsp_tree, hf_isis_lsp_lsp_id, + proto_tree_add_string_format_value(lsp_tree, hf_isis_lsp_lsp_id, tvb, offset, id_length + 2, - value, "LSP-ID: %s", value); + value, "%s", value); } col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s", diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 9cb2e36d2f..292b53c3ae 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -1178,8 +1178,8 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of 0, 0, nns->name); PROTO_ITEM_SET_HIDDEN(fh_item); } else { - fh_item=proto_tree_add_string_format(tree, hf_nfs_name, tvb, - fh_offset, 0, nns->name, "Name: %s", nns->name); + fh_item=proto_tree_add_string_format_value(tree, hf_nfs_name, tvb, + fh_offset, 0, nns->name, "%s", nns->name); } PROTO_ITEM_SET_GENERATED(fh_item); @@ -1189,8 +1189,8 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of 0, 0, nns->full_name); PROTO_ITEM_SET_HIDDEN(fh_item); } else { - fh_item=proto_tree_add_string_format(tree, hf_nfs_full_name, tvb, - fh_offset, 0, nns->full_name, "Full Name: %s", nns->full_name); + fh_item=proto_tree_add_string_format_value(tree, hf_nfs_full_name, tvb, + fh_offset, 0, nns->full_name, "%s", nns->full_name); } PROTO_ITEM_SET_GENERATED(fh_item); } diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c index 2dedc45559..1ad7a596e3 100644 --- a/epan/dissectors/packet-pktc.c +++ b/epan/dissectors/packet-pktc.c @@ -431,9 +431,8 @@ dissect_pktc_rekey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs /* Timestamp: YYMMDDhhmmssZ */ /* They really came up with a two-digit year in late 1990s! =8o */ timestr=tvb_get_ptr(tvb, offset, 13); - proto_tree_add_string_format(tree, hf_pktc_timestamp, tvb, offset, 13, timestr, - "%s: %.2s-%.2s-%.2s %.2s:%.2s:%.2s", - proto_registrar_get_name(hf_pktc_timestamp), + proto_tree_add_string_format_value(tree, hf_pktc_timestamp, tvb, offset, 13, timestr, + "%.2s-%.2s-%.2s %.2s:%.2s:%.2s", timestr, timestr+2, timestr+4, timestr+6, timestr+8, timestr+10); offset+=13; diff --git a/epan/dissectors/packet-rtnet.c b/epan/dissectors/packet-rtnet.c index 093d280c20..81abc149f8 100644 --- a/epan/dissectors/packet-rtnet.c +++ b/epan/dissectors/packet-rtnet.c @@ -607,8 +607,8 @@ dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { type_str = "Unknown"; } } - proto_tree_add_string_format(rtmac_tree, hf_rtmac_header_type, tvb, offset, 2, - type_str, "Type: %s (0x%04x)", type_str, type); + proto_tree_add_string_format_value(rtmac_tree, hf_rtmac_header_type, tvb, offset, 2, + type_str, "%s (0x%04x)", type_str, type); offset += 2; proto_tree_add_item(rtmac_tree, hf_rtmac_header_ver, tvb, offset, 1, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index d818e29529..ba6283f265 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -2847,13 +2847,11 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr * lookup in "media_type" dissector table. */ case POS_CONTENT_TYPE : - if(hdr_tree) { - proto_tree_add_string_format(hdr_tree, + proto_tree_add_string_format(hdr_tree, hf_header_array[hf_index], tvb, offset, next_offset - offset, value, "%s", tvb_format_text(tvb, offset, linelen)); - } content_type_len = value_len; semi_colon_offset = tvb_find_guint8(tvb, value_offset, value_len, ';'); /* Content-Type = ( "Content-Type" / "c" ) HCOLON media-type @@ -2911,15 +2909,14 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr * ( STAR / (contact-param *(COMMA contact-param))) * contact-param = (name-addr / addr-spec) *(SEMI contact-params) */ - if(hdr_tree) { - sip_element_item = proto_tree_add_string_format(hdr_tree, + sip_element_item = proto_tree_add_string_format(hdr_tree, hf_header_array[hf_index], tvb, offset, next_offset - offset, value, "%s", tvb_format_text(tvb, offset, linelen)); - sip_element_tree = proto_item_add_subtree( sip_element_item, + sip_element_tree = proto_item_add_subtree( sip_element_item, ett_sip_element); - } + /* value_offset points to the first non SWS character after ':' */ c = tvb_get_guint8(tvb, value_offset); if (c =='*'){ @@ -3078,26 +3075,23 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr /* Content-Encoding = ( "Content-Encoding" / "e" ) HCOLON * content-coding *(COMMA content-coding) */ - if(hdr_tree) { - proto_tree_add_string_format(hdr_tree, + proto_tree_add_string_format(hdr_tree, hf_header_array[hf_index], tvb, offset, next_offset - offset, value, "%s", tvb_format_text(tvb, offset, linelen)); - } + content_encoding_parameter_str = ascii_strdown_inplace(tvb_get_string(wmem_packet_scope(), tvb, value_offset, (line_end_offset-value_offset))); break; default : /* Default case is to assume it's an FT_STRING field */ - if(hdr_tree) { - proto_tree_add_string_format(hdr_tree, + proto_tree_add_string_format(hdr_tree, hf_header_array[hf_index], tvb, offset, next_offset - offset, value, "%s", tvb_format_text(tvb, offset, linelen)); - } - break; + break; }/* end switch */ }/*if HF_index */ }/* if colon_offset */ diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c index 86510b60f6..2fb7cbf887 100644 --- a/epan/dissectors/packet-slsk.c +++ b/epan/dissectors/packet-slsk.c @@ -970,8 +970,8 @@ static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree len = tvb_get_letohl(tvb, offset); proto_tree_add_uint(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len); str = tvb_get_string(wmem_packet_scope(), tvb, offset+4, len); - proto_tree_add_string_format(slsk_tree, hf_slsk_connection_type, tvb, offset+4, len, str, - "Connection Type: %s (Char: %s)", connection_type(str), + proto_tree_add_string_format_value(slsk_tree, hf_slsk_connection_type, tvb, offset+4, len, str, + "%s (Char: %s)", connection_type(str), format_text(str, len)); offset += 4+len; } @@ -990,8 +990,8 @@ static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree len = tvb_get_letohl(tvb, offset); proto_tree_add_uint(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len); str = tvb_get_string(wmem_packet_scope(), tvb, offset+4, len); - proto_tree_add_string_format(slsk_tree, hf_slsk_connection_type, tvb, offset+4, len, str, - "Connection Type: %s (Char: %s)", connection_type(str), + proto_tree_add_string_format_value(slsk_tree, hf_slsk_connection_type, tvb, offset+4, len, str, + "%s (Char: %s)", connection_type(str), format_text(str, len)); offset += 4+len; proto_tree_add_item(slsk_tree, hf_slsk_ip, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -2347,8 +2347,8 @@ static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree len = tvb_get_letohl(tvb, offset); proto_tree_add_uint(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len); str = tvb_get_string(wmem_packet_scope(), tvb, offset+4, len); - proto_tree_add_string_format(slsk_tree, hf_slsk_connection_type, tvb, offset+4, len, str, - "Connection Type: %s (Char: %s)", connection_type(str), + proto_tree_add_string_format_value(slsk_tree, hf_slsk_connection_type, tvb, offset+4, len, str, + "%s (Char: %s)", connection_type(str), format_text(str, len)); offset += 4+len; proto_tree_add_uint(slsk_tree, hf_slsk_token, tvb, offset, 4, tvb_get_letohl(tvb, offset)); diff --git a/epan/dissectors/packet-t30.c b/epan/dissectors/packet-t30.c index f77558adbe..dc050f0e47 100644 --- a/epan/dissectors/packet-t30.c +++ b/epan/dissectors/packet-t30.c @@ -511,8 +511,8 @@ dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot str_num = t30_get_string_numbers(tvb, offset, len); if (str_num) { - proto_tree_add_string_format(tree, hf_t30_fif_number, tvb, offset, LENGTH_T30_NUM, str_num, - "Number: %s", str_num); + proto_tree_add_string_format_value(tree, hf_t30_fif_number, tvb, offset, LENGTH_T30_NUM, str_num, + "%s", str_num); col_append_fstr(pinfo->cinfo, COL_INFO, " - Number:%s", str_num ); @@ -640,8 +640,8 @@ dissect_t30_partial_page_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_uint(tree, hf_t30_partial_page_request_frame_count, tvb, offset, 1, frame_count); if (buf_top > buf+1) { buf_top[-2] = '\0'; - proto_tree_add_string_format(tree, hf_t30_partial_page_request_frames, tvb, offset, (gint)(buf_top-buf), - buf, "Frames: %s", buf); + proto_tree_add_string_format_value(tree, hf_t30_partial_page_request_frames, tvb, offset, (gint)(buf_top-buf), + buf, "%s", buf); } col_append_fstr(pinfo->cinfo, COL_INFO, " - %d frames", frame_count); diff --git a/epan/dissectors/packet-tnef.c b/epan/dissectors/packet-tnef.c index 8dcd9efe9f..14242a4a1c 100644 --- a/epan/dissectors/packet-tnef.c +++ b/epan/dissectors/packet-tnef.c @@ -408,8 +408,8 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset += 4; name_string = tvb_get_unicode_string (wmem_packet_scope(), tvb, offset, tag_length, ENC_LITTLE_ENDIAN); - proto_tree_add_string_format(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, - tag_length, name_string, "Name: %s", name_string); + proto_tree_add_string_format_value(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, + tag_length, name_string, "%s", name_string); offset += tag_length; if((padding = (4 - tag_length % 4)) != 4) { diff --git a/epan/dissectors/packet-vtp.c b/epan/dissectors/packet-vtp.c index 5e2a64db46..ef476ed492 100644 --- a/epan/dissectors/packet-vtp.c +++ b/epan/dissectors/packet-vtp.c @@ -179,9 +179,9 @@ dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 4; upd_timestamp = tvb_get_string(wmem_packet_scope(), tvb, offset, 12); - proto_tree_add_string_format(vtp_tree, hf_vtp_upd_ts, tvb, + proto_tree_add_string_format_value(vtp_tree, hf_vtp_upd_ts, tvb, offset, 12, (gchar*)upd_timestamp, - "Update Timestamp: %.2s-%.2s-%.2s %.2s:%.2s:%.2s", + "%.2s-%.2s-%.2s %.2s:%.2s:%.2s", &upd_timestamp[0], &upd_timestamp[2], &upd_timestamp[4], &upd_timestamp[6], &upd_timestamp[8], &upd_timestamp[10]); offset += 12; diff --git a/epan/dissectors/packet-windows-common.c b/epan/dissectors/packet-windows-common.c index 2ca22a9ae1..6f3bca5f54 100644 --- a/epan/dissectors/packet-windows-common.c +++ b/epan/dissectors/packet-windows-common.c @@ -1698,8 +1698,8 @@ dissect_nt_sid(tvbuff_t *tvb, int offset, proto_tree *parent_tree, tvb, offset_sid_start+2, 6, authority, "%" G_GINT64_MODIFIER "u", authority); /* Add subauthorities */ - proto_tree_add_string_format (subtree, hf_nt_sid_subauth, tvb, sa_offset, - num_auth*4, wmem_strbuf_get_str(sa_str), "Subauthorities: %s", wmem_strbuf_get_str(sa_str)); + proto_tree_add_string_format_value(subtree, hf_nt_sid_subauth, tvb, sa_offset, + num_auth*4, wmem_strbuf_get_str(sa_str), "%s", wmem_strbuf_get_str(sa_str)); if (rid) { item = proto_tree_add_item (subtree, @@ -1709,23 +1709,23 @@ dissect_nt_sid(tvbuff_t *tvb, int offset, proto_tree *parent_tree, /* Add well-known SID and domain strings if present */ if (wmem_strbuf_get_len(wkwn_sid1_str) > 0) { - hidden_item = proto_tree_add_string_format( + hidden_item = proto_tree_add_string_format_value( subtree, hf_nt_sid_wkwn, tvb, offset_sid_start, wkwn_sid1_len, - wmem_strbuf_get_str(wkwn_sid1_str), "Well-known SID: %s", wmem_strbuf_get_str(wkwn_sid1_str)); + wmem_strbuf_get_str(wkwn_sid1_str), "%s", wmem_strbuf_get_str(wkwn_sid1_str)); proto_item_append_text(hidden_item, " (%s)", mapped_name); PROTO_ITEM_SET_HIDDEN(hidden_item); } if (wmem_strbuf_get_len(wkwn_sid2_str) > 0) { - hidden_item = proto_tree_add_string_format( + hidden_item = proto_tree_add_string_format_value( subtree, hf_nt_sid_wkwn, tvb, offset_sid_start, wkwn_sid2_len, - wmem_strbuf_get_str(wkwn_sid2_str), "Well-known SID: %s", wmem_strbuf_get_str(wkwn_sid2_str)); + wmem_strbuf_get_str(wkwn_sid2_str), "%s", wmem_strbuf_get_str(wkwn_sid2_str)); proto_item_append_text(hidden_item, " (%s)", wmem_strbuf_get_str(label_str)); PROTO_ITEM_SET_HIDDEN(hidden_item); } if (domain_sid && wmem_strbuf_get_len(domain_str) > 0) { - hidden_item = proto_tree_add_string_format( + hidden_item = proto_tree_add_string_format_value( subtree, hf_nt_sid_domain, tvb, offset_sid_start + 12, 12, - wmem_strbuf_get_str(domain_str), "Domain: %s", wmem_strbuf_get_str(domain_str)); + wmem_strbuf_get_str(domain_str), "%s", wmem_strbuf_get_str(domain_str)); PROTO_ITEM_SET_HIDDEN(hidden_item); } @@ -2892,7 +2892,7 @@ proto_do_register_windows_common(int proto_smb) NULL, 0, NULL, HFILL }}, { &hf_nt_sid_domain, - { "Domain:", "nt.sid.domain", FT_STRING, BASE_NONE, + { "Domain", "nt.sid.domain", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, /* ACLs */ diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index 703547ae97..209be44dc3 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -2152,10 +2152,9 @@ static void string16_with_buffer_preallocated(tvbuff_t *tvb, proto_tree *t, if (truncated) { *dp++ = '.'; *dp++ = '.'; *dp++ = '.'; } *dp++ = '\0'; - proto_tree_add_string_format(t, hf, tvb, offset, length, + proto_tree_add_string_format_value(t, hf, tvb, offset, length, (const gchar *)tvb_get_ptr(tvb, offset, length), - "%s: %s", - proto_registrar_get_nth(hf) -> name, + "%s", *s); } else proto_tree_add_item(t, hf_bytes, tvb, offset, length, byte_order); diff --git a/epan/dissectors/packet-zrtp.c b/epan/dissectors/packet-zrtp.c index 368462e3ba..e9a8a0a8db 100644 --- a/epan/dissectors/packet-zrtp.c +++ b/epan/dissectors/packet-zrtp.c @@ -594,11 +594,11 @@ dissect_Commit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *zrtp_tree) { proto_tree_add_item(zrtp_tree, hf_zrtp_msg_zid, tvb, data_offset+0, 12, ENC_NA); tvb_memcpy(tvb, (void *)value, data_offset+12, 4); value[4] = '\0'; - proto_tree_add_string_format(zrtp_tree, hf_zrtp_msg_hash, tvb, data_offset+12, 4, value, - "Hash: %s", key_to_val(value, 4, zrtp_hash_type_vals, "Unknown hash type %s")); + proto_tree_add_string_format_value(zrtp_tree, hf_zrtp_msg_hash, tvb, data_offset+12, 4, value, + "%s", key_to_val(value, 4, zrtp_hash_type_vals, "Unknown hash type %s")); tvb_memcpy(tvb, (void *)value, data_offset+16, 4); value[4] = '\0'; - proto_tree_add_string_format(zrtp_tree, hf_zrtp_msg_cipher, tvb, data_offset+16, 4, value, "Cipher: %s", + proto_tree_add_string_format_value(zrtp_tree, hf_zrtp_msg_cipher, tvb, data_offset+16, 4, value, "%s", key_to_val(value, 4, zrtp_cipher_type_vals, "Unknown cipher type %s")); tvb_memcpy(tvb, (void *)value, data_offset+20, 4); value[4] = '\0'; @@ -606,8 +606,8 @@ dissect_Commit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *zrtp_tree) { "Auth tag: %s", key_to_val(value, 4, zrtp_auth_tag_vals, "Unknown auth tag %s")); tvb_memcpy(tvb, (void *)value, data_offset+24, 4); value[4] = '\0'; - proto_tree_add_string_format(zrtp_tree, hf_zrtp_msg_keya, tvb, data_offset+24, 4, value, - "Key agreement: %s", key_to_val(value, 4, zrtp_key_agreement_vals, "Unknown key agreement %s")); + proto_tree_add_string_format_value(zrtp_tree, hf_zrtp_msg_keya, tvb, data_offset+24, 4, value, + "%s", key_to_val(value, 4, zrtp_key_agreement_vals, "Unknown key agreement %s")); if(!strncmp(value, "Mult", 4)) { key_type = 1; |