alsactl: fix the verbose compilation warnings for latest gcc

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2023-08-30 12:35:23 +02:00
parent bf477bbb6d
commit 60bf4bb2af
5 changed files with 17 additions and 16 deletions

View file

@ -271,7 +271,7 @@ int main(int argc, char *argv[])
free(long_option); free(long_option);
exit(EXIT_FAILURE); 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]; a = &args[i];
if ((a->sarg & 0xff) == 0) if ((a->sarg & 0xff) == 0)
continue; continue;

View file

@ -374,7 +374,7 @@ static int set_ctl_value(struct space *space, const char *value, int all)
if (pos) if (pos)
*(char *)pos = '\0'; *(char *)pos = '\0';
remove_trailing_chars((char *)value, ' '); 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] == '%') { 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)); 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); 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) 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)) snd_ctl_elem_id_get_interface(pattern) != snd_ctl_elem_id_get_interface(id))
return 0; 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)) snd_ctl_elem_id_get_device(pattern) != snd_ctl_elem_id_get_device(id))
return 0; 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)) snd_ctl_elem_id_get_subdevice(pattern) != snd_ctl_elem_id_get_subdevice(id))
return 0; 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)) snd_ctl_elem_id_get_index(pattern) != snd_ctl_elem_id_get_index(id))
return 0; return 0;
if (fnmatch(snd_ctl_elem_id_get_name(pattern), snd_ctl_elem_id_get_name(id), 0) != 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; goto empty;
val = min; val = min;
dbvalue: dbvalue:
sprintf(res, "%li.%02idB", (long)(val / 100), (int)abs(val % 100)); sprintf(res, "%li.%02lidB", (long)(val / 100), labs(val % 100));
return res; return res;
} }
if (strncasecmp(attr, "dBmax", 5) == 0) { if (strncasecmp(attr, "dBmax", 5) == 0) {
@ -1242,7 +1242,8 @@ found:
static static
int run_program1(struct space *space, int run_program1(struct space *space,
const char *command0, char *result, 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) { if (strncmp(command0, "__ctl_search", 12) == 0) {
const char *res = elemid_get(space, "do_search"); 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"); 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 *linepos;
char *key, *value, *attr, *temp; char *key, *value, *attr, *temp;

View file

@ -37,7 +37,7 @@
static int alarm_flag; static int alarm_flag;
static void signal_handler_alarm(int sig) static void signal_handler_alarm(int sig ATTRIBUTE_UNUSED)
{ {
alarm_flag = 1; alarm_flag = 1;
} }

View file

@ -183,7 +183,7 @@ static int check_control_cdev(int infd, bool *retry)
} }
size_t pos = 0; size_t pos = 0;
while (pos < len) { while (pos < (size_t)len) {
ev = (struct inotify_event *)(buf + pos); ev = (struct inotify_event *)(buf + pos);
if ((ev->mask & IN_CREATE) && if ((ev->mask & IN_CREATE) &&
strstr(ev->name, "controlC") == ev->name) 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; err = count;
goto end; goto end;
} }
if (count != entry->pfd_count) { if (count != (int)entry->pfd_count) {
err = -EIO; err = -EIO;
goto end; 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); err = epoll_ctl(epfd, op, pfds[i].fd, epev);
if (err < 0) if (err < 0)
break; break;

View file

@ -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, 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_config_t *value,
snd_ctl_elem_value_t *ctl, int idx, snd_ctl_elem_value_t *ctl, int idx,
int doit) 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, 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_config_t *value,
snd_ctl_elem_value_t *ctl, int idx, snd_ctl_elem_value_t *ctl, int idx,
unsigned int numid, int doit) 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) if (err |= numid != numid1 && !force_restore)
cerror(doit, "warning: numid mismatch (%d/%d) for control #%d", cerror(doit, "warning: numid mismatch (%d/%d) for control #%d",
numid, numid1, numid); 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); cerror(doit, "warning: iface mismatch (%d/%d) for control #%d", iface, iface1, numid);
if (err |= device != device1) if (err |= device != device1)
cerror(doit, "warning: device mismatch (%ld/%ld) for control #%d", device, device1, numid); cerror(doit, "warning: device mismatch (%ld/%ld) for control #%d", device, device1, numid);