From c01ace71efae9ccd2d59a3ab483cd31d7617177b Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 20 Mar 2019 00:01:46 -0700 Subject: Write out the last packet in text_import(). Write out the last packet after text_import_scan() returns, if it returned successfully, the same way that it's done in text2pcap. This means we can get rid of the EOF rule in the lexer - the lexer just finishes and returns 0 to text_import_scan(), which then returns a success indication to text_import() - and make write_current_packet() static. Change-Id: Ibafdbe01da6bb33a213a32847f1981bc943290a1 Reviewed-on: https://code.wireshark.org/review/32486 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- ui/text_import.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui/text_import.c') diff --git a/ui/text_import.c b/ui/text_import.c index 186a95648a..da67324423 100644 --- a/ui/text_import.c +++ b/ui/text_import.c @@ -384,7 +384,7 @@ number_of_padding_bytes (guint32 length) /*---------------------------------------------------------------------- * Write current packet out */ -void +static void write_current_packet (void) { int prefix_length = 0; @@ -1117,6 +1117,9 @@ text_import(text_import_info_t *info) max_offset = info->max_frame_length; ret = text_import_scan(info->import_text_file); + if (ret == 0) { + write_current_packet(); + } g_free(packet_buf); return ret; } -- cgit v1.2.3