From 2890e415bbec3ddad7c0485067dd09f1e503c84f Mon Sep 17 00:00:00 2001 From: Joerg Mayer Date: Sun, 19 Mar 2017 12:26:28 +0100 Subject: Fix various compile warnings turning error on Linux with gcc6 when compiling with HAVE_PCAP_REMOTE (and ENABLE_ECHLD) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If5524f2d3dcacca9c82a46167480c8436dd8b1b2 Reviewed-on: https://code.wireshark.org/review/20615 Petri-Dish: Jörg Mayer Tested-by: Petri Dish Buildbot Reviewed-by: Jörg Mayer --- capchild/capture_ifinfo.c | 8 ++++---- capture_opts.h | 26 +++++++++++++------------- echld/dispatcher.c | 14 +++++++------- ui/recent.c | 16 ++++++++-------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c index 539857b9d5..e3773f512b 100644 --- a/capchild/capture_ifinfo.c +++ b/capchild/capture_ifinfo.c @@ -54,12 +54,12 @@ static GList * append_remote_list(GList *iflist) for (rlist = g_list_nth(remote_interface_list, 0); rlist != NULL; rlist = g_list_next(rlist)) { if_info = (if_info_t *)rlist->data; - temp = g_malloc0(sizeof(if_info_t)); + temp = (if_info_t*) g_malloc0(sizeof(if_info_t)); temp->name = g_strdup(if_info->name); temp->friendly_name = g_strdup(if_info->friendly_name); temp->vendor_description = g_strdup(if_info->vendor_description); for (list = g_slist_nth(if_info->addrs, 0); list != NULL; list = g_slist_next(list)) { - temp_addr = g_malloc0(sizeof(if_addr_t)); + temp_addr = (if_addr_t *) g_malloc0(sizeof(if_addr_t)); if_addr = (if_addr_t *)list->data; if (if_addr) { temp_addr->ifat_type = if_addr->ifat_type; @@ -350,12 +350,12 @@ void add_interface_to_remote_list(if_info_t *if_info) GSList *list; if_addr_t *if_addr, *temp_addr; - if_info_t *temp = g_malloc0(sizeof(if_info_t)); + if_info_t *temp = (if_info_t*) g_malloc0(sizeof(if_info_t)); temp->name = g_strdup(if_info->name); temp->friendly_name = g_strdup(if_info->friendly_name); temp->vendor_description = g_strdup(if_info->vendor_description); for (list = g_slist_nth(if_info->addrs, 0); list != NULL; list = g_slist_next(list)) { - temp_addr = g_malloc0(sizeof(if_addr_t)); + temp_addr = (if_addr_t *)g_malloc0(sizeof(if_addr_t)); if_addr = (if_addr_t *)list->data; if (if_addr) { temp_addr->ifat_type = if_addr->ifat_type; diff --git a/capture_opts.h b/capture_opts.h index c5ba0e2abb..780bbca526 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -134,22 +134,22 @@ typedef enum { #ifdef HAVE_PCAP_REMOTE struct remote_host_info { - gchar *remote_host; /**< Host name or network address for remote capturing */ - gchar *remote_port; /**< TCP port of remote RPCAP server */ - gint auth_type; /**< Authentication type */ - gchar *auth_username; /**< Remote authentication parameters */ - gchar *auth_password; /**< Remote authentication parameters */ - gboolean datatx_udp; - gboolean nocap_rpcap; - gboolean nocap_local; + gchar *remote_host; /**< Host name or network address for remote capturing */ + gchar *remote_port; /**< TCP port of remote RPCAP server */ + capture_auth auth_type; /**< Authentication type */ + gchar *auth_username; /**< Remote authentication parameters */ + gchar *auth_password; /**< Remote authentication parameters */ + gboolean datatx_udp; + gboolean nocap_rpcap; + gboolean nocap_local; }; struct remote_host { - gchar *r_host; /**< Host name or network address for remote capturing */ - gchar *remote_port; /**< TCP port of remote RPCAP server */ - gint auth_type; /**< Authentication type */ - gchar *auth_username; /**< Remote authentication parameters */ - gchar *auth_password; /**< Remote authentication parameters */ + gchar *r_host; /**< Host name or network address for remote capturing */ + gchar *remote_port; /**< TCP port of remote RPCAP server */ + capture_auth auth_type; /**< Authentication type */ + gchar *auth_username; /**< Remote authentication parameters */ + gchar *auth_password; /**< Remote authentication parameters */ }; typedef struct remote_options_tag { diff --git a/echld/dispatcher.c b/echld/dispatcher.c index 6cddc24c16..eb749d9b27 100644 --- a/echld/dispatcher.c +++ b/echld/dispatcher.c @@ -158,13 +158,13 @@ static void children_massacre(void) { } +#define ERR_STR_LEN 1024 static void dispatcher_fatal(int cause, const char* fmt, ...) { - size_t len= 1024; - gchar err_str[len]; + gchar err_str[ERR_STR_LEN]; va_list ap; va_start(ap, fmt); - g_vsnprintf(err_str,len,fmt,ap); + g_vsnprintf(err_str, ERR_STR_LEN, fmt,ap); va_end(ap); DISP_DBG((0,"fatal cause=%d msg=\"%s\"",cause ,err_str)); @@ -177,13 +177,12 @@ static void dispatcher_fatal(int cause, const char* fmt, ...) { #define DISP_FATAL(attrs) dispatcher_fatal attrs static void dispatcher_err(int errnum, const char* fmt, ...) { - size_t len= 1024; - gchar err_str[len]; + gchar err_str[ERR_STR_LEN]; va_list ap; static GByteArray* ba; va_start(ap, fmt); - g_vsnprintf(err_str,len,fmt,ap); + g_vsnprintf(err_str, ERR_STR_LEN, fmt,ap); va_end(ap); DISP_DBG((0,"error=\"%s\"",err_str)); @@ -1019,6 +1018,7 @@ void dispatcher_alrm(int sig _U_) { void echld_dispatcher_start(int* in_pipe_fds, int* out_pipe_fds, char* argv0, int (*main)(int, char **)) { static struct dispatcher d; int i; + int ret; DISP_DBG_INIT(); DISP_DBG((2,"Dispatcher Starting")); @@ -1059,7 +1059,7 @@ void echld_dispatcher_start(int* in_pipe_fds, int* out_pipe_fds, char* argv0, in DISP_WRITE(dispatcher->parent_out, NULL, 0, ECHLD_HELLO, 0); ret = dispatcher_loop(); - capture_opts_cleanup(dispatcher->capture_opts); + capture_opts_cleanup(&(dispatcher->capture_opts)); exit(ret); } diff --git a/ui/recent.c b/ui/recent.c index 42d6dc06ba..30c44f485a 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -404,7 +404,7 @@ void recent_add_remote_host(gchar *host, struct remote_host *rh) static gboolean free_remote_host (gpointer key _U_, gpointer value, gpointer user _U_) { - struct remote_host *rh = value; + struct remote_host *rh = (struct remote_host *) value; g_free (rh->r_host); g_free (rh->remote_port); @@ -424,8 +424,8 @@ recent_remote_host_list_foreach(GHFunc func, gpointer user_data) static void recent_print_remote_host (gpointer key _U_, gpointer value, gpointer user) { - FILE *rf = user; - struct remote_host_info *ri = value; + FILE *rf = (FILE *)user; + struct remote_host_info *ri = (struct remote_host_info *)value; fprintf (rf, RECENT_KEY_REMOTE_HOST ": %s,%s,%d\n", ri->remote_host, ri->remote_port, ri->auth_type); } @@ -462,7 +462,7 @@ capture_remote_combo_add_recent(const gchar *s) { GList *vals = prefs_get_string_list (s); GList *valp = vals; - gint auth_type; + capture_auth auth_type; char *p; struct remote_host *rh; @@ -473,10 +473,10 @@ capture_remote_combo_add_recent(const gchar *s) remote_host_list = g_hash_table_new (g_str_hash, g_str_equal); } - rh = g_malloc (sizeof (*rh)); + rh =(struct remote_host *) g_malloc (sizeof (*rh)); /* First value is the host */ - rh->r_host = g_strdup (valp->data); + rh->r_host = (gchar *)g_strdup ((const gchar *)valp->data); if (strlen(rh->r_host) == 0) { /* Empty remote host */ g_free(rh->r_host); @@ -488,7 +488,7 @@ capture_remote_combo_add_recent(const gchar *s) if (valp) { /* Found value 2, this is the port number */ - rh->remote_port = g_strdup (valp->data); + rh->remote_port = (gchar *)g_strdup ((const gchar *)valp->data); valp = valp->next; } else { /* Did not find a port number */ @@ -497,7 +497,7 @@ capture_remote_combo_add_recent(const gchar *s) if (valp) { /* Found value 3, this is the authentication type */ - auth_type = (gint)strtol(valp->data, &p, 0); + auth_type = (capture_auth)strtol((const gchar *)valp->data, &p, 0); if (p != valp->data && *p == '\0') { rh->auth_type = auth_type; } -- cgit v1.2.3