aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-09-07 11:33:38 +0000
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-09-07 11:33:38 +0000
commitcd8831c72d3517943d7754a463ed3c24a1dfd30b (patch)
tree6623ba0126249a71242ce00b21d117c6c49d49bd
parent7473e1e04cf079b9ea6414a2a4913718d14ba46e (diff)
Track length of columns strings. We'll need this in order to resize columns quickly
svn path=/trunk/; revision=29759
-rw-r--r--epan/frame_data.h1
-rw-r--r--file.c1
-rw-r--r--gtk/packet_list_store.c12
3 files changed, 11 insertions, 3 deletions
diff --git a/epan/frame_data.h b/epan/frame_data.h
index 90b44f919c..69b551b2e4 100644
--- a/epan/frame_data.h
+++ b/epan/frame_data.h
@@ -59,6 +59,7 @@ typedef struct _frame_data {
nstime_t del_cap_ts; /* Delta timestamp to previous captured frame (yes, it can be negative) */
gint64 file_off; /* File offset */
gchar **col_text; /* The column text for some columns, see colum_utils */
+ guint *col_text_len; /* The length of the column text strings in 'col_text' */
} frame_data;
/*
diff --git a/file.c b/file.c
index fe971f4b96..65fd2b2b19 100644
--- a/file.c
+++ b/file.c
@@ -1266,6 +1266,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
fdata->flags.ref_time = 0;
fdata->color_filter = NULL;
fdata->col_text = NULL;
+ fdata->col_text_len = NULL;
fdata->abs_ts.secs = phdr->ts.secs;
fdata->abs_ts.nsecs = phdr->ts.nsecs;
diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c
index 81c5d206e3..9ccacec645 100644
--- a/gtk/packet_list_store.c
+++ b/gtk/packet_list_store.c
@@ -660,12 +660,15 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
g_assert(record->physical_pos == row);
if (record->fdata->col_text && record->fdata->col_text[col] != NULL)
- /* Column already contains a value. Bail out */
+ /* TODO: Column already contains a value. Bail out */
return;
- if (!record->fdata->col_text)
+ if (!record->fdata->col_text) {
+ record->fdata->col_text_len = se_alloc0(sizeof(record->fdata->col_text) *
+ (packet_list->n_columns-1));
record->fdata->col_text = se_alloc0(sizeof(record->fdata->col_text) *
(packet_list->n_columns-1));
+ }
switch (cfile.cinfo.col_fmt[col]) {
case COL_PROTOCOL:
@@ -679,12 +682,15 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
if (cinfo->col_data[col] != cinfo->col_buf[col]) {
/* This is a constant string, so we don't have to copy it */
record->fdata->col_text[col] = (gchar *) cinfo->col_data[col];
+ record->fdata->col_text_len[col] = (guint) strlen(record->fdata->col_text[col]);
break;
}
/* !! FALL-THROUGH!! */
default:
- record->fdata->col_text[col] = se_strdup(cinfo->col_data[col]);
+ record->fdata->col_text_len[col] = (guint) strlen(cinfo->col_data[col]);
+ record->fdata->col_text[col] = se_memdup(cinfo->col_data[col],
+ record->fdata->col_text_len[col] + 1);
break;
}
}