aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-05-14 15:00:07 -0700
committerGerald Combs <gerald@wireshark.org>2015-05-14 22:03:35 +0000
commit63e94c5af1cd48359b6b8b88dbb3d59e3d323efa (patch)
treec745999f8b2453432d74682b8727f06db43b15db /ui
parent294706a1bfb8c9d1404ecd21bf5a64db19ad99cb (diff)
Fix display filter completion behavior.
Allow completion for mismatched protocol and filter names. Change-Id: I1d1e6b8f16d4d2d331b915c199f857835dcc1c53 Ping-bug: 11187 Reviewed-on: https://code.wireshark.org/review/8464 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/display_filter_edit.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp
index 415f805282..45ce0677ee 100644
--- a/ui/qt/display_filter_edit.cpp
+++ b/ui/qt/display_filter_edit.cpp
@@ -464,19 +464,15 @@ void DisplayFilterEdit::buildCompletionList(const QString &field_word)
// Add fields only if we're past the protocol name and only for the
// current protocol.
- // XXX This incorrectly skips over some fields since field and
- // protocol names don't always match (see is_from_other_protocol_whitelist
- // in tools/checkfiltername.pl). Unfortunately if we remove the
- // startsWith check then completion becomes unbearably slow on
- // Windows.
- if (field_dots > pfname.count('.') && field_word.startsWith(pfname)) {
+ if (field_dots > pfname.count('.')) {
void *field_cookie;
+ const QByteArray fw_ba = field_word.toUtf8(); // or toLatin1 or toStdString?
+ const char *fw_utf8 = fw_ba.constData();
+ int fw_len = (int) strlen(fw_utf8);
for (header_field_info *hfinfo = proto_get_first_protocol_field(proto_id, &field_cookie); hfinfo; hfinfo = proto_get_next_protocol_field(proto_id, &field_cookie)) {
if (hfinfo->same_name_prev_id != -1) continue; // Ignore duplicate names.
- QString abbrev = hfinfo->abbrev;
-
- if (field_word.compare(abbrev)) field_list << abbrev;
+ if (!g_ascii_strncasecmp(fw_utf8, hfinfo->abbrev, fw_len)) field_list << hfinfo->abbrev;
}
}
}