Move zlib version check to wsutil

Change-Id: I0950f61e90af5bb21c0017204de0c0b509616e5c
Reviewed-on: https://code.wireshark.org/review/14747
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
João Valverde 2016-04-01 01:16:15 +01:00 committed by Michael Mann
parent a14e7a7ce1
commit f95976eefc
12 changed files with 38 additions and 333 deletions

View File

@ -69,10 +69,6 @@
#include <glib.h>
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#include <wiretap/wtap.h>
#include <wsutil/crash_info.h>
@ -1366,37 +1362,6 @@ hash_to_str(const unsigned char *hash, size_t length, char *str) {
}
#endif /* HAVE_LIBGCRYPT */
static void
get_capinfos_compiled_info(GString *str)
{
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_capinfos_runtime_info(
#if defined(HAVE_LIBZ) && !defined(_WIN32)
GString *str)
#else
GString *str _U_)
#endif
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
int
main(int argc, char *argv[])
{
@ -1428,10 +1393,10 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_capinfos_compiled_info);
comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_capinfos_runtime_info);
runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Capinfos (Wireshark) %s\n"

View File

@ -36,10 +36,6 @@
#include <getopt.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#include <glib.h>
#include <wiretap/wtap.h>
@ -86,37 +82,6 @@ failure_message(const char *msg_format _U_, va_list ap _U_)
}
#endif
static void
get_captype_compiled_info(GString *str)
{
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_captype_runtime_info(
#if defined(HAVE_LIBZ) && !defined(_WIN32)
GString *str)
#else
GString *str _U_)
#endif
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
int
main(int argc, char *argv[])
{
@ -142,10 +107,10 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_captype_compiled_info);
comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_captype_runtime_info);
runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Captype (Wireshark) %s\n"

View File

@ -54,10 +54,6 @@
#include <signal.h>
#include <errno.h>
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#include <wsutil/cmdarg_err.h>
#include <wsutil/crash_info.h>
#include <wsutil/ws_diag_control.h>
@ -3706,19 +3702,6 @@ get_dumpcap_compiled_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
@ -3727,11 +3710,6 @@ get_dumpcap_runtime_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_runtime_caplibs_version(str);
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
/* And now our feature presentation... [ fade to music ] */

View File

@ -54,10 +54,6 @@
#include <getopt.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#include <wiretap/wtap.h>
#include "epan/etypes.h"
@ -908,37 +904,6 @@ failure_message(const char *msg_format _U_, va_list ap _U_)
}
#endif
static void
get_editcap_compiled_info(GString *str)
{
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_editcap_runtime_info(
#if defined(HAVE_LIBZ) && !defined(_WIN32)
GString *str)
#else
GString *str _U_)
#endif
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
static wtap_dumper *
editcap_dump_open(const char *filename, guint32 snaplen,
wtap_optionblock_t shb_hdr,
@ -1017,10 +982,10 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_editcap_compiled_info);
comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_editcap_runtime_info);
runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Editcap (Wireshark) %s\n"

View File

@ -34,10 +34,6 @@
#include <getopt.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#include <string.h>
#include <wiretap/wtap.h>
@ -177,38 +173,6 @@ list_idb_merge_modes(void) {
}
}
static void
get_mergecap_compiled_info(GString *str)
{
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_mergecap_runtime_info(
#if defined(HAVE_LIBZ) && !defined(_WIN32)
GString *str)
#else
GString *str _U_)
#endif
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
static gboolean
merge_callback(merge_event event, int num,
const merge_in_file_t in_files[], const guint in_file_count,
@ -317,10 +281,10 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_mergecap_compiled_info);
comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_mergecap_runtime_info);
runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Mergecap (Wireshark) %s\n"

View File

