aboutsummaryrefslogtreecommitdiffstats
path: root/epan/column.c
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2007-06-04 20:15:10 +0000
committerStephen Fisher <steve@stephen-fisher.com>2007-06-04 20:15:10 +0000
commitd1d72fd2323cfb9ccf2946f78f0ca11e335d4941 (patch)
tree0ea11efa36fc21fb021d7370d32a1e278f97cc69 /epan/column.c
parentc4b66c82e760e2eb48ea8173bd5172f4b8d000f4 (diff)
Fix for bug #93: changes to the columns has no effect until restart
These changes allow the packet list clist to be destroyed and recreated with the new column titles/values/order that the user changed in the preferences without restarting Wireshark. svn path=/trunk/; revision=22038
Diffstat (limited to 'epan/column.c')
-rw-r--r--epan/column.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/epan/column.c b/epan/column.c
index 135b57e8e0..b246d097aa 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -37,6 +37,9 @@
#include <epan/timestamp.h>
#include <epan/prefs.h>
+#include <epan/nstime.h>
+#include <epan/dfilter/dfilter.h>
+#include "cfile.h"
#include <epan/column.h>
#include <epan/packet.h>
@@ -752,3 +755,46 @@ get_column_title(gint col) {
return(cfmt->title);
}
+
+void
+build_column_format_array(capture_file *cfile, gboolean reset_fences)
+{
+ int i, j;
+
+ col_setup(&cfile->cinfo, prefs.num_cols);
+
+ for (i = 0; i < cfile->cinfo.num_cols; i++) {
+ cfile->cinfo.col_fmt[i] = get_column_format(i);
+ cfile->cinfo.col_title[i] = g_strdup(get_column_title(i));
+ cfile->cinfo.fmt_matx[i] = (gboolean *) g_malloc0(sizeof(gboolean) *
+ NUM_COL_FMTS);
+ get_column_format_matches(cfile->cinfo.fmt_matx[i],
+ cfile->cinfo.col_fmt[i]);
+ cfile->cinfo.col_data[i] = NULL;
+
+ if (cfile->cinfo.col_fmt[i] == COL_INFO)
+ cfile->cinfo.col_buf[i] = (gchar *) g_malloc(sizeof(gchar) *
+ COL_MAX_INFO_LEN);
+ else
+ cfile->cinfo.col_buf[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
+
+ if(reset_fences)
+ cfile->cinfo.col_fence[i] = 0;
+
+ cfile->cinfo.col_expr[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
+ cfile->cinfo.col_expr_val[i] = (gchar *) g_malloc(sizeof(gchar) *
+ COL_MAX_LEN);
+ }
+
+ for (i = 0; i < cfile->cinfo.num_cols; i++) {
+ for (j = 0; j < NUM_COL_FMTS; j++) {
+ if (!cfile->cinfo.fmt_matx[i][j])
+ continue;
+
+ if (cfile->cinfo.col_first[j] == -1)
+ cfile->cinfo.col_first[j] = i;
+
+ cfile->cinfo.col_last[j] = i;
+ }
+ }
+}