Restore disabled "decode as" settings.

svn path=/trunk/; revision=53635
This commit is contained in:
Gerald Combs 2013-11-29 03:14:24 +00:00
parent 9e0cd5d1d8
commit 5acdfae070
3 changed files with 11 additions and 4 deletions

View File

@ -162,6 +162,7 @@ read_set_decode_as_entries(gchar *key, const gchar *value,
guint i, j;
dissector_table_t sub_dissectors;
prefs_set_pref_e retval = PREFS_SET_OK;
gboolean is_valid = FALSE;
if (strcmp(key, DECODE_AS_ENTRY) == 0) {
/* Parse csv into table, selector, initial, current */
@ -183,7 +184,11 @@ read_set_decode_as_entries(gchar *key, const gchar *value,
lookup.handle = NULL;
g_slist_foreach(dissector_table_get_dissector_handles(sub_dissectors),
change_dissector_if_matched, &lookup);
if (lookup.handle != NULL) {
if (lookup.handle != NULL || g_ascii_strcasecmp(values[3], DECODE_AS_NONE) == 0) {
is_valid = TRUE;
}
if (is_valid) {
dissector_change_uint(values[0], atoi(values[1]), lookup.handle);
decode_build_reset_list(g_strdup(values[0]), dissector_table_get_type(sub_dissectors),
g_strdup(values[1]), NULL, NULL);

View File

@ -39,6 +39,8 @@ extern "C" {
#define MAX_DECODE_AS_PROMPT_LEN 200
#define DECODE_AS_ENTRY "decode_as_entry"
#define DECODE_AS_NONE "(none)"
/*
* Filename of the "decode as" entry preferences
*/

View File

@ -281,12 +281,12 @@ decode_build_show_list (const gchar *table_name, ftenum_t selector_type,
current = dtbl_entry_get_handle((dtbl_entry_t *)value);
if (current == NULL)
current_proto_name = "(none)";
current_proto_name = DECODE_AS_NONE;
else
current_proto_name = dissector_handle_get_short_name(current);
initial = dtbl_entry_get_initial_handle((dtbl_entry_t *)value);
if (initial == NULL)
initial_proto_name = "(none)";
initial_proto_name = DECODE_AS_NONE;
else
initial_proto_name = dissector_handle_get_short_name(initial);
@ -1185,7 +1185,7 @@ decode_list_menu_finish(GtkWidget *list)
GtkTreeIter iter;
text[E_LIST_S_PROTO_NAME] = "(default)";
text[E_LIST_S_TABLE] = "(none)";
text[E_LIST_S_TABLE] = DECODE_AS_NONE;
store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list)));
gtk_list_store_prepend(store, &iter);
gtk_list_store_set(store, &iter,