@ -32,10 +32,6 @@
#include <getopt.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#include <wiretap/wtap.h>
#ifndef HAVE_GETOPT_LONG
@ -151,37 +147,6 @@ frames_compare(gconstpointer a, gconstpointer b)
return nstime_cmp(time1, time2);
}
static void
get_reordercap_compiled_info(GString *str)
{
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_reordercap_runtime_info(
#if defined(HAVE_LIBZ) && !defined(_WIN32)
GString *str)
#else
GString *str _U_)
#endif
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
#ifdef HAVE_PLUGINS
/*
* Don't report failures to load plugins because most (non-wiretap) plugins
@ -236,10 +201,10 @@ main(int argc, char *argv[])
#endif
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_reordercap_compiled_info);
comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_reordercap_runtime_info);
runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Reordercap (Wireshark) %s\n"

View File

@ -126,10 +126,6 @@
#include <errno.h>
#include <assert.h>
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#endif
@ -1438,32 +1434,6 @@ print_usage (FILE *output)
MAX_PACKET);
}
static void
get_text2pcap_compiled_info(GString *str)
{
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_text2pcap_runtime_info(GString *str)
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
/*----------------------------------------------------------------------
* Parse CLI options
*/
@ -1486,10 +1456,10 @@ parse_options (int argc, char *argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_text2pcap_compiled_info);
comp_info_str = get_compiled_version_info(NULL, NULL);
/* get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_text2pcap_runtime_info);
runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Text2pcap (Wireshark) %s\n"

View File

@ -35,10 +35,6 @@
#include <errno.h>
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#endif
@ -726,30 +722,9 @@ print_current_user(void) {
}
}
static void
get_tfshark_compiled_version_info(GString *str)
{
/* LIBZ */
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
get_tfshark_runtime_version_info(GString *str)
{
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);
}
@ -844,8 +819,7 @@ main(int argc, char *argv[])
initialize_funnel_ops();
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(get_tfshark_compiled_version_info,
epan_get_compiled_version_info);
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_tfshark_runtime_version_info);

View File

@ -40,10 +40,6 @@
#include <signal.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#ifdef HAVE_LIBCAP
# include <sys/capability.h>
#endif
@ -921,19 +917,6 @@ get_tshark_compiled_version_info(GString *str)
{
/* Capture libraries */
get_compiled_caplibs_version(str);
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
@ -945,11 +928,6 @@ get_tshark_runtime_version_info(GString *str)
get_runtime_caplibs_version(str);
#endif
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);
}

View File

@ -44,10 +44,6 @@
#include "wsutil/wsgetopt.h"
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#ifdef HAVE_EXTCAP
#include <extcap.h>
#endif
@ -1969,19 +1965,6 @@ get_wireshark_gtk_compiled_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
static void
@ -2018,11 +2001,6 @@ get_wireshark_runtime_info(GString *str)
get_runtime_caplibs_version(str);
#endif
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);

View File

@ -27,10 +27,6 @@
#include <signal.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@ -311,19 +307,6 @@ get_wireshark_qt_compiled_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
/* LIBZ */
g_string_append(str, ", ");
#ifdef HAVE_LIBZ
g_string_append(str, "with libz ");
#ifdef ZLIB_VERSION
g_string_append(str, ZLIB_VERSION);
#else /* ZLIB_VERSION */
g_string_append(str, "(version unknown)");
#endif /* ZLIB_VERSION */
#else /* HAVE_LIBZ */
g_string_append(str, "without libz");
#endif /* HAVE_LIBZ */
}
// xxx copied from ../gtk/main.c
@ -357,11 +340,6 @@ get_wireshark_runtime_info(GString *str)
get_runtime_caplibs_version(str);
#endif
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);

View File

@ -33,6 +33,10 @@
#include <glib.h>
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
#include "version.h"
#include <wsutil/ws_version_info.h>
@ -71,6 +75,20 @@ end_string(GString *str)
}
}
static const gchar *
get_zlib_compiled_version_info(void)
{
#ifdef HAVE_LIBZ
#ifdef ZLIB_VERSION
return "with libz "ZLIB_VERSION;
#else
return "with libz (version unknown)";
#endif /* ZLIB_VERSION */
#else
return "without libz";
#endif /* HAVE_LIBZ */
}
/*
* Get various library compile-time versions, put them in a GString,
* and return the GString.
@ -112,6 +130,8 @@ get_compiled_version_info(void (*prepend_info)(GString *),
"GLib (version unknown)");
#endif
g_string_append_printf(str, ", %s", get_zlib_compiled_version_info());
/* Additional application-dependent information */
if (append_info)
(*append_info)(str);
@ -334,6 +354,11 @@ get_runtime_version_info(void (*additional_info)(GString *))
if (additional_info)
(*additional_info)(str);
/* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
g_string_append(str, ".");
/* CPU Info */