fixed style
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 8 Jun 2016 11:13:52 +0000 (13:13 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 8 Jun 2016 11:13:52 +0000 (13:13 +0200)
src/cfg.c
src/graph.c
src/lib/amd.c
src/lib/nvidia.c
src/lib/parray.h
src/lib/psensor.c
src/lib/ptime.c
src/pxdg.c
src/ui_sensorpref.c
src/ui_status.c

index 6ee3b49..f033247 100644 (file)
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -698,7 +698,8 @@ void config_set_sensor_color(const char *sid, const GdkRGBA *color)
 static const char *next_default_color(void)
 {
        /* copied from the default colors of the gtk color color
-        * chooser. */
+        * chooser.
+        */
        const char *default_colors[27] = {
                "#ef2929",  /* Scarlet Red */
                "#fcaf3e",  /* Orange */
index 16eb5ed..3b04993 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <cfg.h>
 #include <graph.h>
+#include <parray.h>
 #include <plog.h>
 #include <psensor.h>
 
@@ -247,7 +248,7 @@ static double dashes[] = {
        1.0,            /* ink */
        2.0,            /* skip */
 };
-static int ndash = sizeof(dashes) / sizeof(dashes[0]);
+static int ndash = ARRAY_SIZE(dashes);
 
 static void draw_background_lines(cairo_t *cr,
                                  int min, int max,
@@ -331,7 +332,8 @@ static void draw_sensor_smooth_curve(struct psensor *s,
        /* search the index of the first measure used as a start point
         * of a Bezier curve. The start and end points of the Bezier
         * curves must be preserved to ensure the same overall shape
-        * of the graph. */
+        * of the graph.
+        */
        i = 0;
        if (stimes) {
                while (i < s->values_max_length) {
index f760360..72a807e 100644 (file)
@@ -77,7 +77,7 @@ static double get_temp(struct psensor *sensor)
        v.iSize = sizeof(ADLTemperature);
        v.iTemperature = -273;
 
-       if (ADL_OK == adl_od5_temperature_get(sensor->amd_id, 0, &v))
+       if (adl_od5_temperature_get(sensor->amd_id, 0, &v) == ADL_OK)
                return v.iTemperature/1000;
 
        return UNKNOWN_DBL_VALUE;
@@ -91,7 +91,7 @@ static double get_fanspeed(struct psensor *sensor)
        v.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_RPM;
        v.iFanSpeed = -1;
 
-       if (ADL_OK == adl_od5_fanspeed_get(sensor->amd_id, 0, &v))
+       if (adl_od5_fanspeed_get(sensor->amd_id, 0, &v) == ADL_OK)
                return v.iFanSpeed;
 
        return UNKNOWN_DBL_VALUE;
@@ -103,7 +103,7 @@ static double get_usage(struct psensor *sensor)
 
        v.iSize = sizeof(ADLPMActivity);
 
-       if (ADL_OK == adl_od5_currentactivity_get(sensor->amd_id, &v))
+       if (adl_od5_currentactivity_get(sensor->amd_id, &v) == ADL_OK)
                return v.iActivityPercent;
 
        return UNKNOWN_DBL_VALUE;
@@ -152,10 +152,10 @@ static struct psensor *create_sensor(int id, int type, int values_len)
 }
 
 /*
-  Returns the number of active AMD/ATI GPU adapters
-
-  Return 0 if no AMD/ATI GPUs or cannot get information.
-*/
* Returns the number of active AMD/ATI GPU adapters
+ *
* Return 0 if no AMD/ATI GPUs or cannot get information.
+ */
 static int init(void)
 {
        LPAdapterInfo lpadapterinfo;
@@ -200,17 +200,17 @@ static int init(void)
        }
 
        /*
-          1 in 2nd parameter means retrieve adapter information only
-          for adapters that are physically present and enabled in the
-          system
+        * 1 in 2nd parameter means retrieve adapter information only
+        * for adapters that are physically present and enabled in the
+        * system
         */
-       if (ADL_OK != adl_main_control_create(adl_main_memory_alloc, 1)) {
+       if (adl_main_control_create(adl_main_memory_alloc, 1) != ADL_OK) {
                log_err(_("AMD: failed to initialize ADL."));
                return 0;
        }
        adl_main_control_done = 1;
 
-       if (ADL_OK != adl_adapter_numberofadapters_get(&inumberadapters)) {
+       if (adl_adapter_numberofadapters_get(&inumberadapters) != ADL_OK) {
                log_err(_("AMD: cannot get the number of adapters."));
                return 0;
        }
@@ -228,7 +228,7 @@ static int init(void)
 
                iadapterindex = lpadapterinfo[i].iAdapterIndex;
 
-               if (ADL_OK != adl_adapter_active_get(iadapterindex, &lpstatus))
+               if (adl_adapter_active_get(iadapterindex, &lpstatus) != ADL_OK)
                        continue;
                if (lpstatus != ADL_TRUE)
                        continue;
index 65cc9a7..c88e7cf 100644 (file)
@@ -256,7 +256,8 @@ static char *i2str(int i)
        size_t n;
 
        /* second +1 to avoid issue about the conversion of a double
-        * to a lower int */
+        * to a lower int
+        */
        n = 1 + (ceil(log10(INT_MAX)) + 1) + 1;
 
        str = malloc(n);
index 7564d24..4b02c17 100644 (file)
@@ -19,6 +19,6 @@
 #ifndef _P_ARRAY_H_
 #define _P_ARRAY_H_
 
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
 #endif
index 236842a..b84464c 100644 (file)
@@ -282,8 +282,8 @@ struct measure *psensor_get_current_measure(struct psensor *sensor)
 }
 
 /*
-  Returns the minimal value of a given 'type' (SENSOR_TYPE_TEMP or
-  SENSOR_TYPE_FAN)
* Returns the minimal value of a given 'type' (SENSOR_TYPE_TEMP or
* SENSOR_TYPE_FAN)
  */
 static double get_min_value(struct psensor **sensors, int type)
 {
@@ -314,8 +314,8 @@ static double get_min_value(struct psensor **sensors, int type)
 }
 
 /*
-  Returns the maximal value of a given 'type' (SENSOR_TYPE_TEMP or
-  SENSOR_TYPE_FAN)
* Returns the maximal value of a given 'type' (SENSOR_TYPE_TEMP or
* SENSOR_TYPE_FAN)
  */
 double get_max_value(struct psensor **sensors, int type)
 {
index 923b80d..05ca1a1 100644 (file)
@@ -1,27 +1,27 @@
 /*
 Copyright (C) 2010-2014 jeanfi@gmail.com
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU General Public License as
-  published by the Free Software Foundation; either version 2 of the
-  License, or (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-  02110-1301 USA
* Copyright (C) 2010-2016 jeanfi@gmail.com
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
+ *
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
  */
 #include <stdlib.h>
 #include <string.h>
 
 #include <ptime.h>
 
-const int P_TIME_VER = 2;
+const int P_TIME_VER = 3;
 
 static const int ISO8601_TIME_LENGTH = 19; /* YYYY-MM-DDThh:mm:ss */
 static const int ISO8601_DATE_LENGTH = 10; /* YYYY-MM-DD */
index ec52fb0..18a67e7 100644 (file)
@@ -180,7 +180,8 @@ void pxdg_set_autostart(unsigned int enable)
                enable_gnome_autostart(user_desktop);
        } else {
                /* because X-GNOME-Autostart-enabled does not turn off
-                * autostart on all Desktop Envs. */
+                * autostart on all Desktop Envs.
+                */
                remove(user_desktop);
        }
 
index 17bfbd7..bb739bb 100644 (file)
@@ -54,7 +54,8 @@ static GtkSpinButton *w_sensor_low_threshold;
 static GtkListStore *store;
 
 /* 'true' when the notifications of field changes are due to the change
- * of the selected sensor. */
+ * of the selected sensor.
+ */
 static bool ignore_changes;
 
 static struct psensor *get_selected_sensor(void)
index a978929..bb46c2b 100644 (file)
@@ -23,7 +23,7 @@ static const char *ICON = "psensor_normal";
 static const char *ATTENTION_ICON = "psensor_hot";
 
 static GtkStatusIcon *status;
-static unsigned status_attention;
+static unsigned int status_attention;
 
 static void cb_activate(GtkStatusIcon *icon,
                        gpointer data)