]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsaloop: fix the verbose compilation warnings for latest gcc
authorJaroslav Kysela <perex@perex.cz>
Wed, 30 Aug 2023 10:36:15 +0000 (12:36 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 30 Aug 2023 10:36:15 +0000 (12:36 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsaloop/alsaloop.c
alsaloop/control.c
alsaloop/pcmjob.c

index e0f8642bbd8de10cd555587bc7f08c2061c29f56..17cb00c8abfedfc77137c99e45dc7503e8538d6b 100644 (file)
@@ -404,7 +404,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
        snd_pcm_uframes_t arg_period_size = 0;
        unsigned long arg_loop_time = ~0UL;
        int arg_nblock = 0;
-       int arg_effect = 0;
+       // int arg_effect = 0;
        int arg_resample = 0;
 #ifdef USE_SAMPLERATE
        int arg_samplerate = SRC_SINC_FASTEST + 1;
@@ -492,7 +492,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
                        arg_nblock = 1;
                        break;
                case 'e':
-                       arg_effect = 1;
+                       // arg_effect = 1;
                        break;
                case 'n':
                        arg_resample = 1;
@@ -820,7 +820,7 @@ static void send_to_all(int sig)
        }
 }
 
-static void signal_handler(int sig)
+static void signal_handler(int)
 {
        quit = 1;
        send_to_all(SIGUSR2);
index ba891fdbce4f983930d0ac42dab7f6f8b90e6212..137d481902cd4b22c71602b9c7315c5e9030f661 100644 (file)
@@ -187,8 +187,7 @@ static int copy_value(struct loopback_control *dst,
                      struct loopback_control *src)
 {
        snd_ctl_elem_type_t type;
-       unsigned int count;
-       int i;
+       unsigned int i, count;
 
        type = snd_ctl_elem_info_get_type(dst->info);
        count = snd_ctl_elem_info_get_count(dst->info);
@@ -229,7 +228,7 @@ static int oss_set(struct loopback *loop,
        if (verbose)
                snd_output_printf(loop->output, "%s: Initialize OSS volume %s: %s", loop->id, file, buf);
        fd = open(file, O_WRONLY);
-       if (fd >= 0 && write(fd, buf, strlen(buf)) == strlen(buf)) {
+       if (fd >= 0 && write(fd, buf, strlen(buf)) == (ssize_t)strlen(buf)) {
                close(fd);
                return 0;
        }
index 4b1d78788ec1342212de35ff6ecbc703902f0a2f..5e616a10999395430ce360721d879da9da7f1a22 100644 (file)
@@ -152,7 +152,7 @@ static int setparams_stream(struct loopback_handle *lhandle,
 #ifdef USE_SAMPLERATE
            !lhandle->loopback->src_enable &&
 #endif
-           (int)rrate != lhandle->rate) {
+           rrate != lhandle->rate) {
                logit(LOG_CRIT, "Rate does not match (requested %uHz, got %uHz, resample %u)\n", lhandle->rate, rrate, lhandle->resample);
                return -EINVAL;
        }
@@ -624,7 +624,7 @@ static void buf_add_src(struct loopback *loop)
        }
 }
 #else
-static void buf_add_src(struct loopback *loop)
+static void buf_add_src(struct loopback *)
 {
 }
 #endif
@@ -685,7 +685,7 @@ static int readit(struct loopback_handle *lhandle)
                if ((err = suspend(lhandle)) < 0)
                        return err;
        }
-       if (avail > buf_avail(lhandle)) {
+       if ((snd_pcm_uframes_t)avail > buf_avail(lhandle)) {
                lhandle->buf_over += avail - buf_avail(lhandle);
                avail = buf_avail(lhandle);
        } else if (avail == 0) {
@@ -724,7 +724,7 @@ static int readit(struct loopback_handle *lhandle)
                               r, lhandle->frame_size, lhandle->loopback->cfile);
 #endif
                res += r;
-               if (lhandle->max < res)
+               if (lhandle->max < (snd_pcm_uframes_t)res)
                        lhandle->max = res;
                lhandle->counter += r;
                lhandle->buf_count += r;
@@ -803,9 +803,9 @@ static snd_pcm_sframes_t remove_samples(struct loopback *loop,
        struct loopback_handle *capt = loop->capt;
 
        if (loop->play->buf == loop->capt->buf) {
-               if (count > loop->play->buf_count)
+               if ((snd_pcm_uframes_t)count > loop->play->buf_count)
                        count = loop->play->buf_count;
-               if (count > loop->capt->buf_count)
+               if ((snd_pcm_uframes_t)count > loop->capt->buf_count)
                        count = loop->capt->buf_count;
                capt->buf_count -= count;
                play->buf_pos += count;
@@ -814,11 +814,11 @@ static snd_pcm_sframes_t remove_samples(struct loopback *loop,
                return count;
        }
        if (capture_preferred) {
-               if (count > capt->buf_count)
+               if ((snd_pcm_uframes_t)count > capt->buf_count)
                        count = capt->buf_count;
                capt->buf_count -= count;
        } else {
-               if (count > play->buf_count)
+               if ((snd_pcm_uframes_t)count > play->buf_count)
                        count = play->buf_count;
                play->buf_count -= count;
        }
@@ -829,7 +829,7 @@ static int xrun_sync(struct loopback *loop)
 {
        struct loopback_handle *play = loop->play;
        struct loopback_handle *capt = loop->capt;
-       snd_pcm_uframes_t fill = get_whole_latency(loop);
+       snd_pcm_sframes_t fill = get_whole_latency(loop);
        snd_pcm_sframes_t pdelay, cdelay, delay1, pdelay1, cdelay1, diff;
        int err;
 
@@ -929,7 +929,7 @@ static int xrun_sync(struct loopback *loop)
        }
        if (delay1 > fill) {
                diff = (delay1 - fill) / play->pitch;
-               if (diff > play->buf_count)
+               if ((snd_pcm_uframes_t)diff > play->buf_count)
                        diff = play->buf_count;
                if (verbose > 6)
                        snd_output_printf(loop->output,
@@ -944,7 +944,7 @@ static int xrun_sync(struct loopback *loop)
        }
        if (delay1 > fill) {
                diff = (delay1 - fill) / capt->pitch;
-               if (diff > capt->buf_count)
+               if ((snd_pcm_uframes_t)diff > capt->buf_count)
                        diff = capt->buf_count;
                if (verbose > 6)
                        snd_output_printf(loop->output,
@@ -963,7 +963,7 @@ static int xrun_sync(struct loopback *loop)
                if (verbose > 6)
                        snd_output_printf(loop->output,
                                "sync: xrun_pending, silence filling %li / buf_count=%li\n", (long)diff, play->buf_count);
-               if (fill > delay1 && play->buf_count < diff) {
+               if (fill > delay1 && play->buf_count < (snd_pcm_uframes_t)diff) {
                        diff = diff - play->buf_count;
                        if (verbose > 6)
                                snd_output_printf(loop->output,
@@ -994,7 +994,7 @@ static int xrun_sync(struct loopback *loop)
                        logit(LOG_CRIT, "%s start failed: %s\n", play->id, snd_strerror(err));
                        return err;
                }
-       } else if (delay1 < fill) {
+       } else if (delay1 < (snd_pcm_sframes_t)fill) {
                diff = (fill - delay1) / play->pitch;
                while (diff > 0) {
                        delay1 = play->buf_size - play->buf_pos;
@@ -1672,7 +1672,7 @@ __again:
                snd_output_printf(loop->output, "%s: silence queued %i samples\n", loop->id, err);
        if (count > loop->play->buffer_size)
                count = loop->play->buffer_size;
-       if (err != count) {
+       if (err != (int)count) {
                logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%u)\n", loop->id, err, (int)count, loop->play->buffer_size);
                err = -EIO;
                goto __error;
@@ -1793,7 +1793,7 @@ static int ctl_event_check(snd_ctl_elem_value_t *val, snd_ctl_event_t *ev)
 }
 
 static int handle_ctl_events(struct loopback_handle *lhandle,
-                            unsigned short events)
+                            unsigned short)
 {
        struct loopback *loop = lhandle->loopback;
        snd_ctl_event_t *ev;
@@ -1818,12 +1818,12 @@ static int handle_ctl_events(struct loopback_handle *lhandle,
                        continue;
                } else if (ctl_event_check(lhandle->ctl_rate, ev)) {
                        err = get_rate(lhandle);
-                       if (lhandle->rate != err)
+                       if ((int)lhandle->rate != err)
                                restart = 1;
                        continue;
                } else if (ctl_event_check(lhandle->ctl_channels, ev)) {
                        err = get_channels(lhandle);
-                       if (lhandle->channels != err)
+                       if ((int)lhandle->channels != err)
                                restart = 1;
                        continue;
                }