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

index f0adbc3122b9c42e6aa39181f44e647d37467ce0..d05c47e826eaafca10d648fcc7a18daa2a9bee0e 100644 (file)
@@ -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, },
 };
 
 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;
                }
index 89b6555cd8d845b41da7e611fbcc6a8bf139cab0..e88c65f72f4951e1abf62e318de14a5c5abd70cc 100644 (file)
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -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;
 
index 339e749fd74aa8768df4ea394ed1aeccb5801e54..47c3ea5e1d750b7ea0cd8e7743195ac1f9325dd3 100644 (file)
@@ -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;
                        }
                }
index ec3abe2a2d6ba9065a9322387f5a60b3929aa3f2..8c10efb07520b65ca649441aa46229e7d6ae0fbb 100644 (file)
@@ -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;