summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-05-03 01:19:55 +0000
committerGuy Harris <guy@alum.mit.edu>2011-05-03 01:19:55 +0000
commitb42fab3a61e7cd30fdb080a8d325c4d53e466fc6 (patch)
treecec86e3788874081101f6aa1535e400c83b30a08 /gtk
parent11565cd07064ea83ccfe4d868e9774b293008f45 (diff)
downloadwireshark-b42fab3a61e7cd30fdb080a8d325c4d53e466fc6.tar.gz
TShark doesn't need column text attached to each frame; move col_text
and col_text_len from the frame_data structure to the PacketRecord structure. svn path=/trunk/; revision=36967
Diffstat (limited to 'gtk')
-rw-r--r--gtk/new_packet_list.c6
-rw-r--r--gtk/packet_list_store.c46
-rw-r--r--gtk/packet_list_store.h6
3 files changed, 33 insertions, 25 deletions
diff --git a/gtk/new_packet_list.c b/gtk/new_packet_list.c
index d95a454846..05cd8cd502 100644
--- a/gtk/new_packet_list.c
+++ b/gtk/new_packet_list.c
@@ -1332,13 +1332,13 @@ show_cell_data_func(GtkTreeViewColumn *col _U_, GtkCellRenderer *renderer,
!record->colorized);
}
- g_assert(fdata->col_text);
+ g_assert(record->col_text);
if (col_based_on_frame_data(&cfile.cinfo, col_num)) {
col_fill_in_frame_data(fdata, &cfile.cinfo, col_num, FALSE);
cell_text = cfile.cinfo.col_data[col_num];
}else
- cell_text = fdata->col_text[col_num];
+ cell_text = record->col_text[col_num];
g_assert(cell_text);
@@ -1655,7 +1655,7 @@ get_col_text_from_record( PacketListRecord *record, gint col_num, gchar** cell_t
col_fill_in_frame_data(record->fdata, &cfile.cinfo, col_id, FALSE);
*cell_text = g_strdup(cfile.cinfo.col_data[col_id]);
}else
- *cell_text = g_strdup(record->fdata->col_text[col_id]);
+ *cell_text = g_strdup(record->col_text[col_id]);
return TRUE;
}
diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c
index e1204b5699..cd1ff3d7a4 100644
--- a/gtk/packet_list_store.c
+++ b/gtk/packet_list_store.c
@@ -379,8 +379,8 @@ packet_list_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column,
g_value_set_pointer(value, record);
break;
case G_TYPE_STRING:
- g_return_if_fail(record->fdata->col_text);
- g_value_set_string(value, record->fdata->col_text[column]);
+ g_return_if_fail(record->col_text);
+ g_value_set_string(value, record->col_text[column]);
break;
default:
g_warning (G_STRLOC ": Unsupported type (%s) retrieved.", g_type_name (value->g_type));
@@ -631,6 +631,8 @@ packet_list_append_record(PacketList *packet_list, frame_data *fdata)
newrecord = se_alloc(sizeof(PacketListRecord));
newrecord->columnized = FALSE;
newrecord->colorized = FALSE;
+ newrecord->col_text_len = se_alloc0(sizeof(*newrecord->col_text_len) * cfile.cinfo.num_cols);
+ newrecord->col_text = se_alloc0(sizeof(*newrecord->col_text) * cfile.cinfo.num_cols);
newrecord->fdata = fdata;
newrecord->physical_pos = PACKET_LIST_RECORD_COUNT(packet_list->physical_rows);
@@ -676,9 +678,9 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
g_assert(record->physical_pos == row);
- g_assert((record->fdata->col_text != NULL)&&(record->fdata->col_text_len != NULL));
+ g_assert((record->col_text != NULL)&&(record->col_text_len != NULL));
- if (record->fdata->col_text[col] != NULL)
+ if (record->col_text[col] != NULL)
/* TODO: Column already contains a value. Bail out */
return;
@@ -710,8 +712,8 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
case COL_FREQ_CHAN:
if (cinfo->col_data[col] && 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]);
+ record->col_text[col] = (gchar *) cinfo->col_data[col];
+ record->col_text_len[col] = (guint) strlen(record->col_text[col]);
#ifdef NEW_PACKET_LIST_STATISTICS
++packet_list->const_strings;
#endif
@@ -720,10 +722,10 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
/* !! FALL-THROUGH!! */
default:
- record->fdata->col_text_len[col] = (guint) strlen(cinfo->col_data[col]);
+ record->col_text_len[col] = (guint) strlen(cinfo->col_data[col]);
- if (!record->fdata->col_text_len[col]) {
- record->fdata->col_text[col] = "";
+ if (!record->col_text_len[col]) {
+ record->col_text[col] = "";
#ifdef NEW_PACKET_LIST_STATISTICS
++packet_list->const_strings;
#endif
@@ -738,7 +740,7 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
} else {
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_data[col]);
}
- record->fdata->col_text[col] = str;
+ record->col_text[col] = str;
break;
}
}
@@ -956,8 +958,8 @@ packet_list_compare_custom(gint sort_id, PacketListRecord *a, PacketListRecord *
(hfi->type == FT_RELATIVE_TIME)))
{
/* Attempt to convert to numbers */
- double num_a = atof(a->fdata->col_text[sort_id]);
- double num_b = atof(b->fdata->col_text[sort_id]);
+ double num_a = atof(a->col_text[sort_id]);
+ double num_b = atof(b->col_text[sort_id]);
if (num_a < num_b)
return -1;
@@ -967,25 +969,25 @@ packet_list_compare_custom(gint sort_id, PacketListRecord *a, PacketListRecord *
return frame_data_compare(a->fdata, b->fdata, COL_NUMBER);
}
- return strcmp(a->fdata->col_text[sort_id], b->fdata->col_text[sort_id]);
+ return strcmp(a->col_text[sort_id], b->col_text[sort_id]);
}
static gint
_packet_list_compare_records(gint sort_id, PacketListRecord *a,
PacketListRecord *b)
{
- g_assert(a->fdata->col_text);
- g_assert(b->fdata->col_text);
- g_assert(a->fdata->col_text[sort_id]);
- g_assert(b->fdata->col_text[sort_id]);
+ g_assert(a->col_text);
+ g_assert(b->col_text);
+ g_assert(a->col_text[sort_id]);
+ g_assert(b->col_text[sort_id]);
- if(a->fdata->col_text[sort_id] == b->fdata->col_text[sort_id])
+ if(a->col_text[sort_id] == b->col_text[sort_id])
return 0; /* no need to call strcmp() */
if (cfile.cinfo.col_fmt[sort_id] == COL_CUSTOM) {
return packet_list_compare_custom (sort_id, a, b);
}
- return strcmp(a->fdata->col_text[sort_id], b->fdata->col_text[sort_id]);
+ return strcmp(a->col_text[sort_id], b->col_text[sort_id]);
}
static gint
@@ -1331,9 +1333,9 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
for(vis_idx = 0; vis_idx < PACKET_LIST_RECORD_COUNT(packet_list->visible_rows); ++vis_idx) {
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, vis_idx);
- if (record->fdata->col_text_len[col] > widest_column_len) {
- widest_column_str = record->fdata->col_text[col];
- widest_column_len = record->fdata->col_text_len[col];
+ if (record->col_text_len[col] > widest_column_len) {
+ widest_column_str = record->col_text[col];
+ widest_column_len = record->col_text_len[col];
}
}
diff --git a/gtk/packet_list_store.h b/gtk/packet_list_store.h
index ddaf5ff2da..3d5f14ce65 100644
--- a/gtk/packet_list_store.h
+++ b/gtk/packet_list_store.h
@@ -61,6 +61,12 @@ struct _PacketListRecord
gboolean columnized;
/** Has this record been colorized? */
gboolean colorized;
+
+ /** The column text for some columns */
+ gchar **col_text;
+ /**< The length of the column text strings in 'col_text' */
+ guint *col_text_len;
+
frame_data *fdata;
/* admin stuff used by the custom list model */