From 60bf4bb2af0388841c46eede79224ae0e07fac23 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 30 Aug 2023 12:35:23 +0200 Subject: [PATCH] alsactl: fix the verbose compilation warnings for latest gcc Signed-off-by: Jaroslav Kysela --- alsactl/alsactl.c | 2 +- alsactl/init_parse.c | 17 +++++++++-------- alsactl/lock.c | 2 +- alsactl/monitor.c | 6 +++--- alsactl/state.c | 6 +++--- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index 2851441..a854c0b 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) free(long_option); exit(EXIT_FAILURE); } - for (i = j = k = 0; i < ARRAY_SIZE(args); i++) { + for (i = j = k = 0; i < (int)ARRAY_SIZE(args); i++) { a = &args[i]; if ((a->sarg & 0xff) == 0) continue; diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c index e439de7..267db4b 100644 --- a/alsactl/init_parse.c +++ b/alsactl/init_parse.c @@ -374,7 +374,7 @@ static int set_ctl_value(struct space *space, const char *value, int all) if (pos) *(char *)pos = '\0'; remove_trailing_chars((char *)value, ' '); - items = pos ? pos - value : strlen(value); + items = pos ? (unsigned)(pos - value) : (unsigned)strlen(value); if (items > 1 && value[items-1] == '%') { val = convert_prange1(strtol(value, NULL, 0), snd_ctl_elem_info_get_min(space->ctl_info), snd_ctl_elem_info_get_max(space->ctl_info)); snd_ctl_elem_value_set_integer(space->ctl_value, idx, val); @@ -507,16 +507,16 @@ static int do_match(const char *key, enum key_op op, static int ctl_match(snd_ctl_elem_id_t *pattern, snd_ctl_elem_id_t *id) { - if (snd_ctl_elem_id_get_interface(pattern) != -1 && + if ((int)snd_ctl_elem_id_get_interface(pattern) != -1 && snd_ctl_elem_id_get_interface(pattern) != snd_ctl_elem_id_get_interface(id)) return 0; - if (snd_ctl_elem_id_get_device(pattern) != -1 && + if ((int)snd_ctl_elem_id_get_device(pattern) != -1 && snd_ctl_elem_id_get_device(pattern) != snd_ctl_elem_id_get_device(id)) return 0; - if (snd_ctl_elem_id_get_subdevice(pattern) != -1 && + if ((int)snd_ctl_elem_id_get_subdevice(pattern) != -1 && snd_ctl_elem_id_get_subdevice(pattern) != snd_ctl_elem_id_get_subdevice(id)) return 0; - if (snd_ctl_elem_id_get_index(pattern) != -1 && + if ((int)snd_ctl_elem_id_get_index(pattern) != -1 && snd_ctl_elem_id_get_index(pattern) != snd_ctl_elem_id_get_index(id)) return 0; if (fnmatch(snd_ctl_elem_id_get_name(pattern), snd_ctl_elem_id_get_name(id), 0) != 0) @@ -655,7 +655,7 @@ static const char *elemid_get(struct space *space, const char *attr) goto empty; val = min; dbvalue: - sprintf(res, "%li.%02idB", (long)(val / 100), (int)abs(val % 100)); + sprintf(res, "%li.%02lidB", (long)(val / 100), labs(val % 100)); return res; } if (strncasecmp(attr, "dBmax", 5) == 0) { @@ -1242,7 +1242,8 @@ found: static int run_program1(struct space *space, const char *command0, char *result, - size_t ressize, size_t *reslen, int log) + size_t ressize, size_t *reslen ATTRIBUTE_UNUSED, + int log ATTRIBUTE_UNUSED) { if (strncmp(command0, "__ctl_search", 12) == 0) { const char *res = elemid_get(space, "do_search"); @@ -1284,7 +1285,7 @@ static int conf_name_filter(const struct dirent *d) return ext && !strcmp(ext, ".conf"); } -static int parse_line(struct space *space, char *line, size_t linesize) +static int parse_line(struct space *space, char *line, size_t linesize ATTRIBUTE_UNUSED) { char *linepos; char *key, *value, *attr, *temp; diff --git a/alsactl/lock.c b/alsactl/lock.c index 70fb6cf..4927b70 100644 --- a/alsactl/lock.c +++ b/alsactl/lock.c @@ -37,7 +37,7 @@ static int alarm_flag; -static void signal_handler_alarm(int sig) +static void signal_handler_alarm(int sig ATTRIBUTE_UNUSED) { alarm_flag = 1; } diff --git a/alsactl/monitor.c b/alsactl/monitor.c index d293c09..36e9398 100644 --- a/alsactl/monitor.c +++ b/alsactl/monitor.c @@ -183,7 +183,7 @@ static int check_control_cdev(int infd, bool *retry) } size_t pos = 0; - while (pos < len) { + while (pos < (size_t)len) { ev = (struct inotify_event *)(buf + pos); if ((ev->mask & IN_CREATE) && strstr(ev->name, "controlC") == ev->name) @@ -256,12 +256,12 @@ static int operate_dispatcher(int epfd, uint32_t op, struct epoll_event *epev, err = count; goto end; } - if (count != entry->pfd_count) { + if (count != (int)entry->pfd_count) { err = -EIO; goto end; } - for (i = 0; i < entry->pfd_count; ++i) { + for (i = 0; i < (int)entry->pfd_count; ++i) { err = epoll_ctl(epfd, op, pfds[i].fd, epev); if (err < 0) break; diff --git a/alsactl/state.c b/alsactl/state.c index 93f3888..88996d4 100644 --- a/alsactl/state.c +++ b/alsactl/state.c @@ -1126,7 +1126,7 @@ static int check_comment_range(snd_ctl_t *handle, snd_config_t *conf, } static int restore_config_value(snd_ctl_t *handle, snd_ctl_elem_info_t *info, - snd_ctl_elem_iface_t type, + snd_ctl_elem_type_t type, snd_config_t *value, snd_ctl_elem_value_t *ctl, int idx, int doit) @@ -1175,7 +1175,7 @@ static int restore_config_value(snd_ctl_t *handle, snd_ctl_elem_info_t *info, } static int restore_config_value2(snd_ctl_t *handle, snd_ctl_elem_info_t *info, - snd_ctl_elem_iface_t type, + snd_ctl_elem_type_t type, snd_config_t *value, snd_ctl_elem_value_t *ctl, int idx, unsigned int numid, int doit) @@ -1350,7 +1350,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control, if (err |= numid != numid1 && !force_restore) cerror(doit, "warning: numid mismatch (%d/%d) for control #%d", numid, numid1, numid); - if (err |= iface != iface1) + if (err |= (int)iface != iface1) cerror(doit, "warning: iface mismatch (%d/%d) for control #%d", iface, iface1, numid); if (err |= device != device1) cerror(doit, "warning: device mismatch (%ld/%ld) for control #%d", device, device1, numid);