Fixed tshark pdml output.

Corrected if no protocol filter (-j) specified.

Change-Id: Id20dd255642951633efa935dbb1363e7b9aa9be0
Reviewed-on: https://code.wireshark.org/review/16164
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
This commit is contained in:
Martin Kacer 2016-06-27 06:41:56 +02:00 committed by Jaap Keuter
parent d90e6e74da
commit d8ddf84693
1 changed files with 13 additions and 20 deletions

View File

@ -605,7 +605,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
/* We print some levels for PDML. Recurse here. */
if (node->first_child != NULL) {
if(check_protocolfilter(pdata->filter, fi->hfinfo->abbrev)) {
if (pdata->filter == NULL || check_protocolfilter(pdata->filter, fi->hfinfo->abbrev)) {
pdata->level++;
proto_tree_children_foreach(node,
proto_tree_write_node_pdml, pdata);
@ -816,26 +816,19 @@ proto_tree_write_node_json(proto_node *node, gpointer data)
/* We print some levels for JSON. Recurse here. */
if (node->first_child != NULL) {
if (pdata->filter != NULL) {
if(check_protocolfilter(pdata->filter, fi->hfinfo->abbrev)) {
pdata->level++;
proto_tree_children_foreach(node, proto_tree_write_node_json, pdata);
pdata->level--;
} else {
/* Indent to the correct level */
for (i = -4; i < pdata->level; i++) {
fputs(" ", pdata->fh);
}
/* print dummy field */
fputs("\"filtered\": \"", pdata->fh);
print_escaped_ek(pdata->fh, fi->hfinfo->abbrev);
fputs("\"\n", pdata->fh);
}
} else {
if (pdata->filter == NULL || check_protocolfilter(pdata->filter, fi->hfinfo->abbrev)) {
pdata->level++;
proto_tree_children_foreach(node,
proto_tree_write_node_json, pdata);
proto_tree_children_foreach(node, proto_tree_write_node_json, pdata);
pdata->level--;
} else {
/* Indent to the correct level */
for (i = -4; i < pdata->level; i++) {
fputs(" ", pdata->fh);
}
/* print dummy field */
fputs("\"filtered\": \"", pdata->fh);
print_escaped_ek(pdata->fh, fi->hfinfo->abbrev);
fputs("\"\n", pdata->fh);
}
}
@ -1031,7 +1024,7 @@ proto_tree_write_node_ek(proto_node *node, gpointer data)
if (pdata->filter != NULL) {
/* to to thread the '.' and '_' equally. The '.' is replace by print_escaped_ek for '_' */
/* to to thread the '.' and '_' equally. The '.' is replace by print_escaped_ek for '_' */
if (fi->hfinfo->abbrev != NULL) {
if (strlen(fi->hfinfo->abbrev) > 0) {
abbrev_escaped = g_strdup(fi->hfinfo->abbrev);