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 */
#include <cfg.h>
#include <graph.h>
+#include <parray.h>
#include <plog.h>
#include <psensor.h>
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,
/* 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) {
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;
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;
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;
}
/*
- 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;
}
/*
- 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;
}
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;
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);
#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
}
/*
- 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)
{
}
/*
- 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)
{
/*
- 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 */
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);
}
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)
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)