Qt: Improve sorting of custom columns with multiple fields

Use the already parsed col_custom_fields_ids to loop all
fields in custom columns.

Change-Id: I937e10e087feadc788591f2e3d49568611fda69b
Reviewed-on: https://code.wireshark.org/review/25918
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Stig Bjørlykke 2018-02-20 10:05:48 +01:00 committed by Roland Knall
parent f7c8f0c8a5
commit 1044d56e3d
1 changed files with 4 additions and 11 deletions

View File

@ -365,16 +365,11 @@ bool PacketListModel::isNumericColumn(int column)
return false;
}
gchar **fields = g_regex_split_simple(COL_CUSTOM_PRIME_REGEX,
sort_cap_file_->cinfo.columns[column].col_custom_fields,
G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED);
guint num_fields = g_slist_length(sort_cap_file_->cinfo.columns[column].col_custom_fields_ids);
for (guint i = 0; i < num_fields; i++) {
guint *field_idx = (guint *) g_slist_nth_data(sort_cap_file_->cinfo.columns[column].col_custom_fields_ids, i);
header_field_info *hfi = proto_registrar_get_nth(*field_idx);
for (guint i = 0; i < g_strv_length(fields); i++) {
if (!*fields[i]) {
continue;
}
header_field_info *hfi = proto_registrar_get_byname(fields[i]);
/*
* Reject a field when there is no numeric field type or when:
* - there are (value_string) "strings"
@ -392,12 +387,10 @@ bool PacketListModel::isNumericColumn(int column)
(hfi->type == FT_DOUBLE) || (hfi->type == FT_FLOAT) ||
(hfi->type == FT_BOOLEAN) || (hfi->type == FT_FRAMENUM) ||
(hfi->type == FT_RELATIVE_TIME))) {
g_strfreev(fields);
return false;
}
}
g_strfreev(fields);
return true;
}