diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-11-19 16:06:38 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-11-20 03:11:10 +0000 |
commit | ba3454529302a64e11c498a2185f4b5ddc1ccf3a (patch) | |
tree | 1b61241755cc2d95a3f0f7a47b29dab630c9b116 /wiretap/wtap.c | |
parent | 2f17546932707dd2e6b02681fd8ff1f395f48aaf (diff) |
Add an API to get a list of compressed-file extensions, and use it.
Move all the compressed-file type stuff to wiretap/file_wrappers.c.
Rename wtap_compressed_file_extension() to
wtap_compression_type_extension() for consistency with the other
compression-type-extension routine names.
Move the declarations of the compression-type-extension routines in the
header file.
wtap_compression_type_extension() now returns NULL for
WTAP_UNCOMPRESSED; there's no need to special-case it.
Get rid of the now-unused wtap_compression_type_supported() and
WTAP_NUM_COMPRESSION_TYPES.
Change-Id: Ib93874079bea669a0c87104513dba0d21390455a
Reviewed-on: https://code.wireshark.org/review/30729
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r-- | wiretap/wtap.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 5d32180d56..b9cc3571b5 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -77,67 +77,6 @@ wtap_file_type_subtype(wtap *wth) return wth->file_type_subtype; } -wtap_compression_type -wtap_get_compression_type(wtap *wth) -{ - gboolean is_compressed; - - is_compressed = file_iscompressed((wth->fh == NULL) ? wth->random_fh : wth->fh); - return is_compressed ? WTAP_GZIP_COMPRESSED : WTAP_UNCOMPRESSED; -} - -/* - * Indicate whether a given compression type is supported. - */ -static const gboolean compression_type_supported[WTAP_NUM_COMPRESSION_TYPES] = { - TRUE, -#ifdef HAVE_ZLIB - TRUE -#else - FALSE -#endif -}; - -gboolean -wtap_compression_type_supported(wtap_compression_type compression_type) -{ - g_assert(compression_type >= 0 && compression_type < WTAP_NUM_COMPRESSION_TYPES); - return compression_type_supported[compression_type]; -} - -static const char *compression_type_descriptions[WTAP_NUM_COMPRESSION_TYPES] = { - NULL, /* uncompressed */ - "gzip compressed" -}; - -const char * -wtap_compression_type_description(wtap_compression_type compression_type) -{ - g_assert(compression_type >= 0 && compression_type < WTAP_NUM_COMPRESSION_TYPES); - return compression_type_descriptions[compression_type]; -} - -/* - * List of extensions for compressed files. - * If we add support for more compressed file types, this table - * might be expanded to include routines to handle the various - * compression types. - * - * The entry is NULL for WTAP_UNCOMPRESSED, as it's not a compression type, - * and thus has no suffix to indicate the compression type. - */ -static const char *compressed_file_extensions[WTAP_NUM_COMPRESSION_TYPES] = { - NULL, - "gz" -}; - -const char * -wtap_compressed_file_extension(wtap_compression_type compression_type) -{ - g_assert(compression_type >= 0 && compression_type < WTAP_NUM_COMPRESSION_TYPES); - return compressed_file_extensions[compression_type]; -} - guint wtap_snapshot_length(wtap *wth) { |