Track length of columns strings. We'll need this in order to resize columns quickly
svn path=/trunk/; revision=29759
This commit is contained in:
parent
7473e1e04c
commit
cd8831c72d
|
@ -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;
|
||||
|
||||
/*
|
||||
|
|
1
file.c
1
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue