From ad5a1c0c88d4e34f9d46ab3015a713967bbe2901 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 30 Aug 2023 12:35:57 +0200 Subject: [PATCH] axfer: fix the verbose compilation warnings for latest gcc Signed-off-by: Jaroslav Kysela --- axfer/container-au.c | 4 ++-- axfer/container-raw.c | 14 +++++++------- axfer/container-riff-wave.c | 6 +++--- axfer/container-voc.c | 10 +++++----- axfer/container.c | 6 +++--- axfer/container.h | 2 +- axfer/frame-cache.c | 6 +++--- axfer/main.c | 12 ++++++------ axfer/mapper-multiple.c | 10 +++++----- axfer/mapper-single.c | 10 +++++----- axfer/subcmd-list.c | 9 ++++----- axfer/subcmd-transfer.c | 16 ++++++++-------- axfer/waiter-epoll.c | 8 ++++---- axfer/waiter-poll.c | 4 ++-- axfer/waiter-select.c | 8 ++++---- axfer/waiter.c | 4 ++-- axfer/xfer-libasound-irq-mmap.c | 4 ++-- axfer/xfer-libasound-irq-rw.c | 2 +- axfer/xfer-libasound-timer-mmap.c | 6 +++--- axfer/xfer-libasound.c | 4 ++-- axfer/xfer-options.c | 16 ++++++++-------- axfer/xfer.c | 8 ++++---- 22 files changed, 84 insertions(+), 85 deletions(-) diff --git a/axfer/container-au.c b/axfer/container-au.c index 6459b16..cccbebd 100644 --- a/axfer/container-au.c +++ b/axfer/container-au.c @@ -76,7 +76,7 @@ static int au_parser_pre_process(struct container_context *cntr, struct parser_state *state = cntr->private_data; struct container_header header; enum code_id code_id; - int i; + unsigned int i; int err; // Parse header. 4 bytes are enough to detect supported containers. @@ -153,7 +153,7 @@ static int au_builder_pre_process(struct container_context *cntr, uint64_t *byte_count) { struct builder_state *status = cntr->private_data; - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { if (format_maps[i].format == *format) diff --git a/axfer/container-raw.c b/axfer/container-raw.c index 9b0022e..071f94c 100644 --- a/axfer/container-raw.c +++ b/axfer/container-raw.c @@ -13,10 +13,10 @@ #include #include -static int raw_builder_pre_process(struct container_context *cntr, - snd_pcm_format_t *sample_format, - unsigned int *samples_per_frame, - unsigned int *frames_per_second, +static int raw_builder_pre_process(struct container_context *, + snd_pcm_format_t *, + unsigned int *, + unsigned int *, uint64_t *byte_count) { *byte_count = UINT64_MAX; @@ -25,9 +25,9 @@ static int raw_builder_pre_process(struct container_context *cntr, } static int raw_parser_pre_process(struct container_context *cntr, - snd_pcm_format_t *sample_format, - unsigned int *samples_per_frame, - unsigned int *frames_per_second, + snd_pcm_format_t *, + unsigned int *, + unsigned int *, uint64_t *byte_count) { struct stat buf = {0}; diff --git a/axfer/container-riff-wave.c b/axfer/container-riff-wave.c index d68401d..f62cdbd 100644 --- a/axfer/container-riff-wave.c +++ b/axfer/container-riff-wave.c @@ -349,7 +349,7 @@ static int wave_parser_pre_process(struct container_context *cntr, struct parser_state *state = cntr->private_data; int phys_width; const struct format_map *map; - int i; + unsigned int i; int err; err = parse_riff_wave_format(cntr); @@ -363,7 +363,7 @@ static int wave_parser_pre_process(struct container_context *cntr, map = &format_maps[i]; if (state->format != map->wformat) continue; - if (state->avail_bits_in_sample != + if ((int)state->avail_bits_in_sample != snd_pcm_format_width(map->format)) continue; if (phys_width != snd_pcm_format_physical_width(map->format)) @@ -514,7 +514,7 @@ static int wave_builder_pre_process(struct container_context *cntr, uint64_t *byte_count) { struct builder_state *state = cntr->private_data; - int i; + unsigned int i; // Validate parameters. for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { diff --git a/axfer/container-voc.c b/axfer/container-voc.c index 5941003..f169a1a 100644 --- a/axfer/container-voc.c +++ b/axfer/container-voc.c @@ -221,7 +221,7 @@ static int build_time_constant(unsigned int frames_per_second, unsigned int samples_per_frame, uint16_t *code, bool extended) { - int i; + unsigned int i; // 16 bits are available for this purpose. if (extended) { @@ -264,7 +264,7 @@ static unsigned int parse_time_constant(uint16_t code, unsigned int *frames_per_second, bool extended) { - int i; + unsigned int i; if (extended) { if (samples_per_frame > 2) @@ -344,7 +344,7 @@ static int parse_container_header(struct parser_state *state, static bool check_code_id(uint8_t code_id, unsigned int version) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { if (code_id != format_maps[i].code_id) @@ -560,7 +560,7 @@ static int voc_parser_pre_process(struct container_context *cntr, uint64_t *byte_count) { struct parser_state *state = cntr->private_data; - int i; + unsigned int i; int err; err = detect_container_version(cntr); @@ -719,7 +719,7 @@ static int voc_builder_pre_process(struct container_context *cntr, uint64_t *byte_count) { struct builder_state *state = cntr->private_data; - int i; + unsigned int i; // Validate parameters. for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { diff --git a/axfer/container.c b/axfer/container.c index 379b72f..a325fef 100644 --- a/axfer/container.c +++ b/axfer/container.c @@ -34,7 +34,7 @@ static const char *const suffixes[] = { [CONTAINER_FORMAT_RAW] = "", }; -const char *const container_suffix_from_format(enum container_format format) +const char * container_suffix_from_format(enum container_format format) { return suffixes[format]; } @@ -100,7 +100,7 @@ enum container_format container_format_from_path(const char *path) const char *pos; int i; - for (i = 0; i < ARRAY_SIZE(suffixes); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(suffixes); ++i) { suffix = suffixes[i]; // Check last part of the string. @@ -186,7 +186,7 @@ int container_parser_init(struct container_context *cntr, int fd, err = container_recursive_read(cntr, cntr->magic, sizeof(cntr->magic)); if (err < 0) return err; - for (i = 0; i < ARRAY_SIZE(parsers); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(parsers); ++i) { parser = parsers[i]; size = strlen(parser->magic); if (size > 4) diff --git a/axfer/container.h b/axfer/container.h index 8f7ab2a..ab162c8 100644 --- a/axfer/container.h +++ b/axfer/container.h @@ -60,7 +60,7 @@ struct container_context { uint64_t handled_byte_count; }; -const char *const container_suffix_from_format(enum container_format format); +const char *container_suffix_from_format(enum container_format format); enum container_format container_format_from_path(const char *path); int container_parser_init(struct container_context *cntr, int fd, unsigned int verbose); diff --git a/axfer/frame-cache.c b/axfer/frame-cache.c index 417c1e6..8538f1e 100644 --- a/axfer/frame-cache.c +++ b/axfer/frame-cache.c @@ -33,7 +33,7 @@ static void align_frames_in_n(struct frame_cache *cache, char **buf_ptrs = cache->buf_ptr; unsigned int offset; unsigned int size; - int i; + unsigned int i; cache->remained_count -= consumed_count; @@ -75,7 +75,7 @@ int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access, } else { char **bufs = calloc(samples_per_frame, sizeof(*bufs)); char **buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs)); - int i; + unsigned int i; cache->buf = bufs; cache->buf_ptr = buf_ptrs; @@ -102,7 +102,7 @@ void frame_cache_destroy(struct frame_cache *cache) if (cache->access == SND_PCM_ACCESS_RW_NONINTERLEAVED) { char **bufs = cache->buf; if (bufs) { - int i; + unsigned int i; for (i = 0; i < cache->samples_per_frame; ++i) free(bufs[i]); } diff --git a/axfer/main.c b/axfer/main.c index 21d3b4a..765d2c3 100644 --- a/axfer/main.c +++ b/axfer/main.c @@ -107,7 +107,7 @@ static bool decide_subcmd(int argc, char *const *argv, enum subcmds *subcmd) return false; // Original command system. For long options. - for (i = 0; i < ARRAY_SIZE(long_opts); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(long_opts); ++i) { for (j = 0; j < argc; ++j) { if (!strcmp(long_opts[i].name, argv[j])) { *subcmd = long_opts[i].subcmd; @@ -123,7 +123,7 @@ static bool decide_subcmd(int argc, char *const *argv, enum subcmds *subcmd) argv[i][1] == '-' || argv[i][1] == '\0') continue; for (pos = argv[i]; *pos != '\0'; ++pos) { - for (j = 0; j < ARRAY_SIZE(short_opts); ++j) { + for (j = 0; j < (int)ARRAY_SIZE(short_opts); ++j) { if (*pos == short_opts[j].c) { *subcmd = short_opts[j].subcmd; return true; @@ -161,7 +161,7 @@ static bool decide_direction(int argc, char *const *argv, char *pos; // Original command system. For long options. - for (i = 0; i < ARRAY_SIZE(long_opts); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(long_opts); ++i) { for (j = 0; j < argc; ++j) { if (!strcmp(long_opts[i].name, argv[j])) { *direction = long_opts[i].direction; @@ -177,7 +177,7 @@ static bool decide_direction(int argc, char *const *argv, argv[i][1] == '-' || argv[i][1] == '\0') continue; for (pos = argv[i]; *pos != '\0'; ++pos) { - for (j = 0; j < ARRAY_SIZE(short_opts); ++j) { + for (j = 0; j < (int)ARRAY_SIZE(short_opts); ++j) { if (*pos == short_opts[j].c) { *direction = short_opts[j].direction; return true; @@ -187,7 +187,7 @@ static bool decide_direction(int argc, char *const *argv, } // If not decided yet, judge according to command name. - for (i = 0; i < ARRAY_SIZE(aliases); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(aliases); ++i) { for (pos = argv[0] + strlen(argv[0]); pos != argv[0]; --pos) { if (strstr(pos, aliases[i]) != NULL) { *direction = i; @@ -212,7 +212,7 @@ static bool detect_subcmd(int argc, char *const *argv, enum subcmds *subcmd) if (argc < 2) return false; - for (i = 0; i < ARRAY_SIZE(subcmds); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(subcmds); ++i) { if (!strcmp(argv[1], subcmds[i])) { *subcmd = i; return true; diff --git a/axfer/mapper-multiple.c b/axfer/mapper-multiple.c index 00569af..8e82b22 100644 --- a/axfer/mapper-multiple.c +++ b/axfer/mapper-multiple.c @@ -27,7 +27,7 @@ static void align_to_i(void *frame_buf, unsigned int frame_count, unsigned int dst_pos; unsigned int src_pos; struct container_context *cntr; - int i, j; + unsigned int i, j; // src: first channel in each of interleaved buffers in containers => // dst:interleaved. @@ -55,7 +55,7 @@ static void align_from_i(void *frame_buf, unsigned int frame_count, unsigned int src_pos; unsigned int dst_pos; struct container_context *cntr; - int i, j; + unsigned int i, j; for (i = 0; i < cntr_count; ++i) { dst = dst_bufs[i]; @@ -77,7 +77,7 @@ static int multiple_pre_process(struct mapper_context *mapper, { struct multiple_state *state = mapper->private_data; struct container_context *cntr; - int i; + unsigned int i; // Additionally, format of samples in the containers should be the same // as the format in PCM substream. @@ -151,7 +151,7 @@ static int process_containers(char **src_bufs, unsigned int *frame_count, { struct container_context *cntr; char *src; - int i; + unsigned int i; int err = 0; // TODO: arrangement for *frame_count. @@ -226,7 +226,7 @@ static int multiple_demuxer_process_frames(struct mapper_context *mapper, static void multiple_post_process(struct mapper_context *mapper) { struct multiple_state *state = mapper->private_data; - int i; + unsigned int i; if (state->bufs) { for (i = 0; i < state->cntr_count; ++i) { diff --git a/axfer/mapper-single.c b/axfer/mapper-single.c index aa8aa19..13e7fc5 100644 --- a/axfer/mapper-single.c +++ b/axfer/mapper-single.c @@ -24,7 +24,7 @@ static void align_to_vector(void *frame_buf, unsigned int frame_count, char *dst; unsigned int src_pos; unsigned int dst_pos; - int i, j; + unsigned int i, j; // src: interleaved => dst: a set of interleaved buffers. for (i = 0; i < samples_per_frame; ++i) { @@ -46,7 +46,7 @@ static void align_from_vector(void *frame_buf, unsigned int frame_count, char *src; unsigned int dst_pos; unsigned int src_pos; - int i, j; + unsigned int i, j; // src: a set of interleaved buffers => dst:interleaved. for (i = 0; i < samples_per_frame; ++i) { @@ -62,7 +62,7 @@ static void align_from_vector(void *frame_buf, unsigned int frame_count, static int single_pre_process(struct mapper_context *mapper, struct container_context *cntrs, - unsigned int cntr_count) + unsigned int) { struct single_state *state = mapper->private_data; unsigned int bytes_per_buffer; @@ -110,7 +110,7 @@ static int single_muxer_process_frames(struct mapper_context *mapper, void *frame_buf, unsigned int *frame_count, struct container_context *cntrs, - unsigned int cntr_count) + unsigned int) { struct single_state *state = mapper->private_data; void *src; @@ -141,7 +141,7 @@ static int single_demuxer_process_frames(struct mapper_context *mapper, void *frame_buf, unsigned int *frame_count, struct container_context *cntrs, - unsigned int cntr_count) + unsigned int) { struct single_state *state = mapper->private_data; void *dst; diff --git a/axfer/subcmd-list.c b/axfer/subcmd-list.c index 359f73f..f9c8e0f 100644 --- a/axfer/subcmd-list.c +++ b/axfer/subcmd-list.c @@ -19,10 +19,9 @@ enum list_op { }; static int dump_device(snd_ctl_t *handle, const char *id, const char *name, - snd_pcm_stream_t direction, snd_pcm_info_t *info) + snd_pcm_stream_t, snd_pcm_info_t *info) { - unsigned int count; - int i; + unsigned int i, count; int err; printf("card %i: %s [%s], device %i: %s [%s]\n", @@ -44,7 +43,7 @@ static int dump_device(snd_ctl_t *handle, const char *id, const char *name, continue; } - printf(" Subdevice #%i: %s\n", + printf(" Subdevice #%u: %s\n", i, snd_pcm_info_get_subdevice_name(info)); } @@ -242,7 +241,7 @@ static int detect_operation(int argc, char *const *argv, enum list_op *op) if (argc < 2) return false; - for (i = 0; i < ARRAY_SIZE(ops); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(ops); ++i) { if (!strcmp(argv[1], ops[i])) { *op = i; return true; diff --git a/axfer/subcmd-transfer.c b/axfer/subcmd-transfer.c index 839215a..b39fde8 100644 --- a/axfer/subcmd-transfer.c +++ b/axfer/subcmd-transfer.c @@ -31,7 +31,7 @@ static struct context *ctx_ptr; static void handle_unix_signal_for_finish(int sig) { - int i; + unsigned int i; for (i = 0; i < ctx_ptr->cntr_count; ++i) ctx_ptr->cntrs[i].interrupted = true; @@ -40,7 +40,7 @@ static void handle_unix_signal_for_finish(int sig) ctx_ptr->interrupted = true; } -static void handle_unix_signal_for_suspend(int sig) +static void handle_unix_signal_for_suspend(int) { sigset_t curr, prev; struct sigaction sa = {0}; @@ -170,7 +170,7 @@ static int capture_pre_process(struct context *ctx, snd_pcm_access_t *access, unsigned int samples_per_frame = 0; unsigned int frames_per_second = 0; unsigned int channels; - int i; + unsigned int i; int err; err = xfer_context_pre_process(&ctx->xfer, &sample_format, @@ -233,7 +233,7 @@ static int playback_pre_process(struct context *ctx, snd_pcm_access_t *access, snd_pcm_format_t sample_format = SND_PCM_FORMAT_UNKNOWN; unsigned int samples_per_frame = 0; unsigned int frames_per_second = 0; - int i; + unsigned int i; int err; // Prepare for containers. @@ -374,7 +374,7 @@ static int context_process_frames(struct context *ctx, { bool verbose = ctx->xfer.verbose > 2; unsigned int frame_count; - int i; + unsigned int i; int err = 0; if (!ctx->xfer.quiet) { @@ -439,10 +439,10 @@ static int context_process_frames(struct context *ctx, } static void context_post_process(struct context *ctx, - uint64_t accumulated_frame_count) + uint64_t) { uint64_t total_frame_count; - int i; + unsigned int i; xfer_context_post_process(&ctx->xfer); @@ -472,7 +472,7 @@ static void context_destroy(struct context *ctx) int subcmd_transfer(int argc, char *const *argv, snd_pcm_stream_t direction) { - struct context ctx = {0}; + static struct context ctx = {0}; uint64_t expected_frame_count = 0; uint64_t actual_frame_count = 0; int err = 0; diff --git a/axfer/waiter-epoll.c b/axfer/waiter-epoll.c index 8f084f1..c09641b 100644 --- a/axfer/waiter-epoll.c +++ b/axfer/waiter-epoll.c @@ -36,7 +36,7 @@ static int epoll_prepare(struct waiter_context *waiter) if (state->epfd < 0) return -errno; - for (i = 0; i < waiter->pfd_count; ++i) { + for (i = 0; i < (int)waiter->pfd_count; ++i) { struct epoll_event ev = { .data.fd = waiter->pfds[i].fd, .events = waiter->pfds[i].events, @@ -64,9 +64,9 @@ static int epoll_wait_event(struct waiter_context *waiter, int timeout_msec) if (ev_count > 0) { // Reconstruct data of pollfd structure. - for (i = 0; i < ev_count; ++i) { + for (i = 0; i < (int)ev_count; ++i) { struct epoll_event *ev = &state->events[i]; - for (j = 0; j < waiter->pfd_count; ++j) { + for (j = 0; j < (int)waiter->pfd_count; ++j) { if (waiter->pfds[i].fd == ev->data.fd) { waiter->pfds[i].revents = ev->events; break; @@ -83,7 +83,7 @@ static void epoll_release(struct waiter_context *waiter) struct epoll_state *state = waiter->private_data; int i; - for (i = 0; i < waiter->pfd_count; ++i) { + for (i = 0; i < (int)waiter->pfd_count; ++i) { int fd = waiter->pfds[i].fd; epoll_ctl(state->epfd, EPOLL_CTL_DEL, fd, NULL); } diff --git a/axfer/waiter-poll.c b/axfer/waiter-poll.c index 61aa1a0..31fab88 100644 --- a/axfer/waiter-poll.c +++ b/axfer/waiter-poll.c @@ -13,7 +13,7 @@ #include #include -static int poll_prepare(struct waiter_context *waiter) +static int poll_prepare(struct waiter_context *) { // Nothing to do because an instance of waiter has required data. return 0; @@ -30,7 +30,7 @@ static int poll_wait_event(struct waiter_context *waiter, int timeout_msec) return err; } -static void poll_release(struct waiter_context *waiter) +static void poll_release(struct waiter_context *) { // Nothing to do because an instance of waiter has required data. return; diff --git a/axfer/waiter-select.c b/axfer/waiter-select.c index 97b1e5a..164c9c8 100644 --- a/axfer/waiter-select.c +++ b/axfer/waiter-select.c @@ -34,7 +34,7 @@ struct select_state { fd_set rfds_ex; }; -static int select_prepare(struct waiter_context *waiter) +static int select_prepare(struct waiter_context *) { return 0; } @@ -53,7 +53,7 @@ static int select_wait_event(struct waiter_context *waiter, int timeout_msec) FD_ZERO(&state->rfds_ex); fd_max = 0; - for (i = 0; i < waiter->pfd_count; ++i) { + for (i = 0; i < (int)waiter->pfd_count; ++i) { pfd = &waiter->pfds[i]; if (pfd->events & POLLIN_SET) @@ -79,7 +79,7 @@ static int select_wait_event(struct waiter_context *waiter, int timeout_msec) if (err < 0) return -errno; - for (i = 0; i < waiter->pfd_count; ++i) { + for (i = 0; i < (int)waiter->pfd_count; ++i) { pfd = &waiter->pfds[i]; pfd->revents = 0; @@ -94,7 +94,7 @@ static int select_wait_event(struct waiter_context *waiter, int timeout_msec) return err; } -static void select_release(struct waiter_context *waiter) +static void select_release(struct waiter_context *) { return; } diff --git a/axfer/waiter.c b/axfer/waiter.c index 1e9c811..dcca028 100644 --- a/axfer/waiter.c +++ b/axfer/waiter.c @@ -25,7 +25,7 @@ enum waiter_type waiter_type_from_label(const char *label) { int i; - for (i = 0; i < ARRAY_SIZE(waiter_type_labels); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(waiter_type_labels); ++i) { if (!strcmp(waiter_type_labels[i], label)) return i; } @@ -54,7 +54,7 @@ int waiter_context_init(struct waiter_context *waiter, if (pfd_count == 0) return -EINVAL; - for (i = 0; i < ARRAY_SIZE(entries); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(entries); ++i) { if (entries[i].type == type) break; } diff --git a/axfer/xfer-libasound-irq-mmap.c b/axfer/xfer-libasound-irq-mmap.c index 386e741..382ef92 100644 --- a/axfer/xfer-libasound-irq-mmap.c +++ b/axfer/xfer-libasound-irq-mmap.c @@ -53,7 +53,7 @@ static int irq_mmap_pre_process(struct libasound_state *state) return err; logging(state, "attributes for mapped page frame:\n"); - for (i = 0; i < layout->samples_per_frame; ++i) { + for (i = 0; i < (int)layout->samples_per_frame; ++i) { const snd_pcm_channel_area_t *area = areas + i; logging(state, " sample number: %d\n", i); @@ -152,7 +152,7 @@ static int irq_mmap_process_frames(struct libasound_state *state, frame_buf = buf; } else { int i; - for (i = 0; i < layout->samples_per_frame; ++i) { + for (i = 0; i < (int)layout->samples_per_frame; ++i) { layout->vector[i] = areas[i].addr; layout->vector[i] += snd_pcm_samples_to_bytes( state->handle, frame_offset); diff --git a/axfer/xfer-libasound-irq-rw.c b/axfer/xfer-libasound-irq-rw.c index 6ed1927..b7f0645 100644 --- a/axfer/xfer-libasound-irq-rw.c +++ b/axfer/xfer-libasound-irq-rw.c @@ -313,7 +313,7 @@ error: } static int w_process_frames_nonblocking(struct libasound_state *state, - snd_pcm_state_t status, + snd_pcm_state_t, unsigned int *frame_count, struct mapper_context *mapper, struct container_context *cntrs) diff --git a/axfer/xfer-libasound-timer-mmap.c b/axfer/xfer-libasound-timer-mmap.c index 5715144..cbe5c97 100644 --- a/axfer/xfer-libasound-timer-mmap.c +++ b/axfer/xfer-libasound-timer-mmap.c @@ -78,7 +78,7 @@ static int timer_mmap_pre_process(struct libasound_state *state) return err; logging(state, "attributes for mapped page frame:\n"); - for (i = 0; i < layout->samples_per_frame; ++i) { + for (i = 0; i < (int)layout->samples_per_frame; ++i) { const snd_pcm_channel_area_t *area = areas + i; logging(state, " sample number: %d\n", i); @@ -105,7 +105,7 @@ static void *get_buffer(struct libasound_state *state, frame_buf = buf; } else { int i; - for (i = 0; i < layout->samples_per_frame; ++i) { + for (i = 0; i < (int)layout->samples_per_frame; ++i) { layout->vector[i] = areas[i].addr; layout->vector[i] += snd_pcm_samples_to_bytes( state->handle, frame_offset); @@ -188,7 +188,7 @@ static int timer_mmap_process_frames(struct libasound_state *state, avail = snd_pcm_avail(state->handle); if (avail < 0) return (int)avail; - if (avail < planned_count) { + if (avail < (snd_pcm_sframes_t)planned_count) { logging(state, "Wake up but not enough space: %lu %lu %u\n", planned_count, avail, timeout_msec); diff --git a/axfer/xfer-libasound.c b/axfer/xfer-libasound.c index 00ff028..9713533 100644 --- a/axfer/xfer-libasound.c +++ b/axfer/xfer-libasound.c @@ -60,7 +60,7 @@ static const struct option l_opts[] = { }; static int xfer_libasound_init(struct xfer_context *xfer, - snd_pcm_stream_t direction) + snd_pcm_stream_t) { struct libasound_state *state = xfer->private_data; int err; @@ -887,7 +887,7 @@ static void xfer_libasound_destroy(struct xfer_context *xfer) state->log = NULL; } -static void xfer_libasound_help(struct xfer_context *xfer) +static void xfer_libasound_help(struct xfer_context *) { printf( " [BASICS]\n" diff --git a/axfer/xfer-options.c b/axfer/xfer-options.c index 3740b16..974570c 100644 --- a/axfer/xfer-options.c +++ b/axfer/xfer-options.c @@ -53,7 +53,7 @@ static int allocate_paths(struct xfer_context *xfer, char *const *paths, unsigned int count) { bool stdio = false; - int i; + unsigned int i; if (count == 0) { stdio = true; @@ -66,7 +66,7 @@ static int allocate_paths(struct xfer_context *xfer, char *const *paths, xfer->path_count = count; if (stdio) { - xfer->paths[0] = strndup("-", PATH_MAX); + xfer->paths[0] = strdup("-"); if (xfer->paths[0] == NULL) return -ENOMEM; } else { @@ -94,7 +94,7 @@ static int verify_cntr_format(struct xfer_context *xfer) }; int i; - for (i = 0; i < ARRAY_SIZE(entries); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(entries); ++i) { entry = &entries[i]; if (strcasecmp(xfer->cntr_format_literal, entry->literal)) continue; @@ -123,7 +123,7 @@ static int verify_sample_format(struct xfer_context *xfer) {"cdr", 44100, 2, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE}, {"dat", 48000, 2, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE}, }; - int i; + unsigned int i; xfer->sample_format = snd_pcm_format_value(xfer->sample_format_literal); if (xfer->sample_format != SND_PCM_FORMAT_UNKNOWN) @@ -447,7 +447,7 @@ static int generate_path_with_suffix(struct xfer_context *xfer, static int generate_path_without_suffix(struct xfer_context *xfer, const char *template, - unsigned int index, const char *suffix) + unsigned int index, const char *) { static const char *const single_format = "%s"; static const char *const multiple_format = "%s-%i"; @@ -498,7 +498,7 @@ static int create_paths(struct xfer_context *xfer, unsigned int path_count) { char *template; const char *suffix; - int i, j; + unsigned int i, j; int err = 0; // Can cause memory leak. @@ -545,7 +545,7 @@ static int fixup_paths(struct xfer_context *xfer) { const char *suffix; char *template; - int i, j; + unsigned int i, j; int err = 0; suffix = container_suffix_from_format(xfer->cntr_format); @@ -572,7 +572,7 @@ static int fixup_paths(struct xfer_context *xfer) int xfer_options_fixup_paths(struct xfer_context *xfer) { - int i, j; + unsigned int i, j; int err; if (xfer->path_count == 1) { diff --git a/axfer/xfer.c b/axfer/xfer.c index 6682b3b..3750e8a 100644 --- a/axfer/xfer.c +++ b/axfer/xfer.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 + // // xfer.c - receiver/transmiter of data frames. // @@ -20,7 +20,7 @@ static const char *const xfer_type_labels[] = { enum xfer_type xfer_type_from_label(const char *label) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(xfer_type_labels); ++i) { if (!strcmp(xfer_type_labels[i], label)) @@ -47,7 +47,7 @@ int xfer_context_init(struct xfer_context *xfer, enum xfer_type type, {XFER_TYPE_LIBFFADO, &xfer_libffado}, #endif }; - int i; + unsigned int i; int err; assert(xfer); @@ -84,7 +84,7 @@ int xfer_context_init(struct xfer_context *xfer, enum xfer_type type, void xfer_context_destroy(struct xfer_context *xfer) { - int i; + unsigned int i; assert(xfer);