Fix various compile warnings turning error on Linux with gcc6 when
authorJoerg Mayer <jmayer@loplof.de>
Sun, 19 Mar 2017 11:26:28 +0000 (12:26 +0100)
committerJörg Mayer <jmayer@loplof.de>
Sun, 19 Mar 2017 12:27:12 +0000 (12:27 +0000)
compiling with HAVE_PCAP_REMOTE (and ENABLE_ECHLD)

Change-Id: If5524f2d3dcacca9c82a46167480c8436dd8b1b2
Reviewed-on: https://code.wireshark.org/review/20615
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
capchild/capture_ifinfo.c
capture_opts.h
echld/dispatcher.c
ui/recent.c

index 539857b9d5226308f2d1073f7ed999e1c0c90117..e3773f512ba0eb529f18fd57c56bb39d80546034 100644 (file)
@@ -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;
index c5ba0e2abb34ebcf46fae37d5de6241a4f5b4fe5..780bbca526060f4eba9fcbcbc41b3e0f5f370b24 100644 (file)
@@ -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 {
index 6cddc24c16dcfbb2cf8784f0268692a00431d842..eb749d9b27b048783706cfc081356df0d1986dda 100644 (file)
@@ -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);
 }
 
index 42d6dc06bae8b84ee1a6e68d1220ccc9bfcb2a03..30c44f485a6a395103c5fbfee951d2aa8daa2b37 100644 (file)
@@ -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;
     }