{ 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)
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;
}
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");
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;
}
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;
}
}
}
-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;
}
/* 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
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);
/* 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;
}
}
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);
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;
}
}
/* 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) {
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;
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;