aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/column-utils.c73
-rw-r--r--epan/column-utils.h3
-rw-r--r--epan/libwireshark.def3
-rw-r--r--file.c23
-rw-r--r--gtk/main_packet_list.c4
-rw-r--r--ui_util.h2
6 files changed, 81 insertions, 27 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 35db056570..d8a94041b2 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -341,6 +341,17 @@ have_custom_cols(column_info *cinfo)
return FALSE;
}
+gboolean
+col_has_time_fmt(column_info *cinfo, gint col)
+{
+ return ((cinfo->fmt_matx[col][COL_CLS_TIME]) ||
+ (cinfo->fmt_matx[col][COL_ABS_TIME]) ||
+ (cinfo->fmt_matx[col][COL_ABS_DATE_TIME]) ||
+ (cinfo->fmt_matx[col][COL_REL_TIME]) ||
+ (cinfo->fmt_matx[col][COL_DELTA_TIME]) ||
+ (cinfo->fmt_matx[col][COL_DELTA_TIME_DIS]));
+}
+
static void
col_do_append_sep_va_fstr(column_info *cinfo, gint el, const gchar *separator,
const gchar *format, va_list ap)
@@ -936,14 +947,8 @@ col_set_epoch_time(frame_data *fd, column_info *cinfo, int col)
g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time_delta",COL_MAX_LEN);
g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
}
-/* Set the format of the variable time format.
- XXX - this is called from "file.c" when the user changes the time
- format they want for "command-line-specified" time; it's a bit ugly
- that we have to export it, but if we go to a CList-like widget that
- invokes callbacks to get the text for the columns rather than
- requiring us to stuff the text into the widget from outside, we
- might be able to clean this up. */
-void
+
+static void
col_set_cls_time(frame_data *fd, column_info *cinfo, gint col)
{
switch (timestamp_get_type()) {
@@ -972,9 +977,55 @@ col_set_cls_time(frame_data *fd, column_info *cinfo, gint col)
break;
case TS_NOT_SET:
- /* code is missing for this case, but I don't know which [jmayer20051219] */
- g_assert(FALSE);
- break;
+ /* code is missing for this case, but I don't know which [jmayer20051219] */
+ g_assert(FALSE);
+ break;
+ }
+}
+
+/* Set the format of the variable time format.
+ XXX - this is called from "file.c" when the user changes the time
+ format they want for "command-line-specified" time; it's a bit ugly
+ that we have to export it, but if we go to a CList-like widget that
+ invokes callbacks to get the text for the columns rather than
+ requiring us to stuff the text into the widget from outside, we
+ might be able to clean this up. */
+void
+col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col)
+{
+ switch (fmt) {
+ case COL_CLS_TIME:
+ col_set_cls_time(fd, cinfo, col);
+ break;
+
+ case COL_ABS_TIME:
+ col_set_abs_time(fd, cinfo, col);
+ break;
+
+ case COL_ABS_DATE_TIME:
+ col_set_abs_date_time(fd, cinfo, col);
+ break;
+
+ case COL_REL_TIME:
+ col_set_rel_time(fd, cinfo, col);
+ break;
+
+ case COL_DELTA_TIME:
+ col_set_delta_time(fd, cinfo, col);
+ break;
+
+ case COL_DELTA_TIME_DIS:
+ col_set_delta_time_dis(fd, cinfo, col);
+ break;
+
+ case COL_REL_CONV_TIME:
+ case COL_DELTA_CONV_TIME:
+ /* Will be set by various dissectors */
+ break;
+
+ default:
+ g_assert_not_reached();
+ break;
}
}
diff --git a/epan/column-utils.h b/epan/column-utils.h
index 9042bccf90..dcf0e0aae0 100644
--- a/epan/column-utils.h
+++ b/epan/column-utils.h
@@ -64,7 +64,7 @@ extern void col_init(column_info *cinfo);
*
* Internal, don't use this in dissectors!
*/
-extern void col_set_cls_time(frame_data *, column_info *cinfo, gint col);
+extern void col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col);
/** Fill in all columns of the given packet.
*
@@ -152,6 +152,7 @@ void col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo);
/* For internal Wireshark use only. Not to be called from dissectors. */
gboolean have_custom_cols(column_info *cinfo);
+gboolean col_has_time_fmt(column_info *cinfo, gint col);
/** Append the given text to a column element, the text will be copied.
*
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index 41f6ad4a6c..a143f16591 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -82,10 +82,11 @@ col_custom_set_fstr
col_format_desc
col_format_to_string
col_get_writable
+col_has_time_fmt
col_prepend_fence_fstr
col_prepend_fstr
-col_set_cls_time
col_set_fence
+col_set_fmt_time
col_set_str
col_set_time
col_set_writable
diff --git a/file.c b/file.c
index 977e9a32f1..8c0affb019 100644
--- a/file.c
+++ b/file.c
@@ -2504,7 +2504,6 @@ cf_change_time_formats(capture_file *cf)
gchar status_str[100];
int progbar_nextstep;
int progbar_quantum;
- int first, last;
gboolean sorted_by_frame_column;
@@ -2517,14 +2516,16 @@ cf_change_time_formats(capture_file *cf)
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)) {
+ if (!check_col(&cf->cinfo, COL_CLS_TIME) &&
+ !check_col(&cf->cinfo, COL_ABS_TIME) &&
+ !check_col(&cf->cinfo, COL_ABS_DATE_TIME) &&
+ !check_col(&cf->cinfo, COL_REL_TIME) &&
+ !check_col(&cf->cinfo, COL_DELTA_TIME) &&
+ !check_col(&cf->cinfo, COL_DELTA_TIME_DIS)) {
/* No, there aren't any columns in that format, so we have no work
to do. */
return;
}
- first = cf->cinfo.col_first[COL_CLS_TIME];
- g_assert(first >= 0);
- last = cf->cinfo.col_last[COL_CLS_TIME];
/* Freeze the packet list while we redo it, so we don't get any
screen updates while it happens. */
@@ -2630,12 +2631,12 @@ cf_change_time_formats(capture_file *cf)
if (row != -1) {
/* This packet is in the summary list, on row "row". */
- for (i = first; i <= last; i++) {
- if (cf->cinfo.fmt_matx[i][COL_CLS_TIME]) {
+ for (i = 0; i < cf->cinfo.num_cols; i++) {
+ if (col_has_time_fmt(&cf->cinfo, i)) {
/* 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);
+ col_set_fmt_time(fdata, &cf->cinfo, cf->cinfo.col_fmt[i], i);
packet_list_set_text(row, i, cf->cinfo.col_data[i]);
}
}
@@ -2649,9 +2650,9 @@ cf_change_time_formats(capture_file *cf)
/* Set the column widths of those columns that show the time in
"command-line-specified" format. */
- for (i = first; i <= last; i++) {
- if (cf->cinfo.fmt_matx[i][COL_CLS_TIME]) {
- packet_list_set_cls_time_width(i);
+ for (i = 0; i < cf->cinfo.num_cols; i++) {
+ if (col_has_time_fmt(&cf->cinfo, i)) {
+ packet_list_set_time_width(cf->cinfo.col_fmt[i], i);
}
}
diff --git a/gtk/main_packet_list.c b/gtk/main_packet_list.c
index a03aab2c32..065dfb117a 100644
--- a/gtk/main_packet_list.c
+++ b/gtk/main_packet_list.c
@@ -808,7 +808,7 @@ packet_list_set_text(gint row, gint column, const gchar *text)
/* Set the column widths of those columns that show the time in
* "command-line-specified" format. */
void
-packet_list_set_cls_time_width(gint column)
+packet_list_set_time_width(gint col_fmt, gint column)
{
gint width = -1;
PangoLayout *layout;
@@ -818,7 +818,7 @@ packet_list_set_cls_time_width(gint column)
}
if (width == -1) {
layout = gtk_widget_create_pango_layout(packet_list,
- get_column_longest_string(COL_CLS_TIME));
+ get_column_longest_string(col_fmt));
pango_layout_get_pixel_size(layout, &width, NULL);
g_object_unref(G_OBJECT(layout));
}
diff --git a/ui_util.h b/ui_util.h
index 6c8d94d5b8..ac85a65d1b 100644
--- a/ui_util.h
+++ b/ui_util.h
@@ -64,7 +64,7 @@ gint packet_list_append(const gchar *text[], gpointer data);
void packet_list_set_colors(gint, color_t *, color_t *);
gint packet_list_find_row_from_data(gpointer);
void packet_list_set_text(gint, gint, const gchar *);
-void packet_list_set_cls_time_width(gint);
+void packet_list_set_time_width(gint, gint);
gpointer packet_list_get_row_data(gint);
void packet_list_set_selected_row(gint);
gint packet_list_get_sort_column(void);