diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-11-07 19:49:58 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-11-07 19:49:58 +0000 |
commit | 4c2f1f7ccb54097c14b87e215c209e0825e5003d (patch) | |
tree | 3237aa39a1e497afee19a1c7b741c435d85cd720 /print.c | |
parent | 8d8af34ba442122f4d9c9aab6b959ba6d1b19d7b (diff) |
Based on a change from Paul Blankenbaker, make the "show" attribute for
a field an empty string if the field is zero-length; for some reason,
the existing code doesn't handle that correctly.
Also, the NetPDL Visualization Extension:
http://www.nbee.org/Docs/NetPDL/NetPDLVisualization.htm
seems to imply that "value" has to be present, so display it even if the
field is zero-length.
svn path=/trunk/; revision=19862
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 64 |
1 files changed, 37 insertions, 27 deletions
@@ -341,37 +341,47 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data) fputs("\" show=\"\" value=\"", pdata->fh); break; default: - /* XXX - this is a hack until we can just call - * fvalue_to_string_repr() for *all* FT_* types. */ - dfilter_string = proto_construct_dfilter_string(fi, + /* + * Set the 'show' attribute to empty string + * if the field is zero-length. + * + * XXX - why does the code in the else clause + * not do that correctly? + */ + if (fi->length == 0) { + fputs("\" show=\"", pdata->fh); + } else { + /* XXX - this is a hack until we can just call + * fvalue_to_string_repr() for *all* FT_* + * types. */ + dfilter_string = proto_construct_dfilter_string(fi, pdata->edt); - if (dfilter_string != NULL) { - chop_len = strlen(fi->hfinfo->abbrev) + 4; /* for " == " */ - - /* XXX - Remove double-quotes. Again, once we - * can call fvalue_to_string_repr(), we can - * ask it not to produce the version for - * display-filters, and thus, no - * double-quotes. */ - if (dfilter_string[strlen(dfilter_string)-1] == '"') { - dfilter_string[strlen(dfilter_string)-1] = '\0'; - chop_len++; + if (dfilter_string != NULL) { + chop_len = strlen(fi->hfinfo->abbrev) + 4; /* for " == " */ + + /* XXX - Remove double-quotes. Again, + * once we can call fvalue_to_string_repr(), we can + * ask it not to produce the version + * for display-filters, and thus, no + * double-quotes. */ + if (dfilter_string[strlen(dfilter_string)-1] == '"') { + dfilter_string[strlen(dfilter_string)-1] = '\0'; + chop_len++; + } + + fputs("\" show=\"", pdata->fh); + print_escaped_xml(pdata->fh, &dfilter_string[chop_len]); } - - fputs("\" show=\"", pdata->fh); - print_escaped_xml(pdata->fh, &dfilter_string[chop_len]); } - if (fi->length > 0) { - fputs("\" value=\"", pdata->fh); + fputs("\" value=\"", pdata->fh); - if (fi->hfinfo->bitmask!=0) { - fprintf(pdata->fh, "%X", fvalue_get_integer(&fi->value)); - fputs("\" unmaskedvalue=\"", pdata->fh); - write_pdml_field_hex_value(pdata, fi); - } - else { - write_pdml_field_hex_value(pdata, fi); - } + if (fi->hfinfo->bitmask!=0) { + fprintf(pdata->fh, "%X", fvalue_get_integer(&fi->value)); + fputs("\" unmaskedvalue=\"", pdata->fh); + write_pdml_field_hex_value(pdata, fi); + } + else { + write_pdml_field_hex_value(pdata, fi); } } |