From e52c95c6c8cdac34eccdba9b49d68a6982685f1a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 23 Apr 2017 16:48:17 -0700 Subject: Move UI-only stuff out of libwireshark. Packet ranges are used only in the UI; move the packet range stuff into libui. Don't pass a print_args_t structure to libwireshark packet-printing routines, just pass the few parameters they need. Move the declaration of print_args_t into file.h. Change-Id: Icff5991eea7d7d56f33b4716105895263d275bcf Reviewed-on: https://code.wireshark.org/review/21308 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- tshark.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'tshark.c') diff --git a/tshark.c b/tshark.c index 2989460182..7fc5938385 100644 --- a/tshark.c +++ b/tshark.c @@ -3779,8 +3779,6 @@ print_columns(capture_file *cf) static gboolean print_packet(capture_file *cf, epan_dissect_t *edt) { - print_args_t print_args; - if (print_summary || output_fields_has_cols(output_fields)) { /* Just fill in the columns. */ epan_dissect_fill_in_columns(edt, FALSE, TRUE); @@ -3811,19 +3809,8 @@ print_packet(capture_file *cf, epan_dissect_t *edt) switch (output_action) { case WRITE_TEXT: - /* Only initialize the fields that are actually used in proto_tree_print. - * This is particularly important for .range, as that's heap memory which - * we would otherwise have to g_free(). - print_args.to_file = TRUE; - print_args.format = print_format; - print_args.print_summary = print_summary; - print_args.print_formfeed = FALSE; - packet_range_init(&print_args.range, &cfile); - */ - print_args.print_hex = print_hex; - print_args.print_dissections = print_details ? print_dissections_expanded : print_dissections_none; - - if (!proto_tree_print(&print_args, edt, output_only_tables, print_stream)) + if (!proto_tree_print(print_details ? print_dissections_expanded : print_dissections_none, + print_hex, edt, output_only_tables, print_stream)) return FALSE; if (!print_hex) { if (!print_line(print_stream, 0, separator)) @@ -3840,20 +3827,19 @@ print_packet(capture_file *cf, epan_dissect_t *edt) printf("\n"); return !ferror(stdout); case WRITE_JSON: - print_args.print_dissections = print_dissections_expanded; - print_args.print_hex = print_hex; - write_json_proto_tree(output_fields, &print_args, protocolfilter, protocolfilter_flags, edt, stdout); + write_json_proto_tree(output_fields, print_dissections_expanded, + print_hex, protocolfilter, protocolfilter_flags, + edt, stdout); printf("\n"); return !ferror(stdout); case WRITE_JSON_RAW: - print_args.print_dissections = print_dissections_none; - print_args.print_hex = TRUE; - write_json_proto_tree(output_fields, &print_args, protocolfilter, protocolfilter_flags, edt, stdout); + write_json_proto_tree(output_fields, print_dissections_none, TRUE, + protocolfilter, protocolfilter_flags, edt, stdout); printf("\n"); return !ferror(stdout); case WRITE_EK: - print_args.print_hex = print_hex; - write_ek_proto_tree(output_fields, &print_args, protocolfilter, protocolfilter_flags, edt, stdout); + write_ek_proto_tree(output_fields, print_hex, protocolfilter, + protocolfilter_flags, edt, stdout); return !ferror(stdout); } } -- cgit v1.2.1