aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common.h7
-rw-r--r--src/config-ini.c3
-rw-r--r--src/gamma-coopgamma.c18
-rw-r--r--src/gamma-drm.c4
-rw-r--r--src/gamma-dummy.c8
-rw-r--r--src/gamma-randr.c5
-rw-r--r--src/gamma-vidmode.c2
-rw-r--r--src/location-geoclue2.c14
-rw-r--r--src/location-manual.c1
-rw-r--r--src/options.c11
-rw-r--r--src/redshift.c26
-rw-r--r--src/signals.c2
12 files changed, 79 insertions, 22 deletions
diff --git a/src/common.h b/src/common.h
index 3eaf697..83b15e8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -159,7 +159,7 @@ struct options {
typedef struct gamma_state GAMMA_STATE;
struct gamma_method {
- char *name;
+ const char *name;
/* If true, this method will be tried if none is explicitly chosen. */
int autostart;
@@ -187,7 +187,7 @@ struct gamma_method {
typedef struct location_state LOCATION_STATE;
struct location_provider {
- char *name;
+ const char *name;
/* Initialize state. Options can be set between init and start. */
int (*init)(LOCATION_STATE **state);
@@ -225,6 +225,9 @@ LIST_RAMPS_STOP_VALUE_TYPES(X, ;);
int config_ini_init(struct config_ini_state *state, const char *filepath);
void config_ini_free(struct config_ini_state *state);
+#if defined(__GNUC__)
+__attribute__((__pure__))
+#endif
struct config_ini_section *config_ini_get_section(struct config_ini_state *state, const char *name);
diff --git a/src/config-ini.c b/src/config-ini.c
index 24027d4..4cac7e2 100644
--- a/src/config-ini.c
+++ b/src/config-ini.c
@@ -37,7 +37,6 @@ open_config_file(const char *filepath)
*/
if (filepath == NULL) {
- FILE *f = NULL;
char cp[MAX_CONFIG_PATH];
char *env;
@@ -138,8 +137,6 @@ open_config_file(const char *filepath)
f = fopen(cp, "r");
}
#endif
-
- return f;
} else {
f = fopen(filepath, "r");
if (f == NULL) {
diff --git a/src/gamma-coopgamma.c b/src/gamma-coopgamma.c
index 4e579c2..fe01cb5 100644
--- a/src/gamma-coopgamma.c
+++ b/src/gamma-coopgamma.c
@@ -47,13 +47,14 @@ struct gamma_state {
};
-struct signal_blockage {
-};
+struct signal_blockage {int dummy;};
static int
unblocked_signal(int signo, struct signal_blockage *prev)
{
/* TODO */
+ (void) signo;
+ (void) prev;
return 0;
}
@@ -62,6 +63,8 @@ static int
restore_signal_blockage(int signo, const struct signal_blockage *blockage)
{
/* TODO */
+ (void) signo;
+ (void) blockage;
return 0;
}
@@ -150,6 +153,8 @@ coopgamma_start(struct gamma_state *state, enum program_mode mode)
case PROGRAM_MODE_MANUAL:
lifespan = LIBCOOPGAMMA_UNTIL_REMOVAL;
break;
+ case PROGRAM_MODE_CONTINUAL:
+ case PROGRAM_MODE_PRINT: /* TODO ? */
default:
lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
break;
@@ -246,8 +251,15 @@ coopgamma_start(struct gamma_state *state, enum program_mode mode)
crtc->filter.priority = state->priority;
crtc->filter.crtc = state->outputs[i].edid;
- crtc->filter.class = PACKAGE "::redshift::standard";
crtc->filter.lifespan = lifespan;
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
+#endif
+ crtc->filter.class = PACKAGE "::redshift::standard";
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
if (libcoopgamma_get_gamma_info_sync(crtc->filter.crtc, &info, &state->ctx) < 0) {
int saved_errno = errno;
diff --git a/src/gamma-drm.c b/src/gamma-drm.c
index e912f85..8c7bcec 100644
--- a/src/gamma-drm.c
+++ b/src/gamma-drm.c
@@ -73,6 +73,8 @@ drm_start(struct gamma_state *state, enum program_mode mode)
int crtc_count;
struct drm_crtc_state *crtcs;
+ (void) mode;
+
sprintf(pathname, DRM_DEV_NAME, DRM_DIR_NAME, state->card_num);
state->fd = open(pathname, O_RDWR | O_CLOEXEC);
@@ -267,6 +269,8 @@ drm_set_temperature(
uint16_t value;
uint32_t i, ramp_size;
+ (void) preserve; /* TODO */
+
for (; crtcs->crtc_num >= 0; crtcs++) {
if (crtcs->gamma_size <= 1)
continue;
diff --git a/src/gamma-dummy.c b/src/gamma-dummy.c
index d87c2dd..d01044d 100644
--- a/src/gamma-dummy.c
+++ b/src/gamma-dummy.c
@@ -29,6 +29,8 @@ gamma_dummy_init(struct gamma_state **state)
static int
gamma_dummy_start(struct gamma_state *state, enum program_mode mode)
{
+ (void) state;
+ (void) mode;
fputs(_("WARNING: Using dummy gamma method! Display will not be affected by this gamma method.\n"), stderr);
return 0;
}
@@ -36,11 +38,13 @@ gamma_dummy_start(struct gamma_state *state, enum program_mode mode)
static void
gamma_dummy_restore(struct gamma_state *state)
{
+ (void) state;
}
static void
gamma_dummy_free(struct gamma_state *state)
{
+ (void) state;
}
static void
@@ -53,6 +57,8 @@ gamma_dummy_print_help(FILE *f)
static int
gamma_dummy_set_option(struct gamma_state *state, const char *key, const char *value)
{
+ (void) state;
+ (void) value;
fprintf(stderr, _("Unknown method parameter: `%s'.\n"), key);
return -1;
}
@@ -61,6 +67,8 @@ static int
gamma_dummy_set_temperature(
struct gamma_state *state, const struct color_setting *setting, int preserve)
{
+ (void) state;
+ (void) preserve;
printf(_("Temperature: %i\n"), setting->temperature);
return 0;
}
diff --git a/src/gamma-randr.c b/src/gamma-randr.c
index 9bbb807..6c00625 100644
--- a/src/gamma-randr.c
+++ b/src/gamma-randr.c
@@ -21,6 +21,9 @@
#include <xcb/xcb.h>
#include <xcb/randr.h>
+#if defined(__GNUC__)
+# pragma GCC diagnostic ignored "-Waggregate-return"
+#endif
#define RANDR_VERSION_MAJOR 1
@@ -109,6 +112,8 @@ randr_start(struct gamma_state *state, enum program_mode mode)
xcb_randr_get_screen_resources_current_reply_t *res_reply;
xcb_randr_crtc_t *crtcs;
+ (void) mode;
+
screen_num = state->screen_num;
if (screen_num < 0) screen_num = state->preferred_screen;
diff --git a/src/gamma-vidmode.c b/src/gamma-vidmode.c
index f88925a..b462480 100644
--- a/src/gamma-vidmode.c
+++ b/src/gamma-vidmode.c
@@ -61,6 +61,8 @@ vidmode_start(struct gamma_state *state, enum program_mode mode)
int major, minor;
uint16_t *gamma_r, *gamma_g, *gamma_b;
+ (void) mode;
+
if (screen_num < 0) screen_num = DefaultScreen(state->display);
state->screen_num = screen_num;
diff --git a/src/location-geoclue2.c b/src/location-geoclue2.c
index 773e99d..a60867b 100644
--- a/src/location-geoclue2.c
+++ b/src/location-geoclue2.c
@@ -40,7 +40,7 @@ struct location_state {
/* Print the message explaining denial from GeoClue. */
static void
-print_denial_message()
+print_denial_message(void)
{
g_printerr(_(
"Access to the current location was denied by GeoClue!\n"
@@ -75,6 +75,8 @@ geoclue_client_signal_cb(GDBusProxy *client, gchar *sender_name,
GError *error;
GVariant *lat_v, *lon_v;
+ (void) sender_name;
+
/* Only handle LocationUpdated signals */
if (g_strcmp0(signal_name, "LocationUpdated") != 0) {
return;
@@ -130,6 +132,9 @@ on_name_appeared(GDBusConnection *conn, const gchar *name,
GError *error;
GVariant *ret_v;
+ (void) name;
+ (void) name_owner;
+
/* Obtain GeoClue Manager */
error = NULL;
geoclue_manager = g_dbus_proxy_new_sync(
@@ -270,6 +275,9 @@ on_name_vanished(GDBusConnection *connection, const gchar *name,
{
struct location_state *state = user_data;
+ (void) connection;
+ (void) name;
+
g_mutex_lock(&state->lock);
state->available = 0;
@@ -286,6 +294,8 @@ on_pipe_closed(GIOChannel *channel, GIOCondition condition, gpointer user_data)
struct location_state *state = user_data;
g_main_loop_quit(state->loop);
+ (void) channel;
+ (void) condition;
return FALSE;
}
@@ -400,6 +410,8 @@ static int
location_geoclue2_set_option(struct location_state *state,
const char *key, const char *value)
{
+ (void) state;
+ (void) value;
fprintf(stderr, _("Unknown method parameter: `%s'.\n"), key);
return -1;
}
diff --git a/src/location-manual.c b/src/location-manual.c
index 1a9b044..368076b 100644
--- a/src/location-manual.c
+++ b/src/location-manual.c
@@ -101,6 +101,7 @@ location_manual_set_option(struct location_state *state, const char *key,
static int
location_manual_get_fd(struct location_state *state)
{
+ (void) state;
return -1;
}
diff --git a/src/options.c b/src/options.c
index 95cb636..5e4ba4e 100644
--- a/src/options.c
+++ b/src/options.c
@@ -82,11 +82,11 @@ parse_gamma_string(const char *str, double gamma[3])
static int
parse_transition_time(const char *str, const char **end)
{
- const char *min = NULL;
+ char *min = NULL;
long hours, minutes;
errno = 0;
- hours = strtol(str, (char **)&min, 10);
+ hours = strtol(str, (void *)&min, 10);
if (errno != 0 || min == str || min[0] != ':' ||
hours < 0 || hours >= 24) {
return -1;
@@ -94,7 +94,7 @@ parse_transition_time(const char *str, const char **end)
min += 1;
errno = 0;
- minutes = strtol(min, (char **)end, 10);
+ minutes = strtol(min, (void *)end, 10);
if (errno != 0 || *end == min || minutes < 0 || minutes >= 60) {
return -1;
}
@@ -317,7 +317,7 @@ parse_command_line_option(
int r;
char *s;
char *end;
- char *provider_name;
+ const char *provider_name;
switch (option) {
case 'b':
@@ -377,8 +377,7 @@ parse_command_line_option(
}
/* Lookup provider from name. */
- options->provider = find_location_provider(
- location_providers, provider_name);
+ options->provider = find_location_provider(location_providers, provider_name);
if (options->provider == NULL) {
fprintf(stderr, _("Unknown location provider `%s'.\n"),
provider_name);
diff --git a/src/redshift.c b/src/redshift.c
index bbbb30b..bb01449 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -73,6 +73,20 @@ static const char *period_names[] = {
};
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+static int
+exact_eq(double a, double b)
+{
+ return a == b;
+}
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
+
+
/* Determine which period we are currently in based on time offset. */
static enum period
get_period_from_time(const struct transition_scheme *transition, int time_offset)
@@ -733,13 +747,11 @@ run_continual_mode(const struct location_provider *provider,
if (done && fade_length == 0) break;
if (verbose) {
- if (prev_target_interp.temperature !=
- target_interp.temperature) {
+ if (prev_target_interp.temperature != target_interp.temperature) {
printf(_("Color temperature: %uK\n"),
target_interp.temperature);
}
- if (prev_target_interp.brightness !=
- target_interp.brightness) {
+ if (!exact_eq(prev_target_interp.brightness, target_interp.brightness)) {
printf(_("Brightness: %.2f\n"),
target_interp.brightness);
}
@@ -773,7 +785,7 @@ run_continual_mode(const struct location_provider *provider,
if (loc_fd >= 0) {
struct pollfd pollfds[1];
struct location new_loc;
- int r, new_available;
+ int new_available;
/* Provider is dynamic. */
pollfds[0].fd = loc_fd;
@@ -809,8 +821,8 @@ run_continual_mode(const struct location_provider *provider,
}
if (new_available &&
- (new_loc.lat != loc.lat ||
- new_loc.lon != loc.lon ||
+ (!exact_eq(new_loc.lat, loc.lat) ||
+ !exact_eq(new_loc.lon, loc.lon) ||
new_available != location_available)) {
loc = new_loc;
print_location(&loc);
diff --git a/src/signals.c b/src/signals.c
index 8c07b97..a502be9 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -31,6 +31,7 @@ static void
sigexit(int signo)
{
exiting = 1;
+ (void) signo;
}
/* Signal handler for disable signal */
@@ -38,6 +39,7 @@ static void
sigdisable(int signo)
{
disable = 1;
+ (void) signo;
}
#else