diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-11-16 02:15:47 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-11-16 12:21:00 +0000 |
commit | b894c53d5ea1395e042bb05e471d651af486dfab (patch) | |
tree | 9bd6a6c5168fe4c4594508c912765a342ab9afe0 /capinfos.c | |
parent | eea4997f7e52e0126448225dfd04da840f73ec0c (diff) |
Add an API to get a description of a compression type, and use it.
Add wtap_compression_type_description(), which returns NULL for
WTAP_UNCOMPRESSED and a descriptive string for other compression types.
Instead of checking for WTAP_GZIP_COMPRESSED and appending "(gzip
compressed)", just pass the compression type to
wtap_compression_type_description() and, if the result is non-null,
append its result, wrapped in parentheses, with a space before the left
parenthesis.
Change-Id: I79a999c7838a883953795d5cbab009966e14b65e
Reviewed-on: https://code.wireshark.org/review/30666
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'capinfos.c')
-rw-r--r-- | capinfos.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/capinfos.c b/capinfos.c index bed9cfe2a8..34bf6b8864 100644 --- a/capinfos.c +++ b/capinfos.c @@ -583,10 +583,16 @@ print_stats(const gchar *filename, capture_info *cf_info) file_encap_string = wtap_encap_string(cf_info->file_encap); if (filename) printf ("File name: %s\n", filename); - if (cap_file_type) printf ("File type: %s%s\n", - file_type_string, - cf_info->compression_type == WTAP_GZIP_COMPRESSED ? " (gzip compressed)" : ""); - + if (cap_file_type) { + const char *compression_type_description; + compression_type_description = wtap_compression_type_description(cf_info->compression_type); + if (compression_type_description == NULL) + printf ("File type: %s\n", + file_type_string); + else + printf ("File type: %s (%s)\n", + file_type_string, compression_type_description); + } if (cap_file_encap) { printf ("File encapsulation: %s\n", file_encap_string); if (cf_info->file_encap == WTAP_ENCAP_PER_PACKET) { |