alsaloop: 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:36:15 +02:00
parent ad5a1c0c88
commit d609a58664
3 changed files with 22 additions and 23 deletions

View 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; snd_pcm_uframes_t arg_period_size = 0;
unsigned long arg_loop_time = ~0UL; unsigned long arg_loop_time = ~0UL;
int arg_nblock = 0; int arg_nblock = 0;
int arg_effect = 0; // int arg_effect = 0;
int arg_resample = 0; int arg_resample = 0;
#ifdef USE_SAMPLERATE #ifdef USE_SAMPLERATE
int arg_samplerate = SRC_SINC_FASTEST + 1; 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; arg_nblock = 1;
break; break;
case 'e': case 'e':
arg_effect = 1; // arg_effect = 1;
break; break;
case 'n': case 'n':
arg_resample = 1; 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; quit = 1;
send_to_all(SIGUSR2); send_to_all(SIGUSR2);

View file

@ -187,8 +187,7 @@ static int copy_value(struct loopback_control *dst,
struct loopback_control *src) struct loopback_control *src)
{ {
snd_ctl_elem_type_t type; snd_ctl_elem_type_t type;
unsigned int count; unsigned int i, count;
int i;
type = snd_ctl_elem_info_get_type(dst->info); type = snd_ctl_elem_info_get_type(dst->info);
count = snd_ctl_elem_info_get_count(dst->info); count = snd_ctl_elem_info_get_count(dst->info);
@ -229,7 +228,7 @@ static int oss_set(struct loopback *loop,
if (verbose) if (verbose)
snd_output_printf(loop->output, "%s: Initialize OSS volume %s: %s", loop->id, file, buf); snd_output_printf(loop->output, "%s: Initialize OSS volume %s: %s", loop->id, file, buf);
fd = open(file, O_WRONLY); 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); close(fd);
return 0; return 0;
} }

View file

@ -152,7 +152,7 @@ static int setparams_stream(struct loopback_handle *lhandle,
#ifdef USE_SAMPLERATE #ifdef USE_SAMPLERATE
!lhandle->loopback->src_enable && !lhandle->loopback->src_enable &&
#endif #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); logit(LOG_CRIT, "Rate does not match (requested %uHz, got %uHz, resample %u)\n", lhandle->rate, rrate, lhandle->resample);
return -EINVAL; return -EINVAL;
} }
@ -624,7 +624,7 @@ static void buf_add_src(struct loopback *loop)
} }
} }
#else #else
static void buf_add_src(struct loopback *loop) static void buf_add_src(struct loopback *)
{ {
} }
#endif #endif
@ -685,7 +685,7 @@ static int readit(struct loopback_handle *lhandle)
if ((err = suspend(lhandle)) < 0) if ((err = suspend(lhandle)) < 0)
return err; return err;
} }
if (avail > buf_avail(lhandle)) { if ((snd_pcm_uframes_t)avail > buf_avail(lhandle)) {
lhandle->buf_over += avail - buf_avail(lhandle); lhandle->buf_over += avail - buf_avail(lhandle);
avail = buf_avail(lhandle); avail = buf_avail(lhandle);
} else if (avail == 0) { } else if (avail == 0) {
@ -724,7 +724,7 @@ static int readit(struct loopback_handle *lhandle)
r, lhandle->frame_size, lhandle->loopback->cfile); r, lhandle->frame_size, lhandle->loopback->cfile);
#endif #endif
res += r; res += r;
if (lhandle->max < res) if (lhandle->max < (snd_pcm_uframes_t)res)
lhandle->max = res; lhandle->max = res;
lhandle->counter += r; lhandle->counter += r;
lhandle->buf_count += 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; struct loopback_handle *capt = loop->capt;
if (loop->play->buf == loop->capt->buf) { 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; 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; count = loop->capt->buf_count;
capt->buf_count -= count; capt->buf_count -= count;
play->buf_pos += count; play->buf_pos += count;
@ -814,11 +814,11 @@ static snd_pcm_sframes_t remove_samples(struct loopback *loop,
return count; return count;
} }
if (capture_preferred) { if (capture_preferred) {
if (count > capt->buf_count) if ((snd_pcm_uframes_t)count > capt->buf_count)
count = capt->buf_count; count = capt->buf_count;
capt->buf_count -= count; capt->buf_count -= count;
} else { } else {
if (count > play->buf_count) if ((snd_pcm_uframes_t)count > play->buf_count)
count = play->buf_count; count = play->buf_count;
play->buf_count -= 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 *play = loop->play;
struct loopback_handle *capt = loop->capt; 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; snd_pcm_sframes_t pdelay, cdelay, delay1, pdelay1, cdelay1, diff;
int err; int err;
@ -929,7 +929,7 @@ static int xrun_sync(struct loopback *loop)
} }
if (delay1 > fill) { if (delay1 > fill) {
diff = (delay1 - fill) / play->pitch; diff = (delay1 - fill) / play->pitch;
if (diff > play->buf_count) if ((snd_pcm_uframes_t)diff > play->buf_count)
diff = play->buf_count; diff = play->buf_count;
if (verbose > 6) if (verbose > 6)
snd_output_printf(loop->output, snd_output_printf(loop->output,
@ -944,7 +944,7 @@ static int xrun_sync(struct loopback *loop)
} }
if (delay1 > fill) { if (delay1 > fill) {
diff = (delay1 - fill) / capt->pitch; diff = (delay1 - fill) / capt->pitch;
if (diff > capt->buf_count) if ((snd_pcm_uframes_t)diff > capt->buf_count)
diff = capt->buf_count; diff = capt->buf_count;
if (verbose > 6) if (verbose > 6)
snd_output_printf(loop->output, snd_output_printf(loop->output,
@ -963,7 +963,7 @@ static int xrun_sync(struct loopback *loop)
if (verbose > 6) if (verbose > 6)
snd_output_printf(loop->output, snd_output_printf(loop->output,
"sync: xrun_pending, silence filling %li / buf_count=%li\n", (long)diff, play->buf_count); "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; diff = diff - play->buf_count;
if (verbose > 6) if (verbose > 6)
snd_output_printf(loop->output, 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)); logit(LOG_CRIT, "%s start failed: %s\n", play->id, snd_strerror(err));
return err; return err;
} }
} else if (delay1 < fill) { } else if (delay1 < (snd_pcm_sframes_t)fill) {
diff = (fill - delay1) / play->pitch; diff = (fill - delay1) / play->pitch;
while (diff > 0) { while (diff > 0) {
delay1 = play->buf_size - play->buf_pos; 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); snd_output_printf(loop->output, "%s: silence queued %i samples\n", loop->id, err);
if (count > loop->play->buffer_size) if (count > loop->play->buffer_size)
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); logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%u)\n", loop->id, err, (int)count, loop->play->buffer_size);
err = -EIO; err = -EIO;
goto __error; 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, static int handle_ctl_events(struct loopback_handle *lhandle,
unsigned short events) unsigned short)
{ {
struct loopback *loop = lhandle->loopback; struct loopback *loop = lhandle->loopback;
snd_ctl_event_t *ev; snd_ctl_event_t *ev;
@ -1818,12 +1818,12 @@ static int handle_ctl_events(struct loopback_handle *lhandle,
continue; continue;
} else if (ctl_event_check(lhandle->ctl_rate, ev)) { } else if (ctl_event_check(lhandle->ctl_rate, ev)) {
err = get_rate(lhandle); err = get_rate(lhandle);
if (lhandle->rate != err) if ((int)lhandle->rate != err)
restart = 1; restart = 1;
continue; continue;
} else if (ctl_event_check(lhandle->ctl_channels, ev)) { } else if (ctl_event_check(lhandle->ctl_channels, ev)) {
err = get_channels(lhandle); err = get_channels(lhandle);
if (lhandle->channels != err) if ((int)lhandle->channels != err)
restart = 1; restart = 1;
continue; continue;
} }