Fix compilation warnings

master
Gaël Bonithon 2021-01-30 11:22:07 +01:00 committed by Romain Bouvier
parent e0cac0dec6
commit f7f50e1e03
5 changed files with 13 additions and 15 deletions

View File

@ -38,8 +38,6 @@ struct _XnlpMonitorLabel
G_DEFINE_TYPE (XnlpMonitorLabel, xnlp_monitor_label, GTK_TYPE_LABEL) G_DEFINE_TYPE (XnlpMonitorLabel, xnlp_monitor_label, GTK_TYPE_LABEL)
static void xnlp_monitor_label_constructed (GObject *object);
static void cb_label_changed (GObject *object, static void cb_label_changed (GObject *object,
GParamSpec *pspec, GParamSpec *pspec,
gpointer user_data); gpointer user_data);
@ -49,7 +47,6 @@ static void cb_label_changed (GObject *object,
static void static void
xnlp_monitor_label_class_init (XnlpMonitorLabelClass *klass) xnlp_monitor_label_class_init (XnlpMonitorLabelClass *klass)
{ {
GObjectClass *class = G_OBJECT_CLASS (klass);
xnlp_monitor_label_parent_class = g_type_class_peek_parent (klass); xnlp_monitor_label_parent_class = g_type_class_peek_parent (klass);
} }

View File

@ -178,7 +178,6 @@ int get_interface_up(netdata* data)
{ {
int sockfd; int sockfd;
struct ifreq ifr; struct ifreq ifr;
struct sockaddr_in *p_sa;
/* if the update count is non-zero */ /* if the update count is non-zero */
if (data->up_update_count > 0) if (data->up_update_count > 0)
@ -194,7 +193,7 @@ int get_interface_up(netdata* data)
return FALSE; return FALSE;
} }
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", data->ifdata.if_name); g_snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", data->ifdata.if_name);
if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) != 0) if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) != 0)
{ {
DBG("Error in ioctl(sockfd): %s", strerror(errno)); DBG("Error in ioctl(sockfd): %s", strerror(errno));
@ -231,7 +230,7 @@ char* get_ip_address(netdata* data)
return NULL; return NULL;
} }
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", data->ifdata.if_name); g_snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", data->ifdata.if_name);
if (ioctl(sockfd, SIOCGIFADDR, &ifr) != 0) if (ioctl(sockfd, SIOCGIFADDR, &ifr) != 0)
{ {
if (errno != EADDRNOTAVAIL) if (errno != EADDRNOTAVAIL)

View File

@ -181,7 +181,7 @@ static gboolean update_monitors(gpointer user_data)
/* correct value to be from 1 ... 100 */ /* correct value to be from 1 ... 100 */
global->monitor->history[i][0] = net[i]; global->monitor->history[i][0] = net[i];
if (global->monitor->history[i][0] < 0) if ((gint) global->monitor->history[i][0] < 0)
{ {
global->monitor->history[i][0] = 0; global->monitor->history[i][0] = 0;
} }

View File

@ -50,7 +50,7 @@
# include <sys/mib.h> # include <sys/mib.h>
# include <arpa/inet.h> # include <arpa/inet.h>
# include <net/if.h> # include <net/if.h>
#elif __APPLE__ /* Mac OS X */ #elif defined (__APPLE__) /* Mac OS X */
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
# include <stdarg.h> # include <stdarg.h>
@ -76,7 +76,7 @@
# include <net/if_media.h> # include <net/if_media.h>
# include <net/if_mib.h> # include <net/if_mib.h>
# include <arpa/inet.h> # include <arpa/inet.h>
#elif __DragonFly__ /* D R A G O N F L Y */ #elif defined (__DragonFly__) /* D R A G O N F L Y */
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
# include <stdarg.h> # include <stdarg.h>
@ -98,7 +98,7 @@
# include <net/if_media.h> # include <net/if_media.h>
# include <net/if_mib.h> # include <net/if_mib.h>
# include <arpa/inet.h> # include <arpa/inet.h>
#elif __FreeBSD__ || __FreeBSD_kernel__ /* F R E E B S D */ #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) /* F R E E B S D */
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
# include <stdarg.h> # include <stdarg.h>
@ -121,7 +121,7 @@
# include <net/if_mib.h> # include <net/if_mib.h>
# include <arpa/inet.h> # include <arpa/inet.h>
# include <ifaddrs.h> # include <ifaddrs.h>
#elif __NetBSD__ /* N E T B S D */ #elif defined (__NetBSD__) /* N E T B S D */
# include <stdio.h> # include <stdio.h>
# include <sys/param.h> # include <sys/param.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
@ -146,7 +146,7 @@
# include <arpa/inet.h> # include <arpa/inet.h>
# include <net/if.h> # include <net/if.h>
# include <ifaddrs.h> # include <ifaddrs.h>
#elif __OpenBSD__ || __MicroBSD__ /* O P E N B S D */ #elif defined (__OpenBSD__) || defined (__MicroBSD__) /* O P E N B S D */
# include <stdio.h> # include <stdio.h>
# include <sys/param.h> # include <sys/param.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
@ -170,7 +170,7 @@
# include <net/route.h> # include <net/route.h>
# include <arpa/inet.h> # include <arpa/inet.h>
# include <ifaddrs.h> # include <ifaddrs.h>
#elif __linux__ /* L I N U X */ #elif defined (__linux__) /* L I N U X */
# include <stdio.h> # include <stdio.h>
# include <sys/param.h> # include <sys/param.h>
# include <stdlib.h> # include <stdlib.h>
@ -190,7 +190,7 @@
# include <net/if.h> # include <net/if.h>
# include <arpa/inet.h> # include <arpa/inet.h>
# include <ifaddrs.h> # include <ifaddrs.h>
#elif __Solaris__ /* S O L A R I S */ #elif defined (__Solaris__) /* S O L A R I S */
# include <stdio.h> # include <stdio.h>
# define _WIDEC_H # define _WIDEC_H
# include <sys/param.h> # include <sys/param.h>

View File

@ -30,6 +30,8 @@
#include <config.h> #include <config.h>
#endif #endif
#include "utils.h"
#ifndef BUFSIZ #ifndef BUFSIZ
#define BUFSIZ 512 #define BUFSIZ 512
#endif #endif
@ -119,7 +121,7 @@ char* format_byte_humanreadable(char* string, int stringsize, double number, int
/* get the number of integer characters */ /* get the number of integer characters */
count = numberOfIntegerChars = ( digits > 0 count = numberOfIntegerChars = ( digits > 0
? ( strstr( buffer, localeinfo->decimal_point ) - buffer ) ? (unsigned int)( strstr( buffer, localeinfo->decimal_point ) - buffer )
: strlen( buffer ) ); : strlen( buffer ) );