From ae760a4caaee2a889760daab583789aab0c15536 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 3 Jan 2002 22:27:44 +0000 Subject: [PATCH] In "change_time_formats()" we can now check at the beginning whether there are any columns whose time formats will change, and just return if there aren't. We also, however, need to set the "writable" flag on the columns before doing that check, as "check_col()" checks whether the column in question is writable; in this context, all columns are writable. svn path=/trunk/; revision=4472 --- file.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/file.c b/file.c index 834356f3e2..04ced07bf8 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.255 2001/12/18 19:09:01 gram Exp $ + * $Id: file.c,v 1.256 2002/01/03 22:27:44 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1275,6 +1275,18 @@ change_time_formats(capture_file *cf) int i; GtkStyle *pl_style; + /* Are there any columns with time stamps in the "command-line-specified" + format? + + XXX - we have to force the "column is writable" flag on, as it + might be off from the last frame that was dissected. */ + col_set_writable(&cf->cinfo, TRUE); + if (!check_col(&cf->cinfo, COL_CLS_TIME)) { + /* No, there aren't any columns in that format, so we have no work + to do. */ + return; + } + /* Freeze the packet list while we redo it, so we don't get any screen updates while it happens. */ freeze_clist(cf); @@ -1328,22 +1340,14 @@ change_time_formats(capture_file *cf) if (row != -1) { /* This packet is in the summary list, on row "row". */ - /* XXX - there really should be a way of checking "cf->cinfo" for this; - the answer isn't going to change from packet to packet, so we should - simply skip all the "change_time_formats()" work if we're not - changing anything. */ - if (check_col(&cf->cinfo, COL_CLS_TIME)) { - /* There are columns that show the time in the "command-line-specified" - format; update them. */ - for (i = 0; i < cf->cinfo.num_cols; i++) { - if (cf->cinfo.fmt_matx[i][COL_CLS_TIME]) { - /* This is one of the columns that shows the time in - "command-line-specified" format; update it. */ - cf->cinfo.col_buf[i][0] = '\0'; - col_set_cls_time(fdata, &cf->cinfo, i); - gtk_clist_set_text(GTK_CLIST(packet_list), row, i, - cf->cinfo.col_data[i]); - } + for (i = 0; i < cf->cinfo.num_cols; i++) { + if (cf->cinfo.fmt_matx[i][COL_CLS_TIME]) { + /* This is one of the columns that shows the time in + "command-line-specified" format; update it. */ + cf->cinfo.col_buf[i][0] = '\0'; + col_set_cls_time(fdata, &cf->cinfo, i); + gtk_clist_set_text(GTK_CLIST(packet_list), row, i, + cf->cinfo.col_data[i]); } } }