From 6148063f860bf23d970199fd74a9efdf547be834 Mon Sep 17 00:00:00 2001 From: zhuyaliang <15132211195@163.com> Date: Sat, 22 Apr 2023 12:56:21 +0800 Subject: Fix Compilation Warning --- plugins/i2c-sys/i2c-sys-plugin.c | 2 -- plugins/i8k/i8k-plugin.c | 1 + plugins/ibm-acpi/ibm-acpi-plugin.c | 4 +++- plugins/libsensors/libsensors-plugin.c | 3 +-- plugins/pmu-sys/pmu-sys-plugin.c | 2 ++ plugins/smu-sys/smu-sys-plugin.c | 3 ++- plugins/sonypi/sonypi-plugin.c | 2 ++ sensors-applet/active-sensor.c | 5 ++--- sensors-applet/prefs-dialog.c | 1 + sensors-applet/sensor-config-dialog.c | 3 --- sensors-applet/sensors-applet-plugin.h | 2 ++ sensors-applet/sensors-applet.c | 2 +- 12 files changed, 17 insertions(+), 13 deletions(-) diff --git a/plugins/i2c-sys/i2c-sys-plugin.c b/plugins/i2c-sys/i2c-sys-plugin.c index b39ede4..72e2aee 100644 --- a/plugins/i2c-sys/i2c-sys-plugin.c +++ b/plugins/i2c-sys/i2c-sys-plugin.c @@ -92,8 +92,6 @@ static void i2c_sys_plugin_add_sensor(GList **sensors, const gchar *path) { /* SHOULDN'T BE ABLE * TO GET HERE!! */ g_warning("filename:\"%s\" begins with a charater that is not covered by this switch statement... not adding sensor", filename); g_free(filename); - g_free(id); - g_free(label); return; } diff --git a/plugins/i8k/i8k-plugin.c b/plugins/i8k/i8k-plugin.c index 826c7bd..b675b1d 100644 --- a/plugins/i8k/i8k-plugin.c +++ b/plugins/i8k/i8k-plugin.c @@ -81,6 +81,7 @@ static GList *i8k_plugin_init(void) { return sensors; } +static gdouble i8k_plugin_get_sensor_value(const gchar *path, const gchar *id, SensorType type, diff --git a/plugins/ibm-acpi/ibm-acpi-plugin.c b/plugins/ibm-acpi/ibm-acpi-plugin.c index 9bf3615..285ff86 100644 --- a/plugins/ibm-acpi/ibm-acpi-plugin.c +++ b/plugins/ibm-acpi/ibm-acpi-plugin.c @@ -129,6 +129,7 @@ static void ibm_acpi_plugin_setup_manually(GList **sensors) { } /* to be called externally to setup for ibm_acpi sensors */ +static GList *ibm_acpi_plugin_init(void) { GList *sensors = NULL; @@ -137,6 +138,7 @@ GList *ibm_acpi_plugin_init(void) { return sensors; } +static gdouble ibm_acpi_plugin_get_sensor_value(const gchar *path, const gchar *id, SensorType type, @@ -144,7 +146,7 @@ gdouble ibm_acpi_plugin_get_sensor_value(const gchar *path, /* to open and access the value of each sensor */ FILE *fp; - gint sensor_value; + gint sensor_value = 0; gint cpu_temp, minipci_temp, hdd_temp, gpu_temp, bat0_temp, bat1_temp, unknown0, unknown1; gint fan_speed; diff --git a/plugins/libsensors/libsensors-plugin.c b/plugins/libsensors/libsensors-plugin.c index b95b888..ebe8b02 100644 --- a/plugins/libsensors/libsensors-plugin.c +++ b/plugins/libsensors/libsensors-plugin.c @@ -230,11 +230,11 @@ static void check_sensor_with_data(GList **sensors, static GList *libsensors_plugin_get_sensors(void) { const sensors_chip_name *chip_name; - int i; GList *sensors = NULL; #if SENSORS_API_VERSION < 0x400 FILE *file; + int i; g_debug("%s: using libsensors version < 4", __FUNCTION__); /* try to open config file, otherwise try alternate config @@ -281,7 +281,6 @@ static GList *libsensors_plugin_get_sensors(void) { return sensors; } - i = 0; while ((chip_name = sensors_get_detected_chips(NULL, &nr))) { char *chip_name_string, *label; diff --git a/plugins/pmu-sys/pmu-sys-plugin.c b/plugins/pmu-sys/pmu-sys-plugin.c index 5a47aea..46f8f2b 100644 --- a/plugins/pmu-sys/pmu-sys-plugin.c +++ b/plugins/pmu-sys/pmu-sys-plugin.c @@ -116,6 +116,7 @@ static void pmu_sys_plugin_test_sensor(GList **sensors, const gchar *path) { } /* to be called to setup for sys sensors */ +static GList *pmu_sys_plugin_init(void) { GList *sensors = NULL; /* call function to recursively look for sensors @@ -127,6 +128,7 @@ GList *pmu_sys_plugin_init(void) { /* returns the value of the sensor_list at the given iter, or if an error occurs, instatiates error with an error message */ +static gdouble pmu_sys_plugin_get_sensor_value(const gchar *path, const gchar *id, SensorType type, diff --git a/plugins/smu-sys/smu-sys-plugin.c b/plugins/smu-sys/smu-sys-plugin.c index f5940fd..d9e530d 100644 --- a/plugins/smu-sys/smu-sys-plugin.c +++ b/plugins/smu-sys/smu-sys-plugin.c @@ -108,7 +108,7 @@ static void smu_sys_plugin_test_sensor(GList **sensors, const gchar *path) { } /* to be called to setup for sys sensors */ -GList *smu_sys_plugin_init(void) { +static GList *smu_sys_plugin_init(void) { GList *sensors = NULL; /* call function to recursively look for sensors @@ -120,6 +120,7 @@ GList *smu_sys_plugin_init(void) { /* returns the value of the sensor_list at the given iter, or if an error occurs, instatiates error with an error message */ +static gdouble smu_sys_plugin_get_sensor_value(const gchar *path, const gchar *id, SensorType type, diff --git a/plugins/sonypi/sonypi-plugin.c b/plugins/sonypi/sonypi-plugin.c index 8a69cf4..64a0c8c 100644 --- a/plugins/sonypi/sonypi-plugin.c +++ b/plugins/sonypi/sonypi-plugin.c @@ -52,6 +52,7 @@ enum { SONYPI_DEVICE_FILE_READ_ERROR }; +static GList *sonypi_plugin_init(void) { int fd; GList *sensors = NULL; @@ -71,6 +72,7 @@ GList *sonypi_plugin_init(void) { return sensors; } +static gdouble sonypi_plugin_get_sensor_value(const gchar *path, const gchar *id, SensorType type, diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c index d273b1b..fdd10c3 100644 --- a/sensors-applet/active-sensor.c +++ b/sensors-applet/active-sensor.c @@ -261,7 +261,7 @@ static void active_sensor_update_graph(ActiveSensor *as, cairo_t *cr) { GtkAllocation allocation; gdouble line_height; gdouble width, height; - gdouble x, y; + gdouble x = 0.0, y = 0.0; cairo_pattern_t *pattern; gint i; @@ -344,6 +344,7 @@ void active_sensor_destroy(ActiveSensor *active_sensor) { g_free(active_sensor); } +static gboolean graph_draw_cb(GtkWidget *graph, cairo_t *cr, gpointer data) { @@ -502,7 +503,6 @@ void active_sensor_update(ActiveSensor *active_sensor, GdkPixbuf *icon_pixbuf; gchar *graph_color; gint label_min_width; - gint label_width; GtkRequisition req; /* to build the list of labels as we go */ @@ -727,7 +727,6 @@ void active_sensor_update(ActiveSensor *active_sensor, gtk_label_set_markup(GTK_LABEL(active_sensor->value), value_text); gtk_widget_get_preferred_size (GTK_WIDGET (active_sensor->value), &req, NULL); - label_width = MAX(req.width, label_min_width); gtk_widget_set_size_request (GTK_WIDGET (active_sensor->value), label_min_width, req.height); if (tooltip) { diff --git a/sensors-applet/prefs-dialog.c b/sensors-applet/prefs-dialog.c index 58b839d..20db2ec 100644 --- a/sensors-applet/prefs-dialog.c +++ b/sensors-applet/prefs-dialog.c @@ -50,6 +50,7 @@ void prefs_dialog_close(SensorsApplet *sensors_applet) { } +static void prefs_dialog_response(GtkDialog *prefs_dialog, gint response, gpointer data) { diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c index ecf27b5..7a85d1b 100644 --- a/sensors-applet/sensor-config-dialog.c +++ b/sensors-applet/sensor-config-dialog.c @@ -73,11 +73,8 @@ static void sensor_config_dialog_response(GtkDialog *dialog, gint response, gpointer data) { - SensorConfigDialog *config_dialog; GError *error = NULL; - config_dialog = (SensorConfigDialog *)data; - switch (response) { case GTK_RESPONSE_HELP: g_debug("loading help in config dialog"); diff --git a/sensors-applet/sensors-applet-plugin.h b/sensors-applet/sensors-applet-plugin.h index 5f48b48..cde21ba 100644 --- a/sensors-applet/sensors-applet-plugin.h +++ b/sensors-applet/sensors-applet-plugin.h @@ -37,6 +37,8 @@ gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, SensorType type, GError **error); +const gchar *sensors_applet_plugin_name(void); + typedef void SensorsAppletPluginTestSensorFunc(GList **sensors, const gchar *path); void sensors_applet_plugin_find_sensors(GList **sensors, diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c index b680836..93c8617 100644 --- a/sensors-applet/sensors-applet.c +++ b/sensors-applet/sensors-applet.c @@ -450,7 +450,7 @@ static void sensors_applet_pack_display(SensorsApplet *sensors_applet) { /* note the if () around each widget is to ensure we only * operate on those that actually exist */ GtkLabel *no_sensors_enabled_label = NULL; - gint num_active_sensors = 0, num_sensors_per_group, rows, cols, i, j; + gint num_active_sensors = 0, num_sensors_per_group = 0, rows, cols, i, j; GList *old_grid_children = NULL; GList *current_sensor; -- cgit v1.2.1