axfer: 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:35:57 +02:00
parent 60bf4bb2af
commit ad5a1c0c88
22 changed files with 84 additions and 85 deletions

View file

@ -76,7 +76,7 @@ static int au_parser_pre_process(struct container_context *cntr,
struct parser_state *state = cntr->private_data; struct parser_state *state = cntr->private_data;
struct container_header header; struct container_header header;
enum code_id code_id; enum code_id code_id;
int i; unsigned int i;
int err; int err;
// Parse header. 4 bytes are enough to detect supported containers. // 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) uint64_t *byte_count)
{ {
struct builder_state *status = cntr->private_data; struct builder_state *status = cntr->private_data;
int i; unsigned int i;
for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { for (i = 0; i < ARRAY_SIZE(format_maps); ++i) {
if (format_maps[i].format == *format) if (format_maps[i].format == *format)

View file

@ -13,10 +13,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
static int raw_builder_pre_process(struct container_context *cntr, static int raw_builder_pre_process(struct container_context *,
snd_pcm_format_t *sample_format, snd_pcm_format_t *,
unsigned int *samples_per_frame, unsigned int *,
unsigned int *frames_per_second, unsigned int *,
uint64_t *byte_count) uint64_t *byte_count)
{ {
*byte_count = UINT64_MAX; *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, static int raw_parser_pre_process(struct container_context *cntr,
snd_pcm_format_t *sample_format, snd_pcm_format_t *,
unsigned int *samples_per_frame, unsigned int *,
unsigned int *frames_per_second, unsigned int *,
uint64_t *byte_count) uint64_t *byte_count)
{ {
struct stat buf = {0}; struct stat buf = {0};

View file

@ -349,7 +349,7 @@ static int wave_parser_pre_process(struct container_context *cntr,
struct parser_state *state = cntr->private_data; struct parser_state *state = cntr->private_data;
int phys_width; int phys_width;
const struct format_map *map; const struct format_map *map;
int i; unsigned int i;
int err; int err;
err = parse_riff_wave_format(cntr); err = parse_riff_wave_format(cntr);
@ -363,7 +363,7 @@ static int wave_parser_pre_process(struct container_context *cntr,
map = &format_maps[i]; map = &format_maps[i];
if (state->format != map->wformat) if (state->format != map->wformat)
continue; continue;
if (state->avail_bits_in_sample != if ((int)state->avail_bits_in_sample !=
snd_pcm_format_width(map->format)) snd_pcm_format_width(map->format))
continue; continue;
if (phys_width != snd_pcm_format_physical_width(map->format)) 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) uint64_t *byte_count)
{ {
struct builder_state *state = cntr->private_data; struct builder_state *state = cntr->private_data;
int i; unsigned int i;
// Validate parameters. // Validate parameters.
for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { for (i = 0; i < ARRAY_SIZE(format_maps); ++i) {

View file

@ -221,7 +221,7 @@ static int build_time_constant(unsigned int frames_per_second,
unsigned int samples_per_frame, uint16_t *code, unsigned int samples_per_frame, uint16_t *code,
bool extended) bool extended)
{ {
int i; unsigned int i;
// 16 bits are available for this purpose. // 16 bits are available for this purpose.
if (extended) { if (extended) {
@ -264,7 +264,7 @@ static unsigned int parse_time_constant(uint16_t code,
unsigned int *frames_per_second, unsigned int *frames_per_second,
bool extended) bool extended)
{ {
int i; unsigned int i;
if (extended) { if (extended) {
if (samples_per_frame > 2) 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) 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) { for (i = 0; i < ARRAY_SIZE(format_maps); ++i) {
if (code_id != format_maps[i].code_id) 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) uint64_t *byte_count)
{ {
struct parser_state *state = cntr->private_data; struct parser_state *state = cntr->private_data;
int i; unsigned int i;
int err; int err;
err = detect_container_version(cntr); err = detect_container_version(cntr);
@ -719,7 +719,7 @@ static int voc_builder_pre_process(struct container_context *cntr,
uint64_t *byte_count) uint64_t *byte_count)
{ {
struct builder_state *state = cntr->private_data; struct builder_state *state = cntr->private_data;
int i; unsigned int i;
// Validate parameters. // Validate parameters.
for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { for (i = 0; i < ARRAY_SIZE(format_maps); ++i) {

View file

@ -34,7 +34,7 @@ static const char *const suffixes[] = {
[CONTAINER_FORMAT_RAW] = "", [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]; return suffixes[format];
} }
@ -100,7 +100,7 @@ enum container_format container_format_from_path(const char *path)
const char *pos; const char *pos;
int i; int i;
for (i = 0; i < ARRAY_SIZE(suffixes); ++i) { for (i = 0; i < (int)ARRAY_SIZE(suffixes); ++i) {
suffix = suffixes[i]; suffix = suffixes[i];
// Check last part of the string. // 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)); err = container_recursive_read(cntr, cntr->magic, sizeof(cntr->magic));
if (err < 0) if (err < 0)
return err; return err;
for (i = 0; i < ARRAY_SIZE(parsers); ++i) { for (i = 0; i < (int)ARRAY_SIZE(parsers); ++i) {
parser = parsers[i]; parser = parsers[i];
size = strlen(parser->magic); size = strlen(parser->magic);
if (size > 4) if (size > 4)

View file

@ -60,7 +60,7 @@ struct container_context {
uint64_t handled_byte_count; 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); enum container_format container_format_from_path(const char *path);
int container_parser_init(struct container_context *cntr, int fd, int container_parser_init(struct container_context *cntr, int fd,
unsigned int verbose); unsigned int verbose);

View file

@ -33,7 +33,7 @@ static void align_frames_in_n(struct frame_cache *cache,
char **buf_ptrs = cache->buf_ptr; char **buf_ptrs = cache->buf_ptr;
unsigned int offset; unsigned int offset;
unsigned int size; unsigned int size;
int i; unsigned int i;
cache->remained_count -= consumed_count; cache->remained_count -= consumed_count;
@ -75,7 +75,7 @@ int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access,
} else { } else {
char **bufs = calloc(samples_per_frame, sizeof(*bufs)); char **bufs = calloc(samples_per_frame, sizeof(*bufs));
char **buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs)); char **buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs));
int i; unsigned int i;
cache->buf = bufs; cache->buf = bufs;
cache->buf_ptr = buf_ptrs; 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) { if (cache->access == SND_PCM_ACCESS_RW_NONINTERLEAVED) {
char **bufs = cache->buf; char **bufs = cache->buf;
if (bufs) { if (bufs) {
int i; unsigned int i;
for (i = 0; i < cache->samples_per_frame; ++i) for (i = 0; i < cache->samples_per_frame; ++i)
free(bufs[i]); free(bufs[i]);
} }

View file

@ -107,7 +107,7 @@ static bool decide_subcmd(int argc, char *const *argv, enum subcmds *subcmd)
return false; return false;
// Original command system. For long options. // 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) { for (j = 0; j < argc; ++j) {
if (!strcmp(long_opts[i].name, argv[j])) { if (!strcmp(long_opts[i].name, argv[j])) {
*subcmd = long_opts[i].subcmd; *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') argv[i][1] == '-' || argv[i][1] == '\0')
continue; continue;
for (pos = argv[i]; *pos != '\0'; ++pos) { 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) { if (*pos == short_opts[j].c) {
*subcmd = short_opts[j].subcmd; *subcmd = short_opts[j].subcmd;
return true; return true;
@ -161,7 +161,7 @@ static bool decide_direction(int argc, char *const *argv,
char *pos; char *pos;
// Original command system. For long options. // 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) { for (j = 0; j < argc; ++j) {
if (!strcmp(long_opts[i].name, argv[j])) { if (!strcmp(long_opts[i].name, argv[j])) {
*direction = long_opts[i].direction; *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') argv[i][1] == '-' || argv[i][1] == '\0')
continue; continue;
for (pos = argv[i]; *pos != '\0'; ++pos) { 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) { if (*pos == short_opts[j].c) {
*direction = short_opts[j].direction; *direction = short_opts[j].direction;
return true; return true;
@ -187,7 +187,7 @@ static bool decide_direction(int argc, char *const *argv,
} }
// If not decided yet, judge according to command name. // 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) { for (pos = argv[0] + strlen(argv[0]); pos != argv[0]; --pos) {
if (strstr(pos, aliases[i]) != NULL) { if (strstr(pos, aliases[i]) != NULL) {
*direction = i; *direction = i;
@ -212,7 +212,7 @@ static bool detect_subcmd(int argc, char *const *argv, enum subcmds *subcmd)
if (argc < 2) if (argc < 2)
return false; 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])) { if (!strcmp(argv[1], subcmds[i])) {
*subcmd = i; *subcmd = i;
return true; return true;

View file

@ -27,7 +27,7 @@ static void align_to_i(void *frame_buf, unsigned int frame_count,
unsigned int dst_pos; unsigned int dst_pos;
unsigned int src_pos; unsigned int src_pos;
struct container_context *cntr; struct container_context *cntr;
int i, j; unsigned int i, j;
// src: first channel in each of interleaved buffers in containers => // src: first channel in each of interleaved buffers in containers =>
// dst:interleaved. // dst:interleaved.
@ -55,7 +55,7 @@ static void align_from_i(void *frame_buf, unsigned int frame_count,
unsigned int src_pos; unsigned int src_pos;
unsigned int dst_pos; unsigned int dst_pos;
struct container_context *cntr; struct container_context *cntr;
int i, j; unsigned int i, j;
for (i = 0; i < cntr_count; ++i) { for (i = 0; i < cntr_count; ++i) {
dst = dst_bufs[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 multiple_state *state = mapper->private_data;
struct container_context *cntr; struct container_context *cntr;
int i; unsigned int i;
// Additionally, format of samples in the containers should be the same // Additionally, format of samples in the containers should be the same
// as the format in PCM substream. // 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; struct container_context *cntr;
char *src; char *src;
int i; unsigned int i;
int err = 0; int err = 0;
// TODO: arrangement for *frame_count. // 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) static void multiple_post_process(struct mapper_context *mapper)
{ {
struct multiple_state *state = mapper->private_data; struct multiple_state *state = mapper->private_data;
int i; unsigned int i;
if (state->bufs) { if (state->bufs) {
for (i = 0; i < state->cntr_count; ++i) { for (i = 0; i < state->cntr_count; ++i) {

View file

@ -24,7 +24,7 @@ static void align_to_vector(void *frame_buf, unsigned int frame_count,
char *dst; char *dst;
unsigned int src_pos; unsigned int src_pos;
unsigned int dst_pos; unsigned int dst_pos;
int i, j; unsigned int i, j;
// src: interleaved => dst: a set of interleaved buffers. // src: interleaved => dst: a set of interleaved buffers.
for (i = 0; i < samples_per_frame; ++i) { 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; char *src;
unsigned int dst_pos; unsigned int dst_pos;
unsigned int src_pos; unsigned int src_pos;
int i, j; unsigned int i, j;
// src: a set of interleaved buffers => dst:interleaved. // src: a set of interleaved buffers => dst:interleaved.
for (i = 0; i < samples_per_frame; ++i) { 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, static int single_pre_process(struct mapper_context *mapper,
struct container_context *cntrs, struct container_context *cntrs,
unsigned int cntr_count) unsigned int)
{ {
struct single_state *state = mapper->private_data; struct single_state *state = mapper->private_data;
unsigned int bytes_per_buffer; unsigned int bytes_per_buffer;
@ -110,7 +110,7 @@ static int single_muxer_process_frames(struct mapper_context *mapper,
void *frame_buf, void *frame_buf,
unsigned int *frame_count, unsigned int *frame_count,
struct container_context *cntrs, struct container_context *cntrs,
unsigned int cntr_count) unsigned int)
{ {
struct single_state *state = mapper->private_data; struct single_state *state = mapper->private_data;
void *src; void *src;
@ -141,7 +141,7 @@ static int single_demuxer_process_frames(struct mapper_context *mapper,
void *frame_buf, void *frame_buf,
unsigned int *frame_count, unsigned int *frame_count,
struct container_context *cntrs, struct container_context *cntrs,
unsigned int cntr_count) unsigned int)
{ {
struct single_state *state = mapper->private_data; struct single_state *state = mapper->private_data;
void *dst; void *dst;

View file

@ -19,10 +19,9 @@ enum list_op {
}; };
static int dump_device(snd_ctl_t *handle, const char *id, const char *name, 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; unsigned int i, count;
int i;
int err; int err;
printf("card %i: %s [%s], device %i: %s [%s]\n", 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; continue;
} }
printf(" Subdevice #%i: %s\n", printf(" Subdevice #%u: %s\n",
i, snd_pcm_info_get_subdevice_name(info)); 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) if (argc < 2)
return false; 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])) { if (!strcmp(argv[1], ops[i])) {
*op = i; *op = i;
return true; return true;

View file

@ -31,7 +31,7 @@ static struct context *ctx_ptr;
static void handle_unix_signal_for_finish(int sig) static void handle_unix_signal_for_finish(int sig)
{ {
int i; unsigned int i;
for (i = 0; i < ctx_ptr->cntr_count; ++i) for (i = 0; i < ctx_ptr->cntr_count; ++i)
ctx_ptr->cntrs[i].interrupted = true; ctx_ptr->cntrs[i].interrupted = true;
@ -40,7 +40,7 @@ static void handle_unix_signal_for_finish(int sig)
ctx_ptr->interrupted = true; 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; sigset_t curr, prev;
struct sigaction sa = {0}; 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 samples_per_frame = 0;
unsigned int frames_per_second = 0; unsigned int frames_per_second = 0;
unsigned int channels; unsigned int channels;
int i; unsigned int i;
int err; int err;
err = xfer_context_pre_process(&ctx->xfer, &sample_format, 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; snd_pcm_format_t sample_format = SND_PCM_FORMAT_UNKNOWN;
unsigned int samples_per_frame = 0; unsigned int samples_per_frame = 0;
unsigned int frames_per_second = 0; unsigned int frames_per_second = 0;
int i; unsigned int i;
int err; int err;
// Prepare for containers. // Prepare for containers.
@ -374,7 +374,7 @@ static int context_process_frames(struct context *ctx,
{ {
bool verbose = ctx->xfer.verbose > 2; bool verbose = ctx->xfer.verbose > 2;
unsigned int frame_count; unsigned int frame_count;
int i; unsigned int i;
int err = 0; int err = 0;
if (!ctx->xfer.quiet) { if (!ctx->xfer.quiet) {
@ -439,10 +439,10 @@ static int context_process_frames(struct context *ctx,
} }
static void context_post_process(struct context *ctx, static void context_post_process(struct context *ctx,
uint64_t accumulated_frame_count) uint64_t)
{ {
uint64_t total_frame_count; uint64_t total_frame_count;
int i; unsigned int i;
xfer_context_post_process(&ctx->xfer); 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) 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 expected_frame_count = 0;
uint64_t actual_frame_count = 0; uint64_t actual_frame_count = 0;
int err = 0; int err = 0;

View file

@ -36,7 +36,7 @@ static int epoll_prepare(struct waiter_context *waiter)
if (state->epfd < 0) if (state->epfd < 0)
return -errno; return -errno;
for (i = 0; i < waiter->pfd_count; ++i) { for (i = 0; i < (int)waiter->pfd_count; ++i) {
struct epoll_event ev = { struct epoll_event ev = {
.data.fd = waiter->pfds[i].fd, .data.fd = waiter->pfds[i].fd,
.events = waiter->pfds[i].events, .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) { if (ev_count > 0) {
// Reconstruct data of pollfd structure. // 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]; 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) { if (waiter->pfds[i].fd == ev->data.fd) {
waiter->pfds[i].revents = ev->events; waiter->pfds[i].revents = ev->events;
break; break;
@ -83,7 +83,7 @@ static void epoll_release(struct waiter_context *waiter)
struct epoll_state *state = waiter->private_data; struct epoll_state *state = waiter->private_data;
int i; 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; int fd = waiter->pfds[i].fd;
epoll_ctl(state->epfd, EPOLL_CTL_DEL, fd, NULL); epoll_ctl(state->epfd, EPOLL_CTL_DEL, fd, NULL);
} }

View file

@ -13,7 +13,7 @@
#include <errno.h> #include <errno.h>
#include <poll.h> #include <poll.h>
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. // Nothing to do because an instance of waiter has required data.
return 0; return 0;
@ -30,7 +30,7 @@ static int poll_wait_event(struct waiter_context *waiter, int timeout_msec)
return err; 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. // Nothing to do because an instance of waiter has required data.
return; return;

View file

@ -34,7 +34,7 @@ struct select_state {
fd_set rfds_ex; fd_set rfds_ex;
}; };
static int select_prepare(struct waiter_context *waiter) static int select_prepare(struct waiter_context *)
{ {
return 0; return 0;
} }
@ -53,7 +53,7 @@ static int select_wait_event(struct waiter_context *waiter, int timeout_msec)
FD_ZERO(&state->rfds_ex); FD_ZERO(&state->rfds_ex);
fd_max = 0; fd_max = 0;
for (i = 0; i < waiter->pfd_count; ++i) { for (i = 0; i < (int)waiter->pfd_count; ++i) {
pfd = &waiter->pfds[i]; pfd = &waiter->pfds[i];
if (pfd->events & POLLIN_SET) if (pfd->events & POLLIN_SET)
@ -79,7 +79,7 @@ static int select_wait_event(struct waiter_context *waiter, int timeout_msec)
if (err < 0) if (err < 0)
return -errno; return -errno;
for (i = 0; i < waiter->pfd_count; ++i) { for (i = 0; i < (int)waiter->pfd_count; ++i) {
pfd = &waiter->pfds[i]; pfd = &waiter->pfds[i];
pfd->revents = 0; pfd->revents = 0;
@ -94,7 +94,7 @@ static int select_wait_event(struct waiter_context *waiter, int timeout_msec)
return err; return err;
} }
static void select_release(struct waiter_context *waiter) static void select_release(struct waiter_context *)
{ {
return; return;
} }

View file

@ -25,7 +25,7 @@ enum waiter_type waiter_type_from_label(const char *label)
{ {
int i; 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)) if (!strcmp(waiter_type_labels[i], label))
return i; return i;
} }
@ -54,7 +54,7 @@ int waiter_context_init(struct waiter_context *waiter,
if (pfd_count == 0) if (pfd_count == 0)
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(entries); ++i) { for (i = 0; i < (int)ARRAY_SIZE(entries); ++i) {
if (entries[i].type == type) if (entries[i].type == type)
break; break;
} }

View file

@ -53,7 +53,7 @@ static int irq_mmap_pre_process(struct libasound_state *state)
return err; return err;
logging(state, "attributes for mapped page frame:\n"); 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; const snd_pcm_channel_area_t *area = areas + i;
logging(state, " sample number: %d\n", 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; frame_buf = buf;
} else { } else {
int i; 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] = areas[i].addr;
layout->vector[i] += snd_pcm_samples_to_bytes( layout->vector[i] += snd_pcm_samples_to_bytes(
state->handle, frame_offset); state->handle, frame_offset);

View file

@ -313,7 +313,7 @@ error:
} }
static int w_process_frames_nonblocking(struct libasound_state *state, static int w_process_frames_nonblocking(struct libasound_state *state,
snd_pcm_state_t status, snd_pcm_state_t,
unsigned int *frame_count, unsigned int *frame_count,
struct mapper_context *mapper, struct mapper_context *mapper,
struct container_context *cntrs) struct container_context *cntrs)

View file

@ -78,7 +78,7 @@ static int timer_mmap_pre_process(struct libasound_state *state)
return err; return err;
logging(state, "attributes for mapped page frame:\n"); 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; const snd_pcm_channel_area_t *area = areas + i;
logging(state, " sample number: %d\n", i); logging(state, " sample number: %d\n", i);
@ -105,7 +105,7 @@ static void *get_buffer(struct libasound_state *state,
frame_buf = buf; frame_buf = buf;
} else { } else {
int i; 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] = areas[i].addr;
layout->vector[i] += snd_pcm_samples_to_bytes( layout->vector[i] += snd_pcm_samples_to_bytes(
state->handle, frame_offset); state->handle, frame_offset);
@ -188,7 +188,7 @@ static int timer_mmap_process_frames(struct libasound_state *state,
avail = snd_pcm_avail(state->handle); avail = snd_pcm_avail(state->handle);
if (avail < 0) if (avail < 0)
return (int)avail; return (int)avail;
if (avail < planned_count) { if (avail < (snd_pcm_sframes_t)planned_count) {
logging(state, logging(state,
"Wake up but not enough space: %lu %lu %u\n", "Wake up but not enough space: %lu %lu %u\n",
planned_count, avail, timeout_msec); planned_count, avail, timeout_msec);

View file

@ -60,7 +60,7 @@ static const struct option l_opts[] = {
}; };
static int xfer_libasound_init(struct xfer_context *xfer, 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; struct libasound_state *state = xfer->private_data;
int err; int err;
@ -887,7 +887,7 @@ static void xfer_libasound_destroy(struct xfer_context *xfer)
state->log = NULL; state->log = NULL;
} }
static void xfer_libasound_help(struct xfer_context *xfer) static void xfer_libasound_help(struct xfer_context *)
{ {
printf( printf(
" [BASICS]\n" " [BASICS]\n"

View file

@ -53,7 +53,7 @@ static int allocate_paths(struct xfer_context *xfer, char *const *paths,
unsigned int count) unsigned int count)
{ {
bool stdio = false; bool stdio = false;
int i; unsigned int i;
if (count == 0) { if (count == 0) {
stdio = true; stdio = true;
@ -66,7 +66,7 @@ static int allocate_paths(struct xfer_context *xfer, char *const *paths,
xfer->path_count = count; xfer->path_count = count;
if (stdio) { if (stdio) {
xfer->paths[0] = strndup("-", PATH_MAX); xfer->paths[0] = strdup("-");
if (xfer->paths[0] == NULL) if (xfer->paths[0] == NULL)
return -ENOMEM; return -ENOMEM;
} else { } else {
@ -94,7 +94,7 @@ static int verify_cntr_format(struct xfer_context *xfer)
}; };
int i; int i;
for (i = 0; i < ARRAY_SIZE(entries); ++i) { for (i = 0; i < (int)ARRAY_SIZE(entries); ++i) {
entry = &entries[i]; entry = &entries[i];
if (strcasecmp(xfer->cntr_format_literal, entry->literal)) if (strcasecmp(xfer->cntr_format_literal, entry->literal))
continue; 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}, {"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}, {"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); xfer->sample_format = snd_pcm_format_value(xfer->sample_format_literal);
if (xfer->sample_format != SND_PCM_FORMAT_UNKNOWN) 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, static int generate_path_without_suffix(struct xfer_context *xfer,
const char *template, 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 single_format = "%s";
static const char *const multiple_format = "%s-%i"; 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; char *template;
const char *suffix; const char *suffix;
int i, j; unsigned int i, j;
int err = 0; int err = 0;
// Can cause memory leak. // Can cause memory leak.
@ -545,7 +545,7 @@ static int fixup_paths(struct xfer_context *xfer)
{ {
const char *suffix; const char *suffix;
char *template; char *template;
int i, j; unsigned int i, j;
int err = 0; int err = 0;
suffix = container_suffix_from_format(xfer->cntr_format); 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 xfer_options_fixup_paths(struct xfer_context *xfer)
{ {
int i, j; unsigned int i, j;
int err; int err;
if (xfer->path_count == 1) { if (xfer->path_count == 1) {

View file

@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// //
// xfer.c - receiver/transmiter of data frames. // 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) 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) { for (i = 0; i < ARRAY_SIZE(xfer_type_labels); ++i) {
if (!strcmp(xfer_type_labels[i], label)) 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}, {XFER_TYPE_LIBFFADO, &xfer_libffado},
#endif #endif
}; };
int i; unsigned int i;
int err; int err;
assert(xfer); 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) void xfer_context_destroy(struct xfer_context *xfer)
{ {
int i; unsigned int i;
assert(xfer); assert(xfer);