[Xfce4-commits] [panel-plugins/xfce4-battery-plugin] 03/08: Fix compilation warnings

noreply at xfce.org noreply at xfce.org
Mon Dec 31 23:17:12 CET 2018


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-battery-plugin.

commit 7faffa174b19232e7594633894bfafac0539f287
Author: Andre Miranda <andreldm at xfce.org>
Date:   Mon Dec 31 18:15:41 2018 -0300

    Fix compilation warnings
---
 panel-plugin/battery.c | 12 +++++++-----
 panel-plugin/libacpi.c | 28 ++++++++++++++--------------
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/panel-plugin/battery.c b/panel-plugin/battery.c
index 6ce6f52..630e157 100644
--- a/panel-plugin/battery.c
+++ b/panel-plugin/battery.c
@@ -167,6 +167,9 @@ update_apm_status(t_battmon *battmon)
     gboolean acline=FALSE;
     gchar buffer[128];
     gchar *css, *color_str;
+    GtkWidget *dialog;
+    GdkRGBA *color;
+    gchar *cssminsizes;
 
     static int update_time = AVERAGING_CYCLE;
     static int sum_lcapacity = 0;
@@ -389,7 +392,6 @@ update_apm_status(t_battmon *battmon)
     gtk_progress_bar_set_text(GTK_PROGRESS_BAR(battmon->battstatus), NULL);
 
     /* bar colors and state flags */
-    GdkRGBA *color;
     if (acline) {
       battmon->low = battmon->critical = FALSE;
       color = &battmon->options.colorA;
@@ -410,7 +412,7 @@ update_apm_status(t_battmon *battmon)
 
     color_str = gdk_rgba_to_string (color);
 #if GTK_CHECK_VERSION (3, 20, 0)
-    gchar * cssminsizes = "min-width: 4px; min-height: 0px";
+    cssminsizes = "min-width: 4px; min-height: 0px";
     if (gtk_orientable_get_orientation(GTK_ORIENTABLE(battmon->battstatus)) == GTK_ORIENTATION_HORIZONTAL)
         cssminsizes = "min-width: 0px; min-height: 4px";
     css = g_strdup_printf("progressbar trough { %s } \
@@ -429,7 +431,7 @@ update_apm_status(t_battmon *battmon)
     if (method != BM_BROKEN && !acline && charge <= battmon->options.low_percentage) {
         if(!battmon->critical && charge <= battmon->options.critical_percentage) {
                battmon->critical = TRUE;
-	       GtkWidget *dialog;
+
             if(battmon->options.action_on_critical == BM_MESSAGE){
 do_critical_warn:
                 dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
@@ -447,7 +449,7 @@ do_critical_warn:
             }
         } else if (!battmon->low){
                 battmon->low = TRUE;
-	       GtkWidget *dialog;
+
             if(battmon->options.action_on_low == BM_MESSAGE){
 do_low_warn:
                 dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
@@ -1385,7 +1387,7 @@ on_power_change (GDBusProxy  *proxy,
     update_apm_status (battmon);
 }
 
-void
+static void
 battmon_dbus_monitor (t_battmon *battmon)
 {
     GDBusProxy *proxy;
diff --git a/panel-plugin/libacpi.c b/panel-plugin/libacpi.c
index 0f524ca..153a42b 100644
--- a/panel-plugin/libacpi.c
+++ b/panel-plugin/libacpi.c
@@ -59,10 +59,9 @@ static int      acpifd;
 #include "libacpi.h"
 
 static char batteries[MAXBATT][128];
-static char battinfo[MAXBATT][128];
 /* path to AC adapter because not all AC adapter are listed 
 in /sys/class/power_supply/AC/ this obviously only supports one AC adapter. */
-static char sysfsacdir[128]; 
+static char sysfsacdir[280]; 
 
 #ifndef __linux__
 #if HAVE_SYSCTL
@@ -191,13 +190,13 @@ get_var(int *oid, int nlen)
 #endif
 #endif
 
-int check_acpi_sysfs(void)
+static int check_acpi_sysfs(void)
 {
 	DIR *sysfs;
 	struct dirent *batt;
 	char *name;
 	FILE *typefile;
-	char typepath[128];
+	char typepath[300];
 	char tmptype[8];
 
 	acpi_sysfs = 0;
@@ -304,9 +303,11 @@ int check_acpi(void)
 #endif
 }
 
-int read_sysfs_int(char* filename)
+static int read_sysfs_int(char* filename)
 {
 	FILE* f;
+	int out;
+
 	f = fopen(filename,"r");
 	if ( !f )
 	{
@@ -315,13 +316,13 @@ int read_sysfs_int(char* filename)
 #endif
 		return 0;
 	}
-	int out;
+
 	fscanf(f,"%d",&out);
 	fclose(f);
 	return out;
 }
 
-char* read_sysfs_string(char* filename)
+static char* read_sysfs_string(char* filename)
 {
 	FILE* f;
 	f = fopen(filename,"r");
@@ -337,12 +338,10 @@ char* read_sysfs_string(char* filename)
 	return buf2;
 }
 
-int read_acad_state_sysfs(void)
+static int read_acad_state_sysfs(void)
 {
 	DIR *sysfs;
-	struct dirent *propety;
-	char *name;
-	char onlinefilepath[128];
+	char onlinefilepath[300];
 	
 	sysfs = opendir(sysfsacdir);
 	if (sysfs == 0)
@@ -356,9 +355,10 @@ int read_acad_state_sysfs(void)
 	
 	if (!acadstate) acadstate=(ACADstate *)malloc(sizeof(ACADstate));
 	/* this code doesn't make much sense.. why look at the whole directory?!
+	struct dirent *propety;
 	while ((propety = readdir(sysfs)))
 	{
-		name = propety->d_name;
+		char *name = propety->d_name;
 		if (!strncmp(".", name, 1) || !strncmp("..", name, 2)) continue;
 		
 		if (strcmp(name,"online") == 0)
@@ -410,7 +410,7 @@ int read_acad_state(void)
 #endif
 }
 
-int read_acpi_info_sysfs(int battery)
+static int read_acpi_info_sysfs(int battery)
 {
 	DIR *sysfs;
 	struct dirent *propety;
@@ -537,7 +537,7 @@ int read_acpi_info(int battery)
 
 }
 
-int read_acpi_state_sysfs(int battery)
+static int read_acpi_state_sysfs(int battery)
 {
 	DIR *sysfs;
 	struct dirent *propety;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list