mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:55:43 +01:00
bat: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
7c54fb5ebe
commit
b36687548d
4 changed files with 20 additions and 21 deletions
10
bat/alsa.c
10
bat/alsa.c
|
@ -53,7 +53,7 @@ static struct format_map_table map_tables[] = {
|
|||
{ BAT_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_LE },
|
||||
{ BAT_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3LE },
|
||||
{ BAT_PCM_FORMAT_S32_LE, SND_PCM_FORMAT_S32_LE },
|
||||
{ BAT_PCM_FORMAT_MAX, },
|
||||
{ BAT_PCM_FORMAT_MAX, 0 },
|
||||
};
|
||||
|
||||
static int format_convert(struct bat *bat, snd_pcm_format_t *fmt)
|
||||
|
@ -407,7 +407,7 @@ static int write_to_pcm_loop(struct pcm_container *sndpcm, struct bat *bat)
|
|||
break;
|
||||
|
||||
if (bat->debugplay) {
|
||||
if (fwrite(sndpcm->buffer, 1, bytes, fp) != bytes) {
|
||||
if (fwrite(sndpcm->buffer, 1, bytes, fp) != (size_t)bytes) {
|
||||
err = -EIO;
|
||||
break;
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ static int read_from_pcm_loop(struct pcm_container *sndpcm, struct bat *bat)
|
|||
int size, frames;
|
||||
int bytes_read = 0;
|
||||
int bytes_count = bat->frames * bat->frame_size;
|
||||
int remain = bytes_count;
|
||||
unsigned int remain = bytes_count;
|
||||
|
||||
remove(bat->capture.file);
|
||||
fp = fopen(bat->capture.file, "wb");
|
||||
|
@ -579,7 +579,7 @@ static int read_from_pcm_loop(struct pcm_container *sndpcm, struct bat *bat)
|
|||
break;
|
||||
|
||||
/* write the chunk to file */
|
||||
if (fwrite(sndpcm->buffer, 1, size, fp) != size) {
|
||||
if (fwrite(sndpcm->buffer, 1, size, fp) != (size_t)size) {
|
||||
err = -EIO;
|
||||
break;
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ static int latencytest_process_input(struct pcm_container *sndpcm,
|
|||
break;
|
||||
|
||||
/* write the chunk to file */
|
||||
if (fwrite(sndpcm->buffer, 1, size, fp) != size) {
|
||||
if (fwrite(sndpcm->buffer, 1, size, fp) != (size_t)size) {
|
||||
err = -EIO;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -158,8 +158,7 @@ static void get_format(struct bat *bat, char *optarg)
|
|||
}
|
||||
}
|
||||
|
||||
static inline int thread_wait_completion(struct bat *bat,
|
||||
pthread_t id, int **val)
|
||||
static inline int thread_wait_completion(struct bat *, pthread_t id, int **val)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
|
22
bat/common.c
22
bat/common.c
|
@ -46,8 +46,7 @@ static int update_fmt_to_bat(struct bat *bat, struct chunk_fmt *fmt)
|
|||
}
|
||||
|
||||
/* calculate frames and update to bat */
|
||||
static int update_frames_to_bat(struct bat *bat,
|
||||
struct wav_chunk_header *header, FILE *fp)
|
||||
static int update_frames_to_bat(struct bat *bat, struct wav_chunk_header *header, FILE *)
|
||||
{
|
||||
/* The number of analyzed captured frames is arbitrarily set to half of
|
||||
the number of frames of the wav file or the number of frames of the
|
||||
|
@ -63,7 +62,7 @@ static int read_chunk_fmt(struct bat *bat, char *file, FILE *fp, bool skip,
|
|||
struct wav_chunk_header *header)
|
||||
{
|
||||
size_t err;
|
||||
int header_skip;
|
||||
int ret, header_skip;
|
||||
struct chunk_fmt chunk_fmt;
|
||||
|
||||
err = fread(&chunk_fmt, sizeof(chunk_fmt), 1, fp);
|
||||
|
@ -75,10 +74,10 @@ static int read_chunk_fmt(struct bat *bat, char *file, FILE *fp, bool skip,
|
|||
/* If the format header is larger, skip the rest */
|
||||
header_skip = header->length - sizeof(chunk_fmt);
|
||||
if (header_skip > 0) {
|
||||
err = fseek(fp, header_skip, SEEK_CUR);
|
||||
if (err == -1) {
|
||||
fprintf(bat->err, _("Seek fmt header error: %s:%zd\n"),
|
||||
file, err);
|
||||
ret = fseek(fp, header_skip, SEEK_CUR);
|
||||
if (ret == -1) {
|
||||
fprintf(bat->err, _("Seek fmt header error: %s:%d\n"),
|
||||
file, ret);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +98,7 @@ int read_wav_header(struct bat *bat, char *file, FILE *fp, bool skip)
|
|||
struct wav_chunk_header chunk_header;
|
||||
int more_chunks = 1;
|
||||
size_t err;
|
||||
int ret;
|
||||
|
||||
/* Read header of RIFF wav file */
|
||||
err = fread(&riff_wave_header, sizeof(riff_wave_header), 1, fp);
|
||||
|
@ -144,11 +144,11 @@ int read_wav_header(struct bat *bat, char *file, FILE *fp, bool skip)
|
|||
break;
|
||||
default:
|
||||
/* Unknown chunk, skip bytes */
|
||||
err = fseek(fp, chunk_header.length, SEEK_CUR);
|
||||
if (err == -1) {
|
||||
ret = fseek(fp, chunk_header.length, SEEK_CUR);
|
||||
if (ret == -1) {
|
||||
fprintf(bat->err, _("Fail to skip unknown"));
|
||||
fprintf(bat->err, _(" chunk of %s:%zd\n"),
|
||||
file, err);
|
||||
fprintf(bat->err, _(" chunk of %s:%d\n"),
|
||||
file, ret);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ static void play_and_listen(struct bat *bat, void *buffer, int frames)
|
|||
|
||||
/* Do not listen to more than a second
|
||||
Maybe too much background noise */
|
||||
if (bat->latency.samples > bat->rate) {
|
||||
if ((unsigned int)bat->latency.samples > bat->rate) {
|
||||
bat->latency.error++;
|
||||
|
||||
if (bat->latency.error > LATENCY_TEST_NUMBER) {
|
||||
|
@ -191,7 +191,7 @@ int handleinput(struct bat *bat, void *buffer, int frames)
|
|||
bat->latency.samples += frames;
|
||||
|
||||
/* 1 second elapsed */
|
||||
if (bat->latency.samples >= bat->rate) {
|
||||
if ((unsigned int)bat->latency.samples >= bat->rate) {
|
||||
calculate_threshold(bat);
|
||||
bat->latency.state = LATENCY_STATE_PLAY_AND_LISTEN;
|
||||
bat->latency.samples = 0;
|
||||
|
@ -208,7 +208,7 @@ int handleinput(struct bat *bat, void *buffer, int frames)
|
|||
case LATENCY_STATE_WAITING:
|
||||
bat->latency.samples += frames;
|
||||
|
||||
if (bat->latency.samples > bat->rate) {
|
||||
if ((unsigned int)bat->latency.samples > bat->rate) {
|
||||
/* 1 second elapsed, start over */
|
||||
bat->latency.samples = 0;
|
||||
bat->latency.state = LATENCY_STATE_MEASURE_FOR_1_SECOND;
|
||||
|
|
Loading…
Reference in a new issue