aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/column-info.h25
-rw-r--r--epan/column-utils.c451
-rw-r--r--epan/column.c46
-rw-r--r--epan/print.c16
-rw-r--r--file.c22
-rw-r--r--tfshark.c38
-rw-r--r--tshark.c38
-rw-r--r--ui/gtk/main.c14
-rw-r--r--ui/gtk/packet_list.c16
-rw-r--r--ui/gtk/packet_list_store.c28
-rw-r--r--ui/gtk/packet_win.c2
-rw-r--r--ui/packet_list_utils.c8
-rw-r--r--ui/qt/packet_dialog.cpp2
-rw-r--r--ui/qt/packet_list.cpp6
-rw-r--r--ui/qt/packet_list_model.cpp6
-rw-r--r--ui/qt/packet_list_record.cpp10
-rw-r--r--ui/tap-sequence-analysis.c11
17 files changed, 389 insertions, 350 deletions
diff --git a/epan/column-info.h b/epan/column-info.h
index 81d4888e51..5d2a242918 100644
--- a/epan/column-info.h
+++ b/epan/column-info.h
@@ -43,22 +43,27 @@ typedef struct {
gchar **col_expr_val; /**< Value for filter expression */
} col_expr_t;
+/** Individual column info */
+typedef struct {
+ gint col_fmt; /**< Format of column */
+ gboolean *fmt_matx; /**< Specifies which formats apply to a column */
+ gchar *col_title; /**< Column titles */
+ gchar *col_custom_field; /**< Custom column field */
+ gint col_custom_occurrence;/**< Custom column field occurrence */
+ GSList *col_custom_field_ids; /**< Custom column field id */
+ struct epan_dfilter *col_custom_dfilter; /**< Compiled custom column field */
+ const gchar *col_data; /**< Column data */
+ gchar *col_buf; /**< Buffer into which to copy data for column */
+ int col_fence; /**< Stuff in column buffer before this index is immutable */
+} col_item_t;
+
/** Column info */
struct epan_column_info {
const struct epan_session *epan;
gint num_cols; /**< Number of columns */
- gint *col_fmt; /**< Format of column */
- gboolean **fmt_matx; /**< Specifies which formats apply to a column */
+ col_item_t *columns; /**< All column data */
gint *col_first; /**< First column number with a given format */
gint *col_last; /**< Last column number with a given format */
- gchar **col_title; /**< Column titles */
- gchar **col_custom_field; /**< Custom column field */
- gint *col_custom_occurrence;/**< Custom column field occurrence */
- GSList **col_custom_field_ids; /**< Custom column field id */
- struct epan_dfilter **col_custom_dfilter; /**< Compiled custom column field */
- const gchar **col_data; /**< Column data */
- gchar **col_buf; /**< Buffer into which to copy data for column */
- int *col_fence; /**< Stuff in column buffer before this index is immutable */
col_expr_t col_expr; /**< Column expressions and values */
gboolean writable; /**< writable or not @todo Are we still writing to the columns? */
};
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 581f5e6078..33eaa1f2ed 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -50,21 +50,12 @@ col_setup(column_info *cinfo, const gint num_cols)
int i;
cinfo->num_cols = num_cols;
- cinfo->col_fmt = g_new(gint, num_cols);
- cinfo->fmt_matx = g_new(gboolean*, num_cols);
+ cinfo->columns = g_new(col_item_t, num_cols);
cinfo->col_first = g_new(int, NUM_COL_FMTS);
cinfo->col_last = g_new(int, NUM_COL_FMTS);
- cinfo->col_title = g_new(gchar*, num_cols);
- cinfo->col_custom_field = g_new(gchar*, num_cols);
- cinfo->col_custom_occurrence = g_new(gint, num_cols);
- cinfo->col_custom_field_ids = g_new(GSList *, num_cols);
for (i = 0; i < num_cols; i++) {
- cinfo->col_custom_field_ids[i] = NULL;
+ cinfo->columns[i].col_custom_field_ids = NULL;
}
- cinfo->col_custom_dfilter = g_new(struct epan_dfilter*, num_cols);
- cinfo->col_data = g_new(const gchar*, num_cols);
- cinfo->col_buf = g_new(gchar*, num_cols);
- cinfo->col_fence = g_new(int, num_cols);
cinfo->col_expr.col_expr = g_new(const gchar*, num_cols + 1);
cinfo->col_expr.col_expr_val = g_new(gchar*, num_cols + 1);
@@ -81,13 +72,13 @@ col_custom_ids_free_wrapper(gpointer data, gpointer user_data _U_)
}
static void
-col_custom_field_ids_free(column_info *cinfo, int col)
+col_custom_field_ids_free(GSList** custom_field_id)
{
- if (cinfo->col_custom_field_ids[col] != NULL) {
- g_slist_foreach(cinfo->col_custom_field_ids[col], col_custom_ids_free_wrapper, NULL);
- g_slist_free(cinfo->col_custom_field_ids[col]);
+ if (*custom_field_id != NULL) {
+ g_slist_foreach(*custom_field_id, col_custom_ids_free_wrapper, NULL);
+ g_slist_free(*custom_field_id);
}
- cinfo->col_custom_field_ids[col] = NULL;
+ *custom_field_id = NULL;
}
/* Cleanup all the data structures for constructing column data; undoes
@@ -96,26 +87,23 @@ void
col_cleanup(column_info *cinfo)
{
int i;
+ col_item_t* col_item;
for (i = 0; i < cinfo->num_cols; i++) {
- g_free(cinfo->fmt_matx[i]);
- g_free(cinfo->col_title[i]);
- g_free(cinfo->col_custom_field[i]);
- dfilter_free(cinfo->col_custom_dfilter[i]);
- g_free(cinfo->col_buf[i]);
+ col_item = &cinfo->columns[i];
+ g_free(col_item->fmt_matx);
+ g_free(col_item->col_title);
+ g_free(col_item->col_custom_field);
+ dfilter_free(col_item->col_custom_dfilter);
+ g_free((gchar*)col_item->col_data);
+ g_free(col_item->col_buf);
g_free(cinfo->col_expr.col_expr_val[i]);
- col_custom_field_ids_free(cinfo, i);
+ col_custom_field_ids_free(&col_item->col_custom_field_ids);
}
- g_free(cinfo->col_fmt);
- g_free(cinfo->fmt_matx);
+ g_free(cinfo->columns);
g_free(cinfo->col_first);
g_free(cinfo->col_last);
- g_free(cinfo->col_title);
- g_free(cinfo->col_custom_field);
- g_free(cinfo->col_custom_occurrence);
- g_free(cinfo->col_custom_field_ids);
- g_free(cinfo->col_custom_dfilter);
/*
* XXX - MSVC doesn't correctly handle the "const" qualifier; it thinks
* "const XXX **" means "pointer to const pointer to XXX", i.e. that
@@ -123,10 +111,6 @@ col_cleanup(column_info *cinfo)
* pointer to const XXX", i.e. that it's a pointer to a pointer to
* something that's "const"ant. Cast its bogus complaints away.
*/
- g_free((gchar **)cinfo->col_data);
- g_free(cinfo->col_buf);
- g_free(cinfo->col_fence);
- /* XXX - see above */
g_free((gchar **)cinfo->col_expr.col_expr);
g_free(cinfo->col_expr.col_expr_val);
}
@@ -136,14 +120,16 @@ void
col_init(column_info *cinfo, const struct epan_session *epan)
{
int i;
+ col_item_t* col_item;
if (!cinfo)
return;
for (i = 0; i < cinfo->num_cols; i++) {
- cinfo->col_buf[i][0] = '\0';
- cinfo->col_data[i] = cinfo->col_buf[i];
- cinfo->col_fence[i] = 0;
+ col_item = &cinfo->columns[i];
+ col_item->col_buf[0] = '\0';
+ col_item->col_data = col_item->col_buf;
+ col_item->col_fence = 0;
cinfo->col_expr.col_expr[i] = "";
cinfo->col_expr.col_expr_val[i][0] = '\0';
}
@@ -178,13 +164,15 @@ void
col_set_fence(column_info *cinfo, const gint el)
{
int i;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- cinfo->col_fence[i] = (int)strlen(cinfo->col_data[i]);
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ col_item->col_fence = (int)strlen(col_item->col_data);
}
}
}
@@ -194,13 +182,15 @@ void
col_clear_fence(column_info *cinfo, const gint el)
{
int i;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- cinfo->col_fence[i] = 0;
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ col_item->col_fence = 0;
}
}
}
@@ -211,14 +201,16 @@ col_get_text(column_info *cinfo, const gint el)
{
int i;
const gchar* text = NULL;
+ col_item_t* col_item;
if (!(cinfo && (cinfo)->col_first[el] >= 0)) {
return NULL;
}
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- text = (cinfo->col_data[i]);
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ text = (col_item->col_data);
}
}
return text;
@@ -235,13 +227,14 @@ void
col_clear(column_info *cinfo, const gint el)
{
int i;
- int fence;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
/*
* At this point, either
*
@@ -258,14 +251,13 @@ col_clear(column_info *cinfo, const gint el)
* going to clear the column, and if it's at the end,
* we don't do anything.
*/
- fence = cinfo->col_fence[i];
- if (cinfo->col_buf[i] == cinfo->col_data[i] || fence == 0) {
+ if (col_item->col_buf == col_item->col_data || col_item->col_fence == 0) {
/*
* The fence isn't at the end of the column, or the column wasn't
* last set with "col_set_str()", so clear the column out.
*/
- cinfo->col_buf[i][fence] = '\0';
- cinfo->col_data[i] = cinfo->col_buf[i];
+ col_item->col_buf[col_item->col_fence] = '\0';
+ col_item->col_data = col_item->col_buf;
}
cinfo->col_expr.col_expr[i] = "";
cinfo->col_expr.col_expr_val[i][0] = '\0';
@@ -273,12 +265,12 @@ col_clear(column_info *cinfo, const gint el)
}
}
-#define COL_CHECK_APPEND(cinfo, i, max_len) \
- if (cinfo->col_data[i] != cinfo->col_buf[i]) { \
+#define COL_CHECK_APPEND(col_item, max_len) \
+ if (col_item->col_data != col_item->col_buf) { \
/* This was set with "col_set_str()"; copy the string they \
set it to into the buffer, so we can append to it. */ \
- g_strlcpy(cinfo->col_buf[i], cinfo->col_data[i], max_len); \
- cinfo->col_data[i] = cinfo->col_buf[i]; \
+ g_strlcpy(col_item->col_buf, col_item->col_data, max_len); \
+ col_item->col_data = col_item->col_buf; \
}
#define COL_CHECK_REF_TIME(fd, buf) \
@@ -300,19 +292,21 @@ have_custom_cols(column_info *cinfo)
void col_custom_set_edt(epan_dissect_t *edt, column_info *cinfo)
{
int i;
+ col_item_t* col_item;
if (!HAVE_CUSTOM_COLS(cinfo))
return;
for (i = cinfo->col_first[COL_CUSTOM];
i <= cinfo->col_last[COL_CUSTOM]; i++) {
- if (cinfo->fmt_matx[i][COL_CUSTOM] &&
- cinfo->col_custom_field[i] &&
- cinfo->col_custom_field_ids[i]) {
- cinfo->col_data[i] = cinfo->col_buf[i];
- cinfo->col_expr.col_expr[i] = epan_custom_set(edt, cinfo->col_custom_field_ids[i],
- cinfo->col_custom_occurrence[i],
- cinfo->col_buf[i],
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[COL_CUSTOM] &&
+ col_item->col_custom_field &&
+ col_item->col_custom_field_ids) {
+ col_item->col_data = col_item->col_buf;
+ cinfo->col_expr.col_expr[i] = epan_custom_set(edt, col_item->col_custom_field_ids,
+ col_item->col_custom_occurrence,
+ col_item->col_buf,
cinfo->col_expr.col_expr_val[i],
COL_MAX_LEN);
}
@@ -323,6 +317,7 @@ void
col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo)
{
int i;
+ col_item_t* col_item;
if (!HAVE_CUSTOM_COLS(cinfo))
return;
@@ -331,17 +326,18 @@ col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo)
i <= cinfo->col_last[COL_CUSTOM]; i++) {
int i_list = 0;
- col_custom_field_ids_free(cinfo, i);
+ col_item = &cinfo->columns[i];
+ col_custom_field_ids_free(&col_item->col_custom_field_ids);
- if (cinfo->fmt_matx[i][COL_CUSTOM] &&
- cinfo->col_custom_dfilter[i]) {
- epan_dissect_prime_dfilter(edt, cinfo->col_custom_dfilter[i]);
- if (cinfo->col_custom_field) {
+ if (col_item->fmt_matx[COL_CUSTOM] &&
+ col_item->col_custom_dfilter) {
+ epan_dissect_prime_dfilter(edt, col_item->col_custom_dfilter);
+ if (col_item->col_custom_field) {
gchar **fields;
guint i_field = 0;
fields = g_regex_split_simple(" *([^ \\|]+) *(?:(?:\\|\\|)|(?:or))? *",
- cinfo->col_custom_field[i], G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED);
+ col_item->col_custom_field, G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED);
for (i_field =0; i_field < g_strv_length(fields); i_field += 1) {
if (fields[i_field] && *fields[i_field]) {
@@ -354,8 +350,8 @@ col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo)
idx = g_new(int, 1);
*idx = id;
- cinfo->col_custom_field_ids[i] =
- g_slist_insert(cinfo->col_custom_field_ids[i], idx, i_list);
+ col_item->col_custom_field_ids =
+ g_slist_insert(col_item->col_custom_field_ids, idx, i_list);
i_list += 1;
}
}
@@ -373,6 +369,7 @@ col_append_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
size_t pos, max_len;
int i;
const gchar *str;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -383,13 +380,14 @@ col_append_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
/*
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
- pos = strlen(cinfo->col_buf[i]);
+ pos = strlen(col_item->col_buf);
if (pos >= max_len)
return;
@@ -399,7 +397,7 @@ col_append_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
if G_UNLIKELY(str == NULL)
str = "(null)";
- pos += g_strlcpy(&cinfo->col_buf[i][pos], str, max_len - pos);
+ pos += g_strlcpy(&col_item->col_buf[pos], str, max_len - pos);
} while (pos < max_len && (str = va_arg(ap, const char *)) != COL_ADD_LSTR_TERMINATOR);
va_end(ap);
@@ -412,6 +410,7 @@ col_do_append_fstr(column_info *cinfo, const int el, const char *separator, cons
{
size_t len, max_len, sep_len;
int i;
+ col_item_t* col_item;
sep_len = (separator) ? strlen(separator) : 0;
@@ -421,19 +420,20 @@ col_do_append_fstr(column_info *cinfo, const int el, const char *separator, cons
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
/*
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
- len = strlen(cinfo->col_buf[i]);
+ len = strlen(col_item->col_buf);
/*
* If we have a separator, append it if the column isn't empty.
*/
if (sep_len != 0 && len != 0) {
- g_strlcat(cinfo->col_buf[i], separator, max_len);
+ g_strlcat(col_item->col_buf, separator, max_len);
len += sep_len;
}
@@ -441,7 +441,7 @@ col_do_append_fstr(column_info *cinfo, const int el, const char *separator, cons
va_list ap2;
G_VA_COPY(ap2, ap);
- g_vsnprintf(&cinfo->col_buf[i][len], (guint32)(max_len - len), format, ap2);
+ g_vsnprintf(&col_item->col_buf[len], (guint32)(max_len - len), format, ap2);
va_end(ap2);
}
}
@@ -493,6 +493,7 @@ col_prepend_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
char orig_buf[COL_BUF_MAX_LEN];
const char *orig;
int max_len;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -503,26 +504,27 @@ col_prepend_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- if (cinfo->col_data[i] != cinfo->col_buf[i]) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ if (col_item->col_data != col_item->col_buf) {
/* This was set with "col_set_str()"; which is effectively const */
- orig = cinfo->col_data[i];
+ orig = col_item->col_data;
} else {
- g_strlcpy(orig_buf, cinfo->col_buf[i], max_len);
+ g_strlcpy(orig_buf, col_item->col_buf, max_len);
orig = orig_buf;
}
va_start(ap, format);
- g_vsnprintf(cinfo->col_buf[i], max_len, format, ap);
+ g_vsnprintf(col_item->col_buf, max_len, format, ap);
va_end(ap);
/*
* Move the fence, unless it's at the beginning of the string.
*/
- if (cinfo->col_fence[i] > 0)
- cinfo->col_fence[i] += (int) strlen(cinfo->col_buf[i]);
+ if (col_item->col_fence > 0)
+ col_item->col_fence += (int) strlen(col_item->col_buf);
- g_strlcat(cinfo->col_buf[i], orig, max_len);
- cinfo->col_data[i] = cinfo->col_buf[i];
+ g_strlcat(col_item->col_buf, orig, max_len);
+ col_item->col_data = col_item->col_buf;
}
}
}
@@ -534,6 +536,7 @@ col_prepend_fence_fstr(column_info *cinfo, const gint el, const gchar *format, .
char orig_buf[COL_BUF_MAX_LEN];
const char *orig;
int max_len;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -544,29 +547,30 @@ col_prepend_fence_fstr(column_info *cinfo, const gint el, const gchar *format, .
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- if (cinfo->col_data[i] != cinfo->col_buf[i]) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ if (col_item->col_data != col_item->col_buf) {
/* This was set with "col_set_str()"; which is effectively const */
- orig = cinfo->col_data[i];
+ orig = col_item->col_data;
} else {
- g_strlcpy(orig_buf, cinfo->col_buf[i], max_len);
+ g_strlcpy(orig_buf, col_item->col_buf, max_len);
orig = orig_buf;
}
va_start(ap, format);
- g_vsnprintf(cinfo->col_buf[i], max_len, format, ap);
+ g_vsnprintf(col_item->col_buf, max_len, format, ap);
va_end(ap);
/*
* Move the fence if it exists, else create a new fence at the
* end of the prepended data.
*/
- if (cinfo->col_fence[i] > 0) {
- cinfo->col_fence[i] += (int) strlen(cinfo->col_buf[i]);
+ if (col_item->col_fence > 0) {
+ col_item->col_fence += (int) strlen(col_item->col_buf);
} else {
- cinfo->col_fence[i] = (int) strlen(cinfo->col_buf[i]);
+ col_item->col_fence = (int) strlen(col_item->col_buf);
}
- g_strlcat(cinfo->col_buf[i], orig, max_len);
- cinfo->col_data[i] = cinfo->col_buf[i];
+ g_strlcat(col_item->col_buf, orig, max_len);
+ col_item->col_data = col_item->col_buf;
}
}
}
@@ -577,8 +581,8 @@ void
col_add_str(column_info *cinfo, const gint el, const gchar* str)
{
int i;
- int fence;
size_t max_len;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -589,21 +593,21 @@ col_add_str(column_info *cinfo, const gint el, const gchar* str)
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- fence = cinfo->col_fence[i];
- if (fence != 0) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ if (col_item->col_fence != 0) {
/*
* We will append the string after the fence.
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
} else {
/*
* There's no fence, so we can just write to the string.
*/
- cinfo->col_data[i] = cinfo->col_buf[i];
+ col_item->col_data = col_item->col_buf;
}
- g_strlcpy(&cinfo->col_buf[i][fence], str, max_len - fence);
+ g_strlcpy(&col_item->col_buf[col_item->col_fence], str, max_len - col_item->col_fence);
}
}
}
@@ -614,8 +618,8 @@ void
col_set_str(column_info *cinfo, const gint el, const gchar* str)
{
int i;
- int fence;
size_t max_len;
+ col_item_t* col_item;
DISSECTOR_ASSERT(str);
@@ -628,22 +632,22 @@ col_set_str(column_info *cinfo, const gint el, const gchar* str)
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- fence = cinfo->col_fence[i];
- if (fence != 0) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ if (col_item->col_fence != 0) {
/*
* We will append the string after the fence.
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
- g_strlcpy(&cinfo->col_buf[i][fence], str, max_len - fence);
+ g_strlcpy(&col_item->col_buf[col_item->col_fence], str, max_len - col_item->col_fence);
} else {
/*
* There's no fence, so we can just set the column to point
* to the string.
*/
- cinfo->col_data[i] = str;
+ col_item->col_data = str;
}
}
}
@@ -657,6 +661,7 @@ col_add_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
gsize pos;
gsize max_len;
const gchar *str;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -667,19 +672,20 @@ col_add_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- pos = cinfo->col_fence[i];
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ pos = col_item->col_fence;
if (pos != 0) {
/*
* We will append the string after the fence.
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
} else {
/*
* There's no fence, so we can just write to the string.
*/
- cinfo->col_data[i] = cinfo->col_buf[i];
+ col_item->col_data = col_item->col_buf;
}
va_start(ap, str1);
@@ -688,7 +694,7 @@ col_add_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
if G_UNLIKELY(str == NULL)
str = "(null)";
- pos += g_strlcpy(&cinfo->col_buf[i][pos], str, max_len - pos);
+ pos += g_strlcpy(&col_item->col_buf[pos], str, max_len - pos);
} while (pos < max_len && (str = va_arg(ap, const char *)) != COL_ADD_LSTR_TERMINATOR);
va_end(ap);
@@ -702,8 +708,8 @@ col_add_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
{
va_list ap;
int i;
- int fence;
int max_len;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -714,22 +720,22 @@ col_add_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
- fence = cinfo->col_fence[i];
- if (fence != 0) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
+ if (col_item->col_fence != 0) {
/*
* We will append the string after the fence.
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
} else {
/*
* There's no fence, so we can just write to the string.
*/
- cinfo->col_data[i] = cinfo->col_buf[i];
+ col_item->col_data = col_item->col_buf;
}
va_start(ap, format);
- g_vsnprintf(&cinfo->col_buf[i][fence], max_len - fence, format, ap);
+ g_vsnprintf(&col_item->col_buf[col_item->col_fence], max_len - col_item->col_fence, format, ap);
va_end(ap);
}
}
@@ -741,6 +747,7 @@ col_do_append_str(column_info *cinfo, const gint el, const gchar* separator,
{
int i;
size_t len, max_len;
+ col_item_t* col_item;
if (el == COL_INFO)
max_len = COL_MAX_INFO_LEN;
@@ -748,23 +755,24 @@ col_do_append_str(column_info *cinfo, const gint el, const gchar* separator,
max_len = COL_MAX_LEN;
for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
- if (cinfo->fmt_matx[i][el]) {
+ col_item = &cinfo->columns[i];
+ if (col_item->fmt_matx[el]) {
/*
* First arrange that we can append, if necessary.
*/
- COL_CHECK_APPEND(cinfo, i, max_len);
+ COL_CHECK_APPEND(col_item, max_len);
- len = cinfo->col_buf[i][0];
+ len = col_item->col_buf[0];
/*
* If we have a separator, append it if the column isn't empty.
*/
if (separator != NULL) {
if (len != 0) {
- g_strlcat(cinfo->col_buf[i], separator, max_len);
+ g_strlcat(col_item->col_buf, separator, max_len);
}
}
- g_strlcat(cinfo->col_buf[i], str, max_len);
+ g_strlcat(col_item->col_buf, str, max_len);
}
}
}
@@ -795,16 +803,17 @@ col_append_sep_str(column_info *cinfo, const gint el, const gchar* separator,
gboolean
col_has_time_fmt(column_info *cinfo, const gint col)
{
- return ((cinfo->fmt_matx[col][COL_CLS_TIME]) ||
- (cinfo->fmt_matx[col][COL_ABS_TIME]) ||
- (cinfo->fmt_matx[col][COL_ABS_YMD_TIME]) ||
- (cinfo->fmt_matx[col][COL_ABS_YDOY_TIME]) ||
- (cinfo->fmt_matx[col][COL_UTC_TIME]) ||
- (cinfo->fmt_matx[col][COL_UTC_YMD_TIME]) ||
- (cinfo->fmt_matx[col][COL_UTC_YDOY_TIME]) ||
- (cinfo->fmt_matx[col][COL_REL_TIME]) ||
- (cinfo->fmt_matx[col][COL_DELTA_TIME]) ||
- (cinfo->fmt_matx[col][COL_DELTA_TIME_DIS]));
+ col_item_t* col_item = &cinfo->columns[col];
+ return ((col_item->fmt_matx[COL_CLS_TIME]) ||
+ (col_item->fmt_matx[COL_ABS_TIME]) ||
+ (col_item->fmt_matx[COL_ABS_YMD_TIME]) ||
+ (col_item->fmt_matx[COL_ABS_YDOY_TIME]) ||
+ (col_item->fmt_matx[COL_UTC_TIME]) ||
+ (col_item->fmt_matx[COL_UTC_YMD_TIME]) ||
+ (col_item->fmt_matx[COL_UTC_YDOY_TIME]) ||
+ (col_item->fmt_matx[COL_REL_TIME]) ||
+ (col_item->fmt_matx[COL_DELTA_TIME]) ||
+ (col_item->fmt_matx[COL_DELTA_TIME_DIS]));
}
static void
@@ -919,21 +928,21 @@ set_abs_ymd_time(const frame_data *fd, gchar *buf, gboolean local)
static void
col_set_abs_ymd_time(const frame_data *fd, column_info *cinfo, const int col)
{
- set_abs_ymd_time(fd, cinfo->col_buf[col], TRUE);
+ set_abs_ymd_time(fd, cinfo->columns[col].col_buf, TRUE);
cinfo->col_expr.col_expr[col] = "frame.time";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
col_set_utc_ymd_time(const frame_data *fd, column_info *cinfo, const int col)
{
- set_abs_ymd_time(fd, cinfo->col_buf[col], FALSE);
+ set_abs_ymd_time(fd, cinfo->columns[col].col_buf, FALSE);
cinfo->col_expr.col_expr[col] = "frame.time";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
@@ -1042,21 +1051,21 @@ set_abs_ydoy_time(const frame_data *fd, gchar *buf, gboolean local)
static void
col_set_abs_ydoy_time(const frame_data *fd, column_info *cinfo, const int col)
{
- set_abs_ydoy_time(fd, cinfo->col_buf[col], TRUE);
+ set_abs_ydoy_time(fd, cinfo->columns[col].col_buf, TRUE);
cinfo->col_expr.col_expr[col] = "frame.time";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
col_set_utc_ydoy_time(const frame_data *fd, column_info *cinfo, const int col)
{
- set_abs_ydoy_time(fd, cinfo->col_buf[col], FALSE);
+ set_abs_ydoy_time(fd, cinfo->columns[col].col_buf, FALSE);
cinfo->col_expr.col_expr[col] = "frame.time";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
@@ -1296,7 +1305,7 @@ col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col)
nstime_t del_rel_ts;
if (!fd->flags.has_ts) {
- cinfo->col_buf[col][0] = '\0';
+ cinfo->columns[col].col_buf[0] = '\0';
return;
}
@@ -1304,19 +1313,19 @@ col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col)
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(fd, &del_rel_ts, cinfo->col_buf[col]);
+ set_time_seconds(fd, &del_rel_ts, cinfo->columns[col].col_buf);
cinfo->col_expr.col_expr[col] = "frame.time_relative";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(fd, &del_rel_ts, cinfo->col_buf[col]);
+ set_time_hour_min_sec(fd, &del_rel_ts, cinfo->columns[col].col_buf);
cinfo->col_expr.col_expr[col] = "frame.time_relative";
set_time_seconds(fd, &del_rel_ts, cinfo->col_expr.col_expr_val[col]);
break;
default:
g_assert_not_reached();
}
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
@@ -1328,12 +1337,12 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(fd, &del_cap_ts, cinfo->col_buf[col]);
+ set_time_seconds(fd, &del_cap_ts, cinfo->columns[col].col_buf);
cinfo->col_expr.col_expr[col] = "frame.time_delta";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(fd, &del_cap_ts, cinfo->col_buf[col]);
+ set_time_hour_min_sec(fd, &del_cap_ts, cinfo->columns[col].col_buf);
cinfo->col_expr.col_expr[col] = "frame.time_delta";
set_time_seconds(fd, &del_cap_ts, cinfo->col_expr.col_expr_val[col]);
break;
@@ -1341,7 +1350,7 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
g_assert_not_reached();
}
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
@@ -1350,7 +1359,7 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
nstime_t del_dis_ts;
if (!fd->flags.has_ts) {
- cinfo->col_buf[col][0] = '\0';
+ cinfo->columns[col].col_buf[0] = '\0';
return;
}
@@ -1358,12 +1367,12 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(fd, &del_dis_ts, cinfo->col_buf[col]);
+ set_time_seconds(fd, &del_dis_ts, cinfo->columns[col].col_buf);
cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(fd, &del_dis_ts, cinfo->col_buf[col]);
+ set_time_hour_min_sec(fd, &del_dis_ts, cinfo->columns[col].col_buf);
cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
set_time_seconds(fd, &del_dis_ts, cinfo->col_expr.col_expr_val[col]);
break;
@@ -1371,7 +1380,7 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
g_assert_not_reached();
}
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
@@ -1469,21 +1478,21 @@ set_abs_time(const frame_data *fd, gchar *buf, gboolean local)
static void
col_set_abs_time(const frame_data *fd, column_info *cinfo, const int col)
{
- set_abs_time(fd, cinfo->col_buf[col], TRUE);
+ set_abs_time(fd, cinfo->columns[col].col_buf, TRUE);
cinfo->col_expr.col_expr[col] = "frame.time";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static void
col_set_utc_time(const frame_data *fd, column_info *cinfo, const int col)
{
- set_abs_time(fd, cinfo->col_buf[col], FALSE);
+ set_abs_time(fd, cinfo->columns[col].col_buf, FALSE);
cinfo->col_expr.col_expr[col] = "frame.time";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
static gboolean
@@ -1554,11 +1563,11 @@ set_epoch_time(const frame_data *fd, gchar *buf)
static void
col_set_epoch_time(const frame_data *fd, column_info *cinfo, const int col)
{
- if (set_epoch_time(fd, cinfo->col_buf[col])) {
+ if (set_epoch_time(fd, cinfo->columns[col].col_buf)) {
cinfo->col_expr.col_expr[col] = "frame.time_delta";
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->columns[col].col_buf,COL_MAX_LEN);
}
- cinfo->col_data[col] = cinfo->col_buf[col];
+ cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
void
@@ -1719,7 +1728,7 @@ col_set_cls_time(const frame_data *fd, column_info *cinfo, const gint col)
static void
col_set_fmt_time(const frame_data *fd, column_info *cinfo, const gint fmt, const gint col)
{
- COL_CHECK_REF_TIME(fd, cinfo->col_buf[col]);
+ COL_CHECK_REF_TIME(fd, cinfo->columns[col].col_buf);
switch (fmt) {
case COL_CLS_TIME:
@@ -1784,6 +1793,7 @@ void
col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, const char *fieldname)
{
int col;
+ col_item_t* col_item;
if (!CHECK_COL(cinfo, el))
return;
@@ -1793,39 +1803,40 @@ col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, const char *
*/
for (col = cinfo->col_first[el]; col <= cinfo->col_last[el]; col++) {
- if (cinfo->fmt_matx[col][el]) {
+ col_item = &cinfo->columns[col];
+ if (col_item->fmt_matx[el]) {
switch (timestamp_get_precision()) {
case TS_PREC_FIXED_SEC:
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ display_signed_time(col_item->col_buf, COL_MAX_LEN,
(gint32) ts->secs, ts->nsecs / 1000000000, TO_STR_TIME_RES_T_SECS);
break;
case TS_PREC_FIXED_DSEC:
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ display_signed_time(col_item->col_buf, COL_MAX_LEN,
(gint32) ts->secs, ts->nsecs / 100000000, TO_STR_TIME_RES_T_DSECS);
break;
case TS_PREC_FIXED_CSEC:
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ display_signed_time(col_item->col_buf, COL_MAX_LEN,
(gint32) ts->secs, ts->nsecs / 10000000, TO_STR_TIME_RES_T_CSECS);
break;
case TS_PREC_FIXED_MSEC:
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ display_signed_time(col_item->col_buf, COL_MAX_LEN,
(gint32) ts->secs, ts->nsecs / 1000000, TO_STR_TIME_RES_T_MSECS);
break;
case TS_PREC_FIXED_USEC:
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ display_signed_time(col_item->col_buf, COL_MAX_LEN,
(gint32) ts->secs, ts->nsecs / 1000, TO_STR_TIME_RES_T_USECS);
break;
case TS_PREC_FIXED_NSEC:
case TS_PREC_AUTO: /* default to maximum */
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ display_signed_time(col_item->col_buf, COL_MAX_LEN,
(gint32) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS);
break;
default:
g_assert_not_reached();
}
- cinfo->col_data[col] = cinfo->col_buf[col];
+ col_item->col_data = col_item->col_buf;
cinfo->col_expr.col_expr[col] = fieldname;
- g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col],col_item->col_buf,COL_MAX_LEN);
}
}
}
@@ -1835,6 +1846,7 @@ col_set_addr(packet_info *pinfo, const int col, const address *addr, const gbool
const gboolean fill_col_exprs, const gboolean res)
{
const char *name;
+ col_item_t* col_item = &pinfo->cinfo->columns[col];
if (addr->type == AT_NONE) {
/* No address, nothing to do */
@@ -1842,10 +1854,10 @@ col_set_addr(packet_info *pinfo, const int col, const address *addr, const gbool
}
if (res && (name = get_addr_name(addr)) != NULL)
- pinfo->cinfo->col_data[col] = name;
+ col_item->col_data = name;
else {
- pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
- address_to_str_buf(addr, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
+ col_item->col_data = col_item->col_buf;
+ address_to_str_buf(addr, col_item->col_buf, COL_MAX_LEN);
}
if (!fill_col_exprs)
@@ -1862,6 +1874,7 @@ static void
col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gboolean is_src, const gboolean fill_col_exprs _U_)
{
guint32 port;
+ col_item_t* col_item = &pinfo->cinfo->columns[col];
if (is_src)
port = pinfo->srcport;
@@ -1873,17 +1886,17 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
switch (pinfo->ptype) {
case PT_SCTP:
if (is_res)
- g_strlcpy(pinfo->cinfo->col_buf[col], sctp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
+ g_strlcpy(col_item->col_buf, sctp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
else
- guint32_to_str_buf(port, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
+ guint32_to_str_buf(port, col_item->col_buf, COL_MAX_LEN);
break;
case PT_TCP:
guint32_to_str_buf(port, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_res)
- g_strlcpy(pinfo->cinfo->col_buf[col], tcp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
+ g_strlcpy(col_item->col_buf, tcp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
else
- g_strlcpy(pinfo->cinfo->col_buf[col], pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
+ g_strlcpy(col_item->col_buf, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_src)
pinfo->cinfo->col_expr.col_expr[col] = "tcp.srcport";
else
@@ -1893,9 +1906,9 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
case PT_UDP:
guint32_to_str_buf(port, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_res)
- g_strlcpy(pinfo->cinfo->col_buf[col], udp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
+ g_strlcpy(col_item->col_buf, udp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
else
- g_strlcpy(pinfo->cinfo->col_buf[col], pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
+ g_strlcpy(col_item->col_buf, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_src)
pinfo->cinfo->col_expr.col_expr[col] = "udp.srcport";
else
@@ -1908,13 +1921,13 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
else
pinfo->cinfo->col_expr.col_expr[col] = "ddp.dst_socket";
guint32_to_str_buf(port, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
- g_strlcpy(pinfo->cinfo->col_buf[col], pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
+ g_strlcpy(col_item->col_buf, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
break;
case PT_IPX:
/* XXX - resolve IPX socket numbers */
- g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
- g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], pinfo->cinfo->col_buf[col],COL_MAX_LEN);
+ g_snprintf(col_item->col_buf, COL_MAX_LEN, "0x%04x", port);
+ g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], col_item->col_buf,COL_MAX_LEN);
if (is_src)
pinfo->cinfo->col_expr.col_expr[col] = "ipx.src.socket";
else
@@ -1923,8 +1936,8 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
case PT_IDP:
/* XXX - resolve IDP socket numbers */
- g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
- g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], pinfo->cinfo->col_buf[col],COL_MAX_LEN);
+ g_snprintf(col_item->col_buf, COL_MAX_LEN, "0x%04x", port);
+ g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], col_item->col_buf,COL_MAX_LEN);
if (is_src)
pinfo->cinfo->col_expr.col_expr[col] = "idp.src.socket";
else
@@ -1933,8 +1946,8 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
case PT_USB:
/* XXX - resolve USB endpoint numbers */
- g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%08x", port);
- g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], pinfo->cinfo->col_buf[col],COL_MAX_LEN);
+ g_snprintf(col_item->col_buf, COL_MAX_LEN, "0x%08x", port);
+ g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], col_item->col_buf,COL_MAX_LEN);
if (is_src)
pinfo->cinfo->col_expr.col_expr[col] = "usb.src.endpoint";
else
@@ -1944,7 +1957,7 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
default:
break;
}
- pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
+ col_item->col_data = col_item->col_buf;
}
gboolean
@@ -1953,7 +1966,7 @@ col_based_on_frame_data(column_info *cinfo, const gint col)
g_assert(cinfo);
g_assert(col < cinfo->num_cols);
- switch (cinfo->col_fmt[col]) {
+ switch (cinfo->columns[col].col_fmt) {
case COL_NUMBER:
case COL_CLS_TIME:
case COL_ABS_TIME:
@@ -1977,10 +1990,12 @@ col_based_on_frame_data(column_info *cinfo, const gint col)
void
col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col, const gboolean fill_col_exprs)
{
- switch (cinfo->col_fmt[col]) {
+ col_item_t* col_item = &cinfo->columns[col];
+
+ switch (col_item->col_fmt) {
case COL_NUMBER:
- guint32_to_str_buf(fd->num, cinfo->col_buf[col], COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ guint32_to_str_buf(fd->num, col_item->col_buf, COL_MAX_LEN);
+ col_item->col_data = col_item->col_buf;
break;
case COL_CLS_TIME:
@@ -1994,17 +2009,17 @@ col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col,
case COL_DELTA_TIME:
case COL_DELTA_TIME_DIS:
/* TODO: Pass on fill_col_exprs */
- col_set_fmt_time(fd, cinfo, cinfo->col_fmt[col], col);
+ col_set_fmt_time(fd, cinfo, col_item->col_fmt, col);
break;
case COL_PACKET_LENGTH:
- guint32_to_str_buf(fd->pkt_len, cinfo->col_buf[col], COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ guint32_to_str_buf(fd->pkt_len, col_item->col_buf, COL_MAX_LEN);
+ col_item->col_data = col_item->col_buf;
break;
case COL_CUMULATIVE_BYTES:
- guint32_to_str_buf(fd->cum_bytes, cinfo->col_buf[col], COL_MAX_LEN);
- cinfo->col_data[col] = cinfo->col_buf[col];
+ guint32_to_str_buf(fd->cum_bytes, col_item->col_buf, COL_MAX_LEN);
+ col_item->col_data = col_item->col_buf;
break;
default:
@@ -2014,10 +2029,10 @@ col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col,
if (!fill_col_exprs)
return;
- switch (cinfo->col_fmt[col]) {
+ switch (col_item->col_fmt) {
case COL_NUMBER:
cinfo->col_expr.col_expr[col] = "frame.number";
- g_strlcpy(cinfo->col_expr.col_expr_val[col], cinfo->col_buf[col], COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col], col_item->col_buf, COL_MAX_LEN);
break;
case COL_CLS_TIME:
@@ -2035,7 +2050,7 @@ col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col,
case COL_PACKET_LENGTH:
cinfo->col_expr.col_expr[col] = "frame.len";
- g_strlcpy(cinfo->col_expr.col_expr_val[col], cinfo->col_buf[col], COL_MAX_LEN);
+ g_strlcpy(cinfo->col_expr.col_expr_val[col], col_item->col_buf, COL_MAX_LEN);
break;
case COL_CUMULATIVE_BYTES:
@@ -2050,16 +2065,18 @@ void
col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
{
int i;
+ col_item_t* col_item;
if (!pinfo->cinfo)
return;
for (i = 0; i < pinfo->cinfo->num_cols; i++) {
+ col_item = &pinfo->cinfo->columns[i];
if (col_based_on_frame_data(pinfo->cinfo, i)) {
if (fill_fd_colums)
col_fill_in_frame_data(pinfo->fd, pinfo->cinfo, i, fill_col_exprs);
} else {
- switch (pinfo->cinfo->col_fmt[i]) {
+ switch (col_item->col_fmt) {
case COL_DEF_SRC:
case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
col_set_addr(pinfo, i, &pinfo->src, TRUE, fill_col_exprs, TRUE);
@@ -2136,7 +2153,7 @@ col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fi
g_assert_not_reached();
break;
default:
- if (pinfo->cinfo->col_fmt[i] >= NUM_COL_FMTS) {
+ if (col_item->col_fmt >= NUM_COL_FMTS) {
g_assert_not_reached();
}
/*
@@ -2158,26 +2175,28 @@ void
col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
{
int i;
+ col_item_t* col_item;
if (!cinfo)
return;
for (i = 0; i < cinfo->num_cols; i++) {
+ col_item = &cinfo->columns[i];
if (col_based_on_frame_data(cinfo, i)) {
if (fill_fd_colums)
col_fill_in_frame_data(fdata, cinfo, i, fill_col_exprs);
- } else if (cinfo->col_fmt[i] == COL_INFO) {
+ } else if (col_item->col_fmt == COL_INFO) {
/* XXX - say more than this */
- cinfo->col_data[i] = "Read error";
+ col_item->col_data = "Read error";
} else {
- if (cinfo->col_fmt[i] >= NUM_COL_FMTS) {
+ if (col_item->col_fmt >= NUM_COL_FMTS) {
g_assert_not_reached();
}
/*
* No dissection was done, and these columns are set as the
* result of the dissection, so....
*/
- cinfo->col_data[i] = "???";
+ col_item->col_data = "???";
break;
}
}
diff --git a/epan/column.c b/epan/column.c
index 503a2c120f..5555d3e0c8 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -788,41 +788,43 @@ void
build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
{
int i;
+ col_item_t* col_item;
/* Build the column format array */
col_setup(cinfo, num_cols);
for (i = 0; i < cinfo->num_cols; i++) {
- cinfo->col_fmt[i] = get_column_format(i);
- cinfo->col_title[i] = g_strdup(get_column_title(i));
-
- if (cinfo->col_fmt[i] == COL_CUSTOM) {
- cinfo->col_custom_field[i] = g_strdup(get_column_custom_field(i));
- cinfo->col_custom_occurrence[i] = get_column_custom_occurrence(i);
- if(!dfilter_compile(cinfo->col_custom_field[i], &cinfo->col_custom_dfilter[i], NULL)) {
+ col_item = &cinfo->columns[i];
+ col_item->col_fmt = get_column_format(i);
+ col_item->col_title = g_strdup(get_column_title(i));
+
+ if (col_item->col_fmt == COL_CUSTOM) {
+ col_item->col_custom_field = g_strdup(get_column_custom_field(i));
+ col_item->col_custom_occurrence = get_column_custom_occurrence(i);
+ if(!dfilter_compile(col_item->col_custom_field, &col_item->col_custom_dfilter, NULL)) {
/* XXX: Should we issue a warning? */
- g_free(cinfo->col_custom_field[i]);
- cinfo->col_custom_field[i] = NULL;
- cinfo->col_custom_occurrence[i] = 0;
- cinfo->col_custom_dfilter[i] = NULL;
+ g_free(col_item->col_custom_field);
+ col_item->col_custom_field = NULL;
+ col_item->col_custom_occurrence = 0;
+ col_item->col_custom_dfilter = NULL;
}
} else {
- cinfo->col_custom_field[i] = NULL;
- cinfo->col_custom_occurrence[i] = 0;
- cinfo->col_custom_dfilter[i] = NULL;
+ col_item->col_custom_field = NULL;
+ col_item->col_custom_occurrence = 0;
+ col_item->col_custom_dfilter = NULL;
}
- cinfo->fmt_matx[i] = (gboolean *) g_malloc0(sizeof(gboolean) * NUM_COL_FMTS);
- get_column_format_matches(cinfo->fmt_matx[i], cinfo->col_fmt[i]);
- cinfo->col_data[i] = NULL;
+ col_item->fmt_matx = (gboolean *) g_malloc0(sizeof(gboolean) * NUM_COL_FMTS);
+ get_column_format_matches(col_item->fmt_matx, col_item->col_fmt);
+ col_item->col_data = NULL;
- if (cinfo->col_fmt[i] == COL_INFO)
- cinfo->col_buf[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_INFO_LEN);
+ if (col_item->col_fmt == COL_INFO)
+ col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_INFO_LEN);
else
- cinfo->col_buf[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
+ col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
if(reset_fences)
- cinfo->col_fence[i] = 0;
+ col_item->col_fence = 0;
cinfo->col_expr.col_expr[i] = "";
cinfo->col_expr.col_expr_val[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
@@ -835,7 +837,7 @@ build_column_format_array(column_info *cinfo, const gint num_cols, const gboolea
int j;
for (j = 0; j < NUM_COL_FMTS; j++) {
- if (!cinfo->fmt_matx[i][j])
+ if (!cinfo->columns[i].fmt_matx[j])
continue;
if (cinfo->col_first[j] == -1)
diff --git a/epan/print.c b/epan/print.c
index e99ac08092..4ab69c8a36 100644
--- a/epan/print.c
+++ b/epan/print.c
@@ -614,7 +614,7 @@ write_psml_preamble(column_info *cinfo, FILE *fh)
for (i = 0; i < cinfo->num_cols; i++) {
fprintf(fh, "<section>");
- print_escaped_xml(fh, cinfo->col_title[i]);
+ print_escaped_xml(fh, cinfo->columns[i].col_title);
fprintf(fh, "</section>\n");
}
@@ -630,7 +630,7 @@ write_psml_columns(epan_dissect_t *edt, FILE *fh)
for (i = 0; i < edt->pi.cinfo->num_cols; i++) {
fprintf(fh, "<section>");
- print_escaped_xml(fh, edt->pi.cinfo->col_data[i]);
+ print_escaped_xml(fh, edt->pi.cinfo->columns[i].col_data);
fprintf(fh, "</section>\n");
}
@@ -681,8 +681,8 @@ write_csv_column_titles(column_info *cinfo, FILE *fh)
gint i;
for (i = 0; i < cinfo->num_cols - 1; i++)
- csv_write_str(cinfo->col_title[i], ',', fh);
- csv_write_str(cinfo->col_title[i], '\n', fh);
+ csv_write_str(cinfo->columns[i].col_title, ',', fh);
+ csv_write_str(cinfo->columns[i].col_title, '\n', fh);
}
void
@@ -691,8 +691,8 @@ write_csv_columns(epan_dissect_t *edt, FILE *fh)
gint i;
for (i = 0; i < edt->pi.cinfo->num_cols - 1; i++)
- csv_write_str(edt->pi.cinfo->col_data[i], ',', fh);
- csv_write_str(edt->pi.cinfo->col_data[i], '\n', fh);
+ csv_write_str(edt->pi.cinfo->columns[i].col_data, ',', fh);
+ csv_write_str(edt->pi.cinfo->columns[i].col_data, '\n', fh);
}
void
@@ -1360,12 +1360,12 @@ void write_fields_proto_tree(output_fields_t *fields, epan_dissect_t *edt, colum
if (fields->includes_col_fields) {
for (col = 0; col < cinfo->num_cols; col++) {
/* Prepend COLUMN_FIELD_FILTER as the field name */
- col_name = g_strdup_printf("%s%s", COLUMN_FIELD_FILTER, cinfo->col_title[col]);
+ col_name = g_strdup_printf("%s%s", COLUMN_FIELD_FILTER, cinfo->columns[col].col_title);
field_index = g_hash_table_lookup(fields->field_indicies, col_name);
g_free(col_name);
if (NULL != field_index) {
- format_field_values(fields, field_index, g_strdup(cinfo->col_data[col]));
+ format_field_values(fields, field_index, g_strdup(cinfo->columns[col].col_data));
}
}
}
diff --git a/file.c b/file.c
index c13f4c6265..ba60ccbed9 100644
--- a/file.c
+++ b/file.c
@@ -2430,6 +2430,7 @@ print_packet(capture_file *cf, frame_data *fdata,
int cp_off;
char bookmark_name[9+10+1]; /* "__frameNNNNNNNNNN__\0" */
char bookmark_title[6+10+1]; /* "Frame NNNNNNNNNN__\0" */
+ col_item_t* col_item;
/* Fill in the column information if we're printing the summary
information. */
@@ -2467,8 +2468,9 @@ print_packet(capture_file *cf, frame_data *fdata,
cp = &args->line_buf[0];
line_len = 0;
for (i = 0; i < args->num_visible_cols; i++) {
+ col_item = &cf->cinfo.columns[args->visible_cols[i]];
/* Find the length of the string for this column. */
- column_len = (int) strlen(cf->cinfo.col_data[args->visible_cols[i]]);
+ column_len = (int) strlen(col_item->col_data);
if (args->col_widths[i] > column_len)
column_len = args->col_widths[i];
@@ -2483,10 +2485,10 @@ print_packet(capture_file *cf, frame_data *fdata,
}
/* Right-justify the packet number column. */
- if (cf->cinfo.col_fmt[args->visible_cols[i]] == COL_NUMBER)
- g_snprintf(cp, column_len+1, "%*s", args->col_widths[i], cf->cinfo.col_data[args->visible_cols[i]]);
+ if (col_item->col_fmt == COL_NUMBER)
+ g_snprintf(cp, column_len+1, "%*s", args->col_widths[i], col_item->col_data);
else
- g_snprintf(cp, column_len+1, "%-*s", args->col_widths[i], cf->cinfo.col_data[args->visible_cols[i]]);
+ g_snprintf(cp, column_len+1, "%-*s", args->col_widths[i], col_item->col_data);
cp += column_len;
if (i != args->num_visible_cols - 1)
*cp++ = ' ';
@@ -2638,14 +2640,14 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
if (i == last_visible_col)
callback_args.col_widths[visible_col_count] = 0;
else {
- callback_args.col_widths[visible_col_count] = (gint) strlen(cf->cinfo.col_title[i]);
+ callback_args.col_widths[visible_col_count] = (gint) strlen(cf->cinfo.columns[i].col_title);
data_width = get_column_char_width(get_column_format(i));
if (data_width > callback_args.col_widths[visible_col_count])
callback_args.col_widths[visible_col_count] = data_width;
}
/* Find the length of the string for this column. */
- column_len = (int) strlen(cf->cinfo.col_title[i]);
+ column_len = (int) strlen(cf->cinfo.columns[i].col_title);
if (callback_args.col_widths[i] > column_len)
column_len = callback_args.col_widths[visible_col_count];
@@ -2662,9 +2664,9 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
/* Right-justify the packet number column. */
/* if (cf->cinfo.col_fmt[i] == COL_NUMBER)
- g_snprintf(cp, column_len+1, "%*s", callback_args.col_widths[visible_col_count], cf->cinfo.col_title[i]);
+ g_snprintf(cp, column_len+1, "%*s", callback_args.col_widths[visible_col_count], cf->cinfo.columns[i].col_title);
else*/
- g_snprintf(cp, column_len+1, "%-*s", callback_args.col_widths[visible_col_count], cf->cinfo.col_title[i]);
+ g_snprintf(cp, column_len+1, "%-*s", callback_args.col_widths[visible_col_count], cf->cinfo.columns[i].col_title);
cp += column_len;
if (i != cf->cinfo.num_cols - 1)
*cp++ = ' ';
@@ -3178,9 +3180,9 @@ match_summary_line(capture_file *cf, frame_data *fdata, void *criterion)
/* Find the Info column */
for (colx = 0; colx < cf->cinfo.num_cols; colx++) {
- if (cf->cinfo.fmt_matx[colx][COL_INFO]) {
+ if (cf->cinfo.columns[colx].fmt_matx[COL_INFO]) {
/* Found it. See if we match. */
- info_column = edt.pi.cinfo->col_data[colx];
+ info_column = edt.pi.cinfo->columns[colx].col_data;
info_column_len = strlen(info_column);
for (i = 0; i < info_column_len; i++) {
c_char = info_column[i];
diff --git a/tfshark.c b/tfshark.c
index f3d892a31b..05f1603e2a 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -2254,21 +2254,23 @@ print_columns(capture_file *cf)
size_t buf_offset;
size_t column_len;
size_t col_len;
+ col_item_t* col_item;
line_bufp = get_line_buf(256);
buf_offset = 0;
*line_bufp = '\0';
for (i = 0; i < cf->cinfo.num_cols; i++) {
+ col_item = &cf->cinfo.columns[i];
/* Skip columns not marked as visible. */
if (!get_column_visible(i))
continue;
- switch (cf->cinfo.col_fmt[i]) {
+ switch (col_item->col_fmt) {
case COL_NUMBER:
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 3)
column_len = 3;
line_bufp = get_line_buf(buf_offset + column_len);
- put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
case COL_CLS_TIME:
@@ -2279,11 +2281,11 @@ print_columns(capture_file *cf)
case COL_UTC_TIME:
case COL_UTC_YMD_TIME: /* XXX - wider */
case COL_UTC_YDOY_TIME: /* XXX - wider */
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 10)
column_len = 10;
line_bufp = get_line_buf(buf_offset + column_len);
- put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
case COL_DEF_SRC:
@@ -2295,11 +2297,11 @@ print_columns(capture_file *cf)
case COL_DEF_NET_SRC:
case COL_RES_NET_SRC:
case COL_UNRES_NET_SRC:
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 12)
column_len = 12;
line_bufp = get_line_buf(buf_offset + column_len);
- put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
case COL_DEF_DST:
@@ -2311,17 +2313,17 @@ print_columns(capture_file *cf)
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
case COL_UNRES_NET_DST:
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 12)
column_len = 12;
line_bufp = get_line_buf(buf_offset + column_len);
- put_string_spaces(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_string_spaces(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
default:
- column_len = strlen(cf->cinfo.col_data[i]);
+ column_len = strlen(col_item->col_data);
line_bufp = get_line_buf(buf_offset + column_len);
- put_string(line_bufp + buf_offset, cf->cinfo.col_data[i], column_len);
+ put_string(line_bufp + buf_offset, col_item->col_data, column_len);
break;
}
buf_offset += column_len;
@@ -2341,12 +2343,12 @@ print_columns(capture_file *cf)
* even if we're only adding " ".
*/
line_bufp = get_line_buf(buf_offset + 4);
- switch (cf->cinfo.col_fmt[i]) {
+ switch (col_item->col_fmt) {
case COL_DEF_SRC:
case COL_RES_SRC:
case COL_UNRES_SRC:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_DST:
case COL_RES_DST:
@@ -2365,7 +2367,7 @@ print_columns(capture_file *cf)
case COL_DEF_DL_SRC:
case COL_RES_DL_SRC:
case COL_UNRES_DL_SRC:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_DL_DST:
case COL_RES_DL_DST:
@@ -2384,7 +2386,7 @@ print_columns(capture_file *cf)
case COL_DEF_NET_SRC:
case COL_RES_NET_SRC:
case COL_UNRES_NET_SRC:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
@@ -2403,7 +2405,7 @@ print_columns(capture_file *cf)
case COL_DEF_DST:
case COL_RES_DST:
case COL_UNRES_DST:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_SRC:
case COL_RES_SRC:
@@ -2422,7 +2424,7 @@ print_columns(capture_file *cf)
case COL_DEF_DL_DST:
case COL_RES_DL_DST:
case COL_UNRES_DL_DST:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_DL_SRC:
case COL_RES_DL_SRC:
@@ -2441,7 +2443,7 @@ print_columns(capture_file *cf)
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
case COL_UNRES_NET_DST:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_NET_SRC:
case COL_RES_NET_SRC:
diff --git a/tshark.c b/tshark.c
index 10394d1eb3..771c49b6c1 100644
--- a/tshark.c
+++ b/tshark.c
@@ -3748,21 +3748,23 @@ print_columns(capture_file *cf)
size_t buf_offset;
size_t column_len;
size_t col_len;
+ col_item_t* col_item;
line_bufp = get_line_buf(256);
buf_offset = 0;
*line_bufp = '\0';
for (i = 0; i < cf->cinfo.num_cols; i++) {
+ col_item = &cf->cinfo.columns[i];
/* Skip columns not marked as visible. */
if (!get_column_visible(i))
continue;
- switch (cf->cinfo.col_fmt[i]) {
+ switch (col_item->col_fmt) {
case COL_NUMBER:
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 3)
column_len = 3;
line_bufp = get_line_buf(buf_offset + column_len);
- put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
case COL_CLS_TIME:
@@ -3773,11 +3775,11 @@ print_columns(capture_file *cf)
case COL_UTC_TIME:
case COL_UTC_YMD_TIME: /* XXX - wider */
case COL_UTC_YDOY_TIME: /* XXX - wider */
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 10)
column_len = 10;
line_bufp = get_line_buf(buf_offset + column_len);
- put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
case COL_DEF_SRC:
@@ -3789,11 +3791,11 @@ print_columns(capture_file *cf)
case COL_DEF_NET_SRC:
case COL_RES_NET_SRC:
case COL_UNRES_NET_SRC:
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 12)
column_len = 12;
line_bufp = get_line_buf(buf_offset + column_len);
- put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
case COL_DEF_DST:
@@ -3805,17 +3807,17 @@ print_columns(capture_file *cf)
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
case COL_UNRES_NET_DST:
- column_len = col_len = strlen(cf->cinfo.col_data[i]);
+ column_len = col_len = strlen(col_item->col_data);
if (column_len < 12)
column_len = 12;
line_bufp = get_line_buf(buf_offset + column_len);
- put_string_spaces(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
+ put_string_spaces(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
break;
default:
- column_len = strlen(cf->cinfo.col_data[i]);
+ column_len = strlen(col_item->col_data);
line_bufp = get_line_buf(buf_offset + column_len);
- put_string(line_bufp + buf_offset, cf->cinfo.col_data[i], column_len);
+ put_string(line_bufp + buf_offset, col_item->col_data, column_len);
break;
}
buf_offset += column_len;
@@ -3835,12 +3837,12 @@ print_columns(capture_file *cf)
* even if we're only adding " ".
*/
line_bufp = get_line_buf(buf_offset + 4);
- switch (cf->cinfo.col_fmt[i]) {
+ switch (col_item->col_fmt) {
case COL_DEF_SRC:
case COL_RES_SRC:
case COL_UNRES_SRC:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_DST:
case COL_RES_DST:
@@ -3859,7 +3861,7 @@ print_columns(capture_file *cf)
case COL_DEF_DL_SRC:
case COL_RES_DL_SRC:
case COL_UNRES_DL_SRC:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_DL_DST:
case COL_RES_DL_DST:
@@ -3878,7 +3880,7 @@ print_columns(capture_file *cf)
case COL_DEF_NET_SRC:
case COL_RES_NET_SRC:
case COL_UNRES_NET_SRC:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
@@ -3897,7 +3899,7 @@ print_columns(capture_file *cf)
case COL_DEF_DST:
case COL_RES_DST:
case COL_UNRES_DST:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_SRC:
case COL_RES_SRC:
@@ -3916,7 +3918,7 @@ print_columns(capture_file *cf)
case COL_DEF_DL_DST:
case COL_RES_DL_DST:
case COL_UNRES_DL_DST:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_DL_SRC:
case COL_RES_DL_SRC:
@@ -3935,7 +3937,7 @@ print_columns(capture_file *cf)
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
case COL_UNRES_NET_DST:
- switch (cf->cinfo.col_fmt[i + 1]) {
+ switch (cf->cinfo.columns[i+1].col_fmt) {
case COL_DEF_NET_SRC:
case COL_RES_NET_SRC:
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index f62e937f23..4244b9a5a7 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -531,10 +531,10 @@ selected_ptree_ref_cb(GtkWidget *widget _U_, gpointer data _U_)
static gboolean
is_address_column (gint column)
{
- if (((cfile.cinfo.col_fmt[column] == COL_DEF_SRC) ||
- (cfile.cinfo.col_fmt[column] == COL_RES_SRC) ||
- (cfile.cinfo.col_fmt[column] == COL_DEF_DST) ||
- (cfile.cinfo.col_fmt[column] == COL_RES_DST)) &&
+ if (((cfile.cinfo.columns[column].col_fmt == COL_DEF_SRC) ||
+ (cfile.cinfo.columns[column].col_fmt == COL_RES_SRC) ||
+ (cfile.cinfo.columns[column].col_fmt == COL_DEF_DST) ||
+ (cfile.cinfo.columns[column].col_fmt == COL_RES_DST)) &&
strlen(cfile.cinfo.col_expr.col_expr_val[column]))
{
return TRUE;
@@ -609,7 +609,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
fdata, &cfile.cinfo);
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
- if ((cfile.cinfo.col_custom_occurrence[column]) ||
+ if ((cfile.cinfo.columns[column].col_custom_occurrence) ||
(strchr (cfile.cinfo.col_expr.col_expr_val[column], ',') == NULL))
{
/* Only construct the filter when a single occurrence is displayed
@@ -622,8 +622,8 @@ get_filter_from_packet_list_row_and_column(gpointer data)
if (strlen(cfile.cinfo.col_expr.col_expr[column]) != 0 &&
strlen(cfile.cinfo.col_expr.col_expr_val[column]) != 0) {
/* leak a little; is there a safe wmem_ scope here? */
- if (cfile.cinfo.col_fmt[column] == COL_CUSTOM) {
- header_field_info *hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[column]);
+ if (cfile.cinfo.columns[column].col_fmt == COL_CUSTOM) {
+ header_field_info *hfi = proto_registrar_get_byname(cfile.cinfo.columns[column].col_custom_field);
if (hfi && hfi->parent == -1) {
/* Protocol only */
buf = g_strdup(cfile.cinfo.col_expr.col_expr[column]);
diff --git a/ui/gtk/packet_list.c b/ui/gtk/packet_list.c
index 06e8364c75..477a782c81 100644
--- a/ui/gtk/packet_list.c
+++ b/ui/gtk/packet_list.c
@@ -662,6 +662,7 @@ create_view_and_model(void)
header_field_info *hfi;
gint col_min_width;
gchar *escaped_title;
+ col_item_t* col_item;
packetlist = packet_list_new();
@@ -691,6 +692,7 @@ create_view_and_model(void)
/* We need one extra column to store the entire PacketListRecord */
for(i = 0; i < cfile.cinfo.num_cols; i++) {
+ col_item = &cfile.cinfo.columns[i];
renderer = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
@@ -706,14 +708,14 @@ create_view_and_model(void)
show_cell_data_func,
GINT_TO_POINTER(i),
NULL);
- if (cfile.cinfo.col_fmt[i] == COL_CUSTOM) {
- hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[i]);
+ if (col_item->col_fmt == COL_CUSTOM) {
+ hfi = proto_registrar_get_byname(col_item->col_custom_field);
/* Check if this is a valid custom_field */
if (hfi != NULL) {
if (hfi->parent != -1) {
/* Prefix with protocol name */
- if (cfile.cinfo.col_custom_occurrence[i] != 0) {
- tooltip_text = g_strdup_printf("%s\n%s (%s#%d)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev, cfile.cinfo.col_custom_occurrence[i]);
+ if (col_item->col_custom_occurrence != 0) {
+ tooltip_text = g_strdup_printf("%s\n%s (%s#%d)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev, col_item->col_custom_occurrence);
} else {
tooltip_text = g_strdup_printf("%s\n%s (%s)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev);
}
@@ -724,9 +726,9 @@ create_view_and_model(void)
tooltip_text = g_strdup_printf("Unknown Field: %s", get_column_custom_field(i));
}
} else {
- tooltip_text = g_strdup(col_format_desc(cfile.cinfo.col_fmt[i]));
+ tooltip_text = g_strdup(col_format_desc(col_item->col_fmt));
}
- escaped_title = ws_strdup_escape_char(cfile.cinfo.col_title[i], '_');
+ escaped_title = ws_strdup_escape_char(col_item->col_title, '_');
gtk_tree_view_column_set_title(col, escaped_title);
g_free (escaped_title);
gtk_tree_view_column_set_clickable(col, TRUE);
@@ -743,7 +745,7 @@ create_view_and_model(void)
* XXX The minimum size will be the size of the title
* should that be limited for long titles?
*/
- col_min_width = get_default_col_size (packetlist->view, cfile.cinfo.col_title[i]);
+ col_min_width = get_default_col_size (packetlist->view, cfile.cinfo.columns[i].col_title);
if(col_min_width<COLUMN_WIDTH_MIN){
gtk_tree_view_column_set_min_width(col, COLUMN_WIDTH_MIN);
}else{
diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c
index dbb511ae43..842497b14d 100644
--- a/ui/gtk/packet_list_store.c
+++ b/ui/gtk/packet_list_store.c
@@ -398,7 +398,7 @@ packet_list_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column,
text_column = packet_list->col_to_text[column];
if (text_column == -1) { /* column based on frame_data */
col_fill_in_frame_data(record->fdata, &cfile.cinfo, column, FALSE);
- g_value_set_string(value, cfile.cinfo.col_data[column]);
+ g_value_set_string(value, cfile.cinfo.columns[column].col_data);
} else {
g_return_if_fail(record->col_text);
g_value_set_string(value, record->col_text[text_column]);
@@ -652,6 +652,7 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
gchar *str;
size_t col_text_len;
int text_col;
+ col_item_t* col_item;
text_col = packet_list->col_to_text[col];
@@ -659,7 +660,8 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
if (text_col == -1 || record->col_text[text_col] != NULL)
return;
- switch (cfile.cinfo.col_fmt[col]) {
+ col_item = &cfile.cinfo.columns[col];
+ switch (col_item->col_fmt) {
case COL_DEF_SRC:
case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
case COL_UNRES_SRC:
@@ -685,13 +687,13 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
case COL_8021Q_VLAN_ID:
case COL_EXPERT:
case COL_FREQ_CHAN:
- if (cinfo->col_data[col] && cinfo->col_data[col] != cinfo->col_buf[col]) {
- col_text_len = strlen(cinfo->col_data[col]);
+ if (col_item->col_data && col_item->col_data != col_item->col_buf) {
+ col_text_len = strlen(col_item->col_data);
if (col_text_len > G_MAXUSHORT)
col_text_len = G_MAXUSHORT;
/* This is a constant string, so we don't have to copy it */
- record->col_text[text_col] = (gchar *) cinfo->col_data[col];
+ record->col_text[text_col] = (gchar *) col_item->col_data;
record->col_text_len[text_col] = (gushort) col_text_len;
#ifdef PACKET_LIST_STATISTICS
++packet_list->const_strings;
@@ -701,8 +703,8 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
/* !! FALL-THROUGH!! */
default:
- if(cinfo->col_data[col]){
- col_text_len = strlen(cinfo->col_data[col]);
+ if(col_item->col_data){
+ col_text_len = strlen(col_item->col_data);
if (col_text_len > G_MAXUSHORT)
col_text_len = G_MAXUSHORT;
@@ -722,7 +724,7 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
/* Use the unresolved value in col_expr_val */
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_expr.col_expr_val[col]);
} else {
- str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_data[col]);
+ str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)col_item->col_data);
}
record->col_text[text_col] = str;
break;
@@ -930,7 +932,7 @@ packet_list_compare_custom(gint sort_id, gint text_sort_id, PacketListRecord *a,
{
header_field_info *hfi;
- hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[sort_id]);
+ hfi = proto_registrar_get_byname(cfile.cinfo.columns[sort_id].col_custom_field);
if (hfi == NULL) {
return frame_data_compare(cfile.epan, a->fdata, b->fdata, COL_NUMBER);
@@ -968,7 +970,7 @@ _packet_list_compare_records(gint sort_id, gint text_sort_id, PacketListRecord *
if(a->col_text[text_sort_id] == b->col_text[text_sort_id])
return 0; /* no need to call strcmp() */
- if (cfile.cinfo.col_fmt[sort_id] == COL_CUSTOM)
+ if (cfile.cinfo.columns[sort_id].col_fmt == COL_CUSTOM)
return packet_list_compare_custom(sort_id, text_sort_id, a, b);
return strcmp(a->col_text[text_sort_id], b->col_text[text_sort_id]);
@@ -980,7 +982,7 @@ packet_list_compare_records(gint sort_id, gint text_sort_id, PacketListRecord *a
gint ret;
if (text_sort_id == -1) /* based on frame_data ? */
- return frame_data_compare(cfile.epan, a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]);
+ return frame_data_compare(cfile.epan, a->fdata, b->fdata, cfile.cinfo.columns[sort_id].col_fmt);
ret = _packet_list_compare_records(sort_id, text_sort_id, a, b);
if (ret == 0)
@@ -1216,7 +1218,7 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, vis_idx);
col_fill_in_frame_data(record->fdata, &cfile.cinfo, col, FALSE);
- column_len = (gint) strlen(cfile.cinfo.col_buf[col]);
+ column_len = (gint) strlen(cfile.cinfo.columns[col].col_buf);
if (column_len > widest_column_len) {
widest_column_len = column_len;
widest_packet = vis_idx;
@@ -1227,7 +1229,7 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, widest_packet);
col_fill_in_frame_data(record->fdata, &cfile.cinfo, col, FALSE);
- return cfile.cinfo.col_buf[col];
+ return cfile.cinfo.columns[col].col_buf;
} else
return "";
}
diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c
index fb28702dfc..ca5a5be6ed 100644
--- a/ui/gtk/packet_win.c
+++ b/ui/gtk/packet_win.c
@@ -172,7 +172,7 @@ create_packet_window_title(void)
* frame was dissected.
*/
for (i = 0; i < cfile.cinfo.num_cols; ++i) {
- g_string_append(title, cfile.cinfo.col_data[i]);
+ g_string_append(title, cfile.cinfo.columns[i].col_data);
g_string_append_c(title, ' ');
}
diff --git a/ui/packet_list_utils.c b/ui/packet_list_utils.c
index 0f8ab2b775..348fa9ccc5 100644
--- a/ui/packet_list_utils.c
+++ b/ui/packet_list_utils.c
@@ -37,7 +37,7 @@ right_justify_column (gint col, capture_file *cf)
if (!cf) return FALSE;
- switch (cf->cinfo.col_fmt[col]) {
+ switch (cf->cinfo.columns[col].col_fmt) {
case COL_NUMBER:
case COL_PACKET_LENGTH:
@@ -54,7 +54,7 @@ right_justify_column (gint col, capture_file *cf)
break;
case COL_CUSTOM:
- hfi = proto_registrar_get_byname(cf->cinfo.col_custom_field[col]);
+ hfi = proto_registrar_get_byname(cf->cinfo.columns[col].col_custom_field);
/* Check if this is a valid field and we have no strings lookup table */
if ((hfi != NULL) && ((hfi->strings == NULL) || !get_column_resolved(col))) {
/* Check for bool, framenum and decimal/octal integer types */
@@ -81,10 +81,10 @@ resolve_column (gint col, capture_file *cf)
if (!cf) return FALSE;
- switch (cf->cinfo.col_fmt[col]) {
+ switch (cf->cinfo.columns[col].col_fmt) {
case COL_CUSTOM:
- hfi = proto_registrar_get_byname(cf->cinfo.col_custom_field[col]);
+ hfi = proto_registrar_get_byname(cf->cinfo.columns[col].col_custom_field);
/* Check if this is a valid field */
if (hfi != NULL) {
/* Check if we have an OID or a strings table with integer values */
diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp
index 09a1d939e9..89629dac41 100644
--- a/ui/qt/packet_dialog.cpp
+++ b/ui/qt/packet_dialog.cpp
@@ -97,7 +97,7 @@ PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, frame_data *fdata)
// ElidedLabel doesn't support rich text / HTML
col_parts << QString("%1: %2")
.arg(get_column_title(i))
- .arg(cap_file_.capFile()->cinfo.col_data[i]);
+ .arg(cap_file_.capFile()->cinfo.columns[i].col_data);
}
col_info_ = col_parts.join(" " UTF8_MIDDLE_DOT " ");
setHintText();
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index f01b84a158..de4ce5bdeb 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -856,7 +856,7 @@ QString &PacketList::getFilterFromRowAndColumn()
epan_dissect_run(&edt, cap_file_->cd_t, &cap_file_->phdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
- if ((cap_file_->cinfo.col_custom_occurrence[ctx_column_]) ||
+ if ((cap_file_->cinfo.columns[ctx_column_].col_custom_occurrence) ||
(strchr (cap_file_->cinfo.col_expr.col_expr_val[ctx_column_], ',') == NULL))
{
/* Only construct the filter when a single occurrence is displayed
@@ -868,8 +868,8 @@ QString &PacketList::getFilterFromRowAndColumn()
*/
if (strlen(cap_file_->cinfo.col_expr.col_expr[ctx_column_]) != 0 &&
strlen(cap_file_->cinfo.col_expr.col_expr_val[ctx_column_]) != 0) {
- if (cap_file_->cinfo.col_fmt[ctx_column_] == COL_CUSTOM) {
- header_field_info *hfi = proto_registrar_get_byname(cap_file_->cinfo.col_custom_field[ctx_column_]);
+ if (cap_file_->cinfo.columns[ctx_column_].col_fmt == COL_CUSTOM) {
+ header_field_info *hfi = proto_registrar_get_byname(cap_file_->cinfo.columns[ctx_column_].col_custom_field);
if (hfi->parent == -1) {
/* Protocol only */
filter.append(cap_file_->cinfo.col_expr.col_expr[ctx_column_]);
diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp
index cad606e6f3..80563be940 100644
--- a/ui/qt/packet_list_model.cpp
+++ b/ui/qt/packet_list_model.cpp
@@ -181,15 +181,15 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER);
} else if (text_sort_column_ < 0) {
// Column comes directly from frame data
- cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), sort_cap_file_->cinfo.col_fmt[sort_column_]);
+ cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), sort_cap_file_->cinfo.columns[sort_column_].col_fmt);
} else {
if (r1->columnString(sort_cap_file_, sort_column_).toByteArray().data() == r2->columnString(sort_cap_file_, sort_column_).toByteArray().data()) {
cmp_val = 0;
- } else if (sort_cap_file_->cinfo.col_fmt[sort_column_] == COL_CUSTOM) {
+ } else if (sort_cap_file_->cinfo.columns[sort_column_].col_fmt == COL_CUSTOM) {
header_field_info *hfi;
// Column comes from custom data
- hfi = proto_registrar_get_byname(sort_cap_file_->cinfo.col_custom_field[sort_column_]);
+ hfi = proto_registrar_get_byname(sort_cap_file_->cinfo.columns[sort_column_].col_custom_field);
if (hfi == NULL) {
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER);
diff --git a/ui/qt/packet_list_record.cpp b/ui/qt/packet_list_record.cpp
index d1875f964e..9211f9b371 100644
--- a/ui/qt/packet_list_record.cpp
+++ b/ui/qt/packet_list_record.cpp
@@ -192,7 +192,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
/* Column based on frame_data or it already contains a value */
if (text_col < 0) {
col_fill_in_frame_data(fdata_, cinfo, column, FALSE);
- col_text_.append(cinfo->col_data[column]);
+ col_text_.append(cinfo->columns[column].col_data);
continue;
}
@@ -222,12 +222,12 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
case COL_8021Q_VLAN_ID:
case COL_EXPERT:
case COL_FREQ_CHAN:
- if (cinfo->col_data[column] && cinfo->col_data[column] != cinfo->col_buf[column]) {
+ if (cinfo->columns[column].col_data && cinfo->columns[column].col_data != cinfo->columns[column].col_buf) {
/* This is a constant string, so we don't have to copy it */
// XXX - ui/gtk/packet_list_store.c uses G_MAXUSHORT. We don't do proper UTF8
// truncation in either case.
int col_text_len = MIN(qstrlen(cinfo->col_data[column]) + 1, COL_MAX_INFO_LEN);
- col_text_.append(QByteArray::fromRawData(cinfo->col_data[column], col_text_len));
+ col_text_.append(QByteArray::fromRawData(cinfo->columns[column].col_data, col_text_len));
break;
}
/* !! FALL-THROUGH!! */
@@ -238,7 +238,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
// XXX Use QContiguousCache?
col_text_.append(cinfo->col_expr.col_expr_val[column]);
} else {
- col_text_.append(cinfo->col_data[column]);
+ col_text_.append(cinfo->columns[column].col_data);
}
break;
}
@@ -254,7 +254,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
if (text_col < 0) {
col_fill_in_frame_data(fdata_, cinfo, column, FALSE);
}
- col_text = cinfo->col_data[column];
+ col_text = cinfo->columns[column].col_data;
}
col_text_.append(col_text);
col_lines += col_text.count('\n');
diff --git a/ui/tap-sequence-analysis.c b/ui/tap-sequence-analysis.c
index eb35b9125c..72c3f7bad8 100644
--- a/ui/tap-sequence-analysis.c
+++ b/ui/tap-sequence-analysis.c
@@ -75,6 +75,7 @@ static gboolean
seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_, const void *dummy _U_)
{
seq_analysis_info_t *sainfo = (seq_analysis_info_t *) ptr;
+ col_item_t* col_item;
if ((sainfo->all_packets)||(pinfo->fd->flags.passed_dfilter==1)){
int i;
@@ -108,8 +109,9 @@ seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U
if (pinfo->cinfo->col_first[COL_INFO]>=0){
for (i = pinfo->cinfo->col_first[COL_INFO]; i <= pinfo->cinfo->col_last[COL_INFO]; i++) {
- if (pinfo->cinfo->fmt_matx[i][COL_INFO]) {
- colinfo = g_strdup(pinfo->cinfo->col_data[i]);
+ col_item = &pinfo->cinfo->columns[i];
+ if (col_item->fmt_matx[COL_INFO]) {
+ colinfo = g_strdup(col_item->col_data);
/* break; ? or g_free(colinfo); before g_strdup() */
}
}
@@ -118,8 +120,9 @@ seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U
if (pinfo->cinfo->col_first[COL_PROTOCOL]>=0){
for (i = pinfo->cinfo->col_first[COL_PROTOCOL]; i <= pinfo->cinfo->col_last[COL_PROTOCOL]; i++) {
- if (pinfo->cinfo->fmt_matx[i][COL_PROTOCOL]) {
- protocol = g_strdup(pinfo->cinfo->col_data[i]);
+ col_item = &pinfo->cinfo->columns[i];
+ if (col_item->fmt_matx[COL_PROTOCOL]) {
+ protocol = g_strdup(col_item->col_data);
/* break; ? or g_free(protocol); before g_strdup() */
}
}