]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: fix the verbose compilation warnings for latest gcc
authorJaroslav Kysela <perex@perex.cz>
Wed, 30 Aug 2023 10:35:23 +0000 (12:35 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 30 Aug 2023 10:35:23 +0000 (12:35 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/alsactl.c
alsactl/init_parse.c
alsactl/lock.c
alsactl/monitor.c
alsactl/state.c

index 285144174a6ef66a71eedcde7ed9c778f28c0e6e..a854c0bdc16f331e11b3ec15eb04ba0271dd84d4 100644 (file)
@@ -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;
index e439de7c2ed683707edb03d6cbaff23aaba51965..267db4b3c53aa1b83afc155d243724e5f2ecfd33 100644 (file)
@@ -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;
index 70fb6cfe8b12316bf8841237a04cb03690bb71ef..4927b70cdcb1201fb144a18e55bed9631b86476c 100644 (file)
@@ -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;
 }
index d293c092de72b2490f5e03369e93f551b1c7d3f8..36e9398a4943668756676219c32cfd78c80bede3 100644 (file)
@@ -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;
index 93f38883f80f81faa5c5ad42f5a05279ccb84a8f..88996d4a2c81b0bad3eb9da0810b170c3b2c473b 100644 (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,
-                               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);