diff options
author | Mattias Andrée <maandree@kth.se> | 2016-12-01 03:23:03 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-12-01 03:23:03 +0100 |
commit | 9ecf9c624c5272cf8d576ec173283ebfe72fd373 (patch) | |
tree | 8e098894b688a45144a6e7de81b97959490f0785 /src | |
parent | Add makefile (diff) | |
download | cg-tools-9ecf9c624c5272cf8d576ec173283ebfe72fd373.tar.gz cg-tools-9ecf9c624c5272cf8d576ec173283ebfe72fd373.tar.bz2 cg-tools-9ecf9c624c5272cf8d576ec173283ebfe72fd373.tar.xz |
Fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | src/cg-base.c | 5 | ||||
-rw-r--r-- | src/cg-base.h | 2 | ||||
-rw-r--r-- | src/cg-brilliance.c | 6 | ||||
-rw-r--r-- | src/cg-darkroom.c | 9 | ||||
-rw-r--r-- | src/cg-gamma.c | 8 | ||||
-rw-r--r-- | src/cg-icc.c | 24 | ||||
-rw-r--r-- | src/cg-limits.c | 6 | ||||
-rw-r--r-- | src/cg-negative.c | 5 | ||||
-rw-r--r-- | src/cg-query.c | 7 | ||||
-rw-r--r-- | src/cg-rainbow.c | 8 | ||||
-rw-r--r-- | src/cg-remove.c | 5 | ||||
-rw-r--r-- | src/cg-sleepmode.c | 7 |
12 files changed, 42 insertions, 50 deletions
diff --git a/src/cg-base.c b/src/cg-base.c index 24bc09f..e62f178 100644 --- a/src/cg-base.c +++ b/src/cg-base.c @@ -15,9 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include "cg-base.h" #include <libclut.h> @@ -416,7 +413,7 @@ static int get_crtc_info(void) { size_t i, unsynced = 0, selected; char* synced; - int saved_errno, need_flush = 0; + int need_flush = 0; struct pollfd pollfd; synced = alloca(crtcs_n * sizeof(*synced)); diff --git a/src/cg-base.h b/src/cg-base.h index 269f2a3..8d39f4a 100644 --- a/src/cg-base.h +++ b/src/cg-base.h @@ -132,7 +132,7 @@ extern const int64_t default_priority; /** * The default class for the program */ -extern char* const default_class; +extern char default_class[]; diff --git a/src/cg-brilliance.c b/src/cg-brilliance.c index 16b406a..0e631d0 100644 --- a/src/cg-brilliance.c +++ b/src/cg-brilliance.c @@ -35,7 +35,7 @@ const int64_t default_priority = ((int64_t)1) << 61; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-brilliance::standard"; +char default_class[] = PKGNAME "::cg-brilliance::standard"; @@ -114,6 +114,7 @@ int handle_opt(char* opt, char* arg) else usage(); return 0; + (void) arg; } @@ -129,7 +130,7 @@ static int parse_double(double* restrict out, const char* restrict str) char* end; errno = 0; *out = strtod(str, &end); - if (errno || (out < 0) || isinf(*out) || isnan(*out) || *end) + if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end) return -1; if (!strchr("0123456789.", *str)) return -1; @@ -184,6 +185,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, usage(); } return 0; + (void) site; } diff --git a/src/cg-darkroom.c b/src/cg-darkroom.c index 8dd92f8..bd677c7 100644 --- a/src/cg-darkroom.c +++ b/src/cg-darkroom.c @@ -35,7 +35,7 @@ const int64_t default_priority = ((int64_t)3) << 61; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-darkroom::standard"; +char default_class[] = PKGNAME "::cg-darkroom::standard"; @@ -104,6 +104,7 @@ int handle_opt(char* opt, char* arg) else usage(); return 0; + (void) arg; } @@ -119,7 +120,7 @@ static int parse_double(double* restrict out, const char* restrict str) char* end; errno = 0; *out = strtod(str, &end); - if (errno || (out < 0) || isinf(*out) || isnan(*out) || *end) + if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end) return -1; if (!strchr("0123456789.", *str)) return -1; @@ -143,9 +144,6 @@ static int parse_double(double* restrict out, const char* restrict str) int handle_args(int argc, char* argv[], char* method, char* site, char** crtcs, char* prio, char* rule) { - char* red; - char* green; - char* blue; int q = xflag + dflag; q += (method != NULL) && !strcmp(method, "?"); q += (prio != NULL) && !strcmp(prio, "?"); @@ -162,6 +160,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, else if (argc) usage(); return 0; + (void) site; } diff --git a/src/cg-gamma.c b/src/cg-gamma.c index 8f4a361..b8df95d 100644 --- a/src/cg-gamma.c +++ b/src/cg-gamma.c @@ -15,9 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include "cg-base.h" #include <libclut.h> @@ -41,7 +38,7 @@ const int64_t default_priority = 0; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-gamma::standard"; +char default_class[] = PKGNAME "::cg-gamma::standard"; @@ -218,7 +215,7 @@ static int parse_double(double* restrict out, const char* restrict str) char* end; errno = 0; *out = strtod(str, &end); - if (errno || (out < 0) || isinf(*out) || isnan(*out) || *end) + if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end) return -1; if (!strchr("0123456789.", *str)) return -1; @@ -432,6 +429,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, free(fflag), fflag = NULL; errno = saved_errno; return cleanup(-1); + (void) site; } diff --git a/src/cg-icc.c b/src/cg-icc.c index a3e48cd..9396b71 100644 --- a/src/cg-icc.c +++ b/src/cg-icc.c @@ -61,7 +61,7 @@ const int64_t default_priority = 0; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-icc::standard"; +char default_class[] = PKGNAME "::cg-icc::standard"; @@ -196,6 +196,7 @@ int handle_opt(char* opt, char* arg) usage(); } return 0; + (void) arg; } @@ -326,7 +327,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, { struct passwd* pw; char* path = NULL; - int free_fflag = 0, saved_errno; + int saved_errno; int fd = -1, q = xflag + dflag; q += (method != NULL) && !strcmp(method, "?"); q += (prio != NULL) && !strcmp(prio, "?"); @@ -374,6 +375,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, close(fd); errno = saved_errno; return cleanup(-1); + (void) site; } @@ -669,15 +671,15 @@ static int parse_icc(const char* restrict content, size_t n, libcoopgamma_ramps_ /* Get the gamma, brightness and contrast */ if (n - ptr < 9 * 4) continue; - r_gamma = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - r_min = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - r_max = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - g_gamma = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - g_min = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - g_max = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - b_gamma = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - b_min = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; - b_max = (double)icc_uint32(content + ptr) / 65536L, ptr += 4; + r_gamma = icc_uint32(content + ptr), r_gamma /= 65536L, ptr += 4; + r_min = icc_uint32(content + ptr), r_min /= 65536L, ptr += 4; + r_max = icc_uint32(content + ptr), r_max /= 65536L, ptr += 4; + g_gamma = icc_uint32(content + ptr), g_gamma /= 65536L, ptr += 4; + g_min = icc_uint32(content + ptr), g_min /= 65536L, ptr += 4; + g_max = icc_uint32(content + ptr), g_max /= 65536L, ptr += 4; + b_gamma = icc_uint32(content + ptr), b_gamma /= 65536L, ptr += 4; + b_min = icc_uint32(content + ptr), b_min /= 65536L, ptr += 4; + b_max = icc_uint32(content + ptr), b_max /= 65536L, ptr += 4; /* Initialise ramps */ *depth = LIBCOOPGAMMA_DOUBLE; diff --git a/src/cg-limits.c b/src/cg-limits.c index b3a7ed7..6a071c7 100644 --- a/src/cg-limits.c +++ b/src/cg-limits.c @@ -15,9 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include "cg-base.h" #include <libclut.h> @@ -41,7 +38,7 @@ const int64_t default_priority = -(((int64_t)1) << 62); /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-limits::standard"; +char default_class[] = PKGNAME "::cg-limits::standard"; @@ -562,6 +559,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, free(Cflag), Cflag = NULL; errno = saved_errno; return cleanup(-1); + (void) site; } diff --git a/src/cg-negative.c b/src/cg-negative.c index ef61752..106c15c 100644 --- a/src/cg-negative.c +++ b/src/cg-negative.c @@ -35,7 +35,7 @@ const int64_t default_priority = ((int64_t)1) << 62; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-negative::standard"; +char default_class[] = PKGNAME "::cg-negative::standard"; @@ -132,6 +132,7 @@ int handle_opt(char* opt, char* arg) usage(); } return 0; + (void) arg; } @@ -160,6 +161,8 @@ int handle_args(int argc, char* argv[], char* method, char* site, if (argc || (q > 1) || (xflag && (prio != NULL))) usage(); return 0; + (void) argv; + (void) site; } diff --git a/src/cg-query.c b/src/cg-query.c index 881b6bf..254945d 100644 --- a/src/cg-query.c +++ b/src/cg-query.c @@ -15,9 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include "arg.h" #include <libcoopgamma.h> @@ -51,7 +48,7 @@ static char* class = NULL; /** * Print usage information and exit */ -void usage(void) +static void usage(void) { fprintf(stderr, "Usage: %s [-M method] [-S site] [-h high] [-l low] [-f class] -c crtc\n", @@ -148,7 +145,7 @@ static int print_info(void) { libcoopgamma_crtc_info_t info; libcoopgamma_filter_table_t table; - char* str; + const char* str; int saved_errno, ret = 0; size_t i; diff --git a/src/cg-rainbow.c b/src/cg-rainbow.c index b60c860..35f9619 100644 --- a/src/cg-rainbow.c +++ b/src/cg-rainbow.c @@ -15,8 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE #include "cg-base.h" #include <libclut.h> @@ -40,7 +38,7 @@ const int64_t default_priority = ((int64_t)1) << 60; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-rainbow::standard"; +char default_class[] = PKGNAME "::cg-rainbow::standard"; @@ -127,7 +125,7 @@ static int parse_double(double* restrict out, const char* restrict str) char* end; errno = 0; *out = strtod(str, &end); - if (errno || (out < 0) || isinf(*out) || isnan(*out) || *end) + if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end) return -1; if (!strchr("0123456789.", *str)) return -1; @@ -171,6 +169,8 @@ int handle_args(int argc, char* argv[], char* method, char* site, usage(); } return 0; + (void) site; + (void) argv; } diff --git a/src/cg-remove.c b/src/cg-remove.c index 065e6eb..bde0855 100644 --- a/src/cg-remove.c +++ b/src/cg-remove.c @@ -15,9 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include "arg.h" #include <libcoopgamma.h> @@ -42,7 +39,7 @@ static libcoopgamma_context_t cg; /** * Print usage information and exit */ -void usage(void) +static void usage(void) { fprintf(stderr, "Usage: %s [-M method] [-S site] [-c crtc]... class...\n", diff --git a/src/cg-sleepmode.c b/src/cg-sleepmode.c index bfb88a0..bfa719a 100644 --- a/src/cg-sleepmode.c +++ b/src/cg-sleepmode.c @@ -15,8 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE #include "cg-base.h" #include <libclut.h> @@ -43,7 +41,7 @@ const int64_t default_priority = ((int64_t)3) << 59; /** * The default class for the program */ -char* const default_class = PKGNAME "::cg-sleepmode::standard"; +char default_class[] = PKGNAME "::cg-sleepmode::standard"; @@ -178,7 +176,7 @@ static int parse_double(double* restrict out, const char* restrict str) char* end; errno = 0; *out = strtod(str, &end); - if (errno || (out < 0) || isinf(*out) || isnan(*out) || *end) + if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end) return -1; if (!strchr("0123456789.", *str)) return -1; @@ -235,6 +233,7 @@ int handle_args(int argc, char* argv[], char* method, char* site, if (blue_target >= 1) blue_time = 0; return 0; + (void) site; } |