diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2012-12-07 22:00:56 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2012-12-07 22:00:56 +0000 |
commit | 3ccd739fc6053e53750bad85a826ccc4abfc6fd4 (patch) | |
tree | bee5c89ac17dc0d566004db6b40cfa52f0ea78f5 /epan/dissectors | |
parent | dbaf194b10b787586c532270ac615c9b14678b9a (diff) |
removed a last if (tree) check in dissect_ftpdata()
svn path=/trunk/; revision=46460
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-ftp.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index 007c853e86..cebf76ee2f 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -909,37 +909,35 @@ dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; int data_length; + gboolean is_text = TRUE; + gint check_chars, i; col_set_str(pinfo->cinfo, COL_PROTOCOL, "FTP-DATA"); col_add_fstr(pinfo->cinfo, COL_INFO, "FTP Data: %u bytes", tvb_reported_length(tvb)); - if (tree) { - gboolean is_text = TRUE; - gint check_chars, i; - data_length = tvb_length(tvb); + data_length = tvb_length(tvb); - ti = proto_tree_add_item(tree, proto_ftp_data, tvb, 0, -1, ENC_NA); + ti = proto_tree_add_item(tree, proto_ftp_data, tvb, 0, -1, ENC_NA); - /* Check the first few chars to see whether it looks like a text file or not */ - check_chars = MIN(10, data_length); - for (i=0; i < check_chars; i++) { - if (!isprint(tvb_get_guint8(tvb, i))) { - is_text = FALSE; - break; - } - } - - if (is_text) { - /* Show as string, but don't format more text than will be displayed */ - proto_item_append_text(ti, " (%s)", tvb_format_text(tvb, 0, MIN(data_length, ITEM_LABEL_LENGTH))); - } - else { - /* Assume binary, just show the number of bytes */ - proto_item_append_text(ti, " (%u bytes data)", data_length); + /* Check the first few chars to see whether it looks like a text file or not */ + check_chars = MIN(10, data_length); + for (i=0; i < check_chars; i++) { + if (!isprint(tvb_get_guint8(tvb, i))) { + is_text = FALSE; + break; } } + + if (is_text) { + /* Show as string, but don't format more text than will be displayed */ + proto_item_append_text(ti, " (%s)", tvb_format_text(tvb, 0, MIN(data_length, ITEM_LABEL_LENGTH))); + } + else { + /* Assume binary, just show the number of bytes */ + proto_item_append_text(ti, " (%u bytes data)", data_length); + } } void |