From e25562baddd7a675510daea9bb6a6e4ab36b2d68 Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Mon, 20 Jul 2015 11:09:06 -0400 Subject: Pcapng: clean up Section Header Block handling Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258 Reviewed-on: https://code.wireshark.org/review/9726 Reviewed-by: Hadriel Kaplan Petri-Dish: Hadriel Kaplan Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- capinfos.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'capinfos.c') diff --git a/capinfos.c b/capinfos.c index 3ca451c0cf..dd20593c5e 100644 --- a/capinfos.c +++ b/capinfos.c @@ -1012,7 +1012,7 @@ process_cap_file(wtap *wth, const char *filename) nstime_t prev_time; gboolean know_order = FALSE; order_t order = IN_ORDER; - wtapng_section_t *shb_inf; + const gchar *shb_comment; gchar *p; @@ -1167,19 +1167,18 @@ process_cap_file(wtap *wth, const char *filename) } cf_info.comment = NULL; - shb_inf = wtap_file_get_shb_info(wth); - if (shb_inf) { + shb_comment = wtap_file_get_shb_comment(wth); + if (shb_comment) { /* opt_comment is always 0-terminated by pcapng_read_section_header_block */ - cf_info.comment = g_strdup(shb_inf->opt_comment); - } - g_free(shb_inf); - if (cf_info.comment) { + cf_info.comment = g_strdup(shb_comment); /* multi-line comments would conflict with the formatting that capinfos uses - we replace linefeeds with spaces */ + we replace carriage-returns/linefeeds with spaces */ p = cf_info.comment; while (*p != '\0') { if (*p == '\n') *p = ' '; + if (*p == '\r') + *p = ' '; p++; } } -- cgit v1.2.1