diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-04-12 15:26:34 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-04-12 22:27:22 +0000 |
commit | cb16dff992c3844936bf5829f19e5a5247458503 (patch) | |
tree | 901b7be3379f5b94f150de71d1c0f3e2fa2d12e4 /ui/gtk | |
parent | ef8a0a2ce172810d48371eb65c73b1bd4a6303ca (diff) |
Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically
fixed-length fields, where the string can be up to the length of the
field, and is null-padded if it's shorter than that), and use it. Use
IS_FT_STRING() in more cases, so that less code needs to know what types
are string types.
Add a tvb_get_stringzpad() routine, which gets null-padded strings.
Currently, it does the same thing that tvb_get_string_enc() does, but
that might change if we don't store string values as null-terminated
strings.
Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66
Reviewed-on: https://code.wireshark.org/review/1082
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/decode_as_dlg.c | 2 | ||||
-rw-r--r-- | ui/gtk/dissector_tables_dlg.c | 4 | ||||
-rw-r--r-- | ui/gtk/main.c | 2 | ||||
-rw-r--r-- | ui/gtk/packet_win.c | 2 |
4 files changed, 8 insertions, 2 deletions
diff --git a/ui/gtk/decode_as_dlg.c b/ui/gtk/decode_as_dlg.c index afae7b7ffc..ec2b2e5dec 100644 --- a/ui/gtk/decode_as_dlg.c +++ b/ui/gtk/decode_as_dlg.c @@ -336,6 +336,8 @@ decode_build_show_list (const gchar *table_name, ftenum_t selector_type, case FT_STRING: case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: selector_name = (gchar *)key; break; diff --git a/ui/gtk/dissector_tables_dlg.c b/ui/gtk/dissector_tables_dlg.c index 8964583a7c..501aee2920 100644 --- a/ui/gtk/dissector_tables_dlg.c +++ b/ui/gtk/dissector_tables_dlg.c @@ -145,6 +145,8 @@ decode_proto_add_to_list (const gchar *table_name _U_, ftenum_t selector_type, case FT_STRING: case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: str = (gchar*) key; proto_add_to_list(tree_info, store, str, proto_name); break; @@ -230,6 +232,8 @@ display_dissector_table_names(const char *table_name, const char *ui_name, gpoin break; case FT_STRING: case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: table_name_add_to_list(tree_info, dis_tbl_trees->str_tree_wgt, table_name, ui_name); break; default: diff --git a/ui/gtk/main.c b/ui/gtk/main.c index b351d5d497..5b0c53de32 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -612,7 +612,7 @@ get_filter_from_packet_list_row_and_column(gpointer data) if (hfi && hfi->parent == -1) { /* Protocol only */ buf = se_strdup(cfile.cinfo.col_expr.col_expr[column]); - } else if (hfi && hfi->type == FT_STRING) { + } else if (hfi && IS_FT_STRING(hfi->type)) { /* Custom string, add quotes */ buf = se_strdup_printf("%s == \"%s\"", cfile.cinfo.col_expr.col_expr[column], cfile.cinfo.col_expr.col_expr_val[column]); diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c index dd68ce6891..c25d62b48a 100644 --- a/ui/gtk/packet_win.c +++ b/ui/gtk/packet_win.c @@ -605,7 +605,7 @@ new_finfo_window(GtkWidget *w, struct FieldinfoWinData *DataPtr) gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(fvalue_edit), TRUE); g_signal_connect(fvalue_edit, "value-changed", G_CALLBACK(finfo_integer_changed), DataPtr); - } else if (finfo_type == FT_STRING || finfo_type == FT_STRINGZ) { + } else if (finfo_type == FT_STRING || finfo_type == FT_STRINGZ || finfo_type == FT_STRINGZPAD) { fvalue_edit = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(fvalue_edit), finfo->length); gtk_entry_set_text(GTK_ENTRY(fvalue_edit), (const gchar*) fvalue_get(&finfo->value)); |