mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
add a few more gcc warning flags and fix quite a few problems found by doing so
This commit is contained in:
parent
047eb52b52
commit
b7026bf248
99 changed files with 810 additions and 776 deletions
|
|
@ -258,7 +258,7 @@ static int mmap_write(struct userdata *u) {
|
|||
u->out_mmap_saved_nfrags = 0;
|
||||
|
||||
if (info.blocks > 0)
|
||||
mmap_fill_memblocks(u, info.blocks);
|
||||
mmap_fill_memblocks(u, (unsigned) info.blocks);
|
||||
|
||||
return info.blocks;
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ static int mmap_read(struct userdata *u) {
|
|||
u->in_mmap_saved_nfrags = 0;
|
||||
|
||||
if (info.blocks > 0) {
|
||||
mmap_post_memblocks(u, info.blocks);
|
||||
mmap_post_memblocks(u, (unsigned) info.blocks);
|
||||
mmap_clear_memblocks(u, u->in_nfrags/2);
|
||||
}
|
||||
|
||||
|
|
@ -356,12 +356,12 @@ static pa_usec_t mmap_sink_get_latency(struct userdata *u) {
|
|||
|
||||
u->out_mmap_saved_nfrags += info.blocks;
|
||||
|
||||
bpos = ((u->out_mmap_current + u->out_mmap_saved_nfrags) * u->out_fragment_size) % u->out_hwbuf_size;
|
||||
bpos = ((u->out_mmap_current + (unsigned) u->out_mmap_saved_nfrags) * u->out_fragment_size) % u->out_hwbuf_size;
|
||||
|
||||
if (bpos <= (size_t) info.ptr)
|
||||
n = u->out_hwbuf_size - (info.ptr - bpos);
|
||||
n = u->out_hwbuf_size - ((size_t) info.ptr - bpos);
|
||||
else
|
||||
n = bpos - info.ptr;
|
||||
n = bpos - (size_t) info.ptr;
|
||||
|
||||
/* pa_log("n = %u, bpos = %u, ptr = %u, total=%u, fragsize = %u, n_frags = %u\n", n, bpos, (unsigned) info.ptr, total, u->out_fragment_size, u->out_fragments); */
|
||||
|
||||
|
|
@ -380,12 +380,12 @@ static pa_usec_t mmap_source_get_latency(struct userdata *u) {
|
|||
}
|
||||
|
||||
u->in_mmap_saved_nfrags += info.blocks;
|
||||
bpos = ((u->in_mmap_current + u->in_mmap_saved_nfrags) * u->in_fragment_size) % u->in_hwbuf_size;
|
||||
bpos = ((u->in_mmap_current + (unsigned) u->in_mmap_saved_nfrags) * u->in_fragment_size) % u->in_hwbuf_size;
|
||||
|
||||
if (bpos <= (size_t) info.ptr)
|
||||
n = info.ptr - bpos;
|
||||
n = (size_t) info.ptr - bpos;
|
||||
else
|
||||
n = u->in_hwbuf_size - bpos + info.ptr;
|
||||
n = u->in_hwbuf_size - bpos + (size_t) info.ptr;
|
||||
|
||||
/* pa_log("n = %u, bpos = %u, ptr = %u, total=%u, fragsize = %u, n_frags = %u\n", n, bpos, (unsigned) info.ptr, total, u->in_fragment_size, u->in_fragments); */
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ static pa_usec_t io_sink_get_latency(struct userdata *u) {
|
|||
pa_log_info("Device doesn't support SNDCTL_DSP_GETODELAY: %s", pa_cstrerror(errno));
|
||||
u->use_getodelay = 0;
|
||||
} else
|
||||
r = pa_bytes_to_usec(arg, &u->sink->sample_spec);
|
||||
r = pa_bytes_to_usec((size_t) arg, &u->sink->sample_spec);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ static pa_usec_t io_sink_get_latency(struct userdata *u) {
|
|||
pa_log_info("Device doesn't support SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno));
|
||||
u->use_getospace = 0;
|
||||
} else
|
||||
r = pa_bytes_to_usec(info.bytes, &u->sink->sample_spec);
|
||||
r = pa_bytes_to_usec((size_t) info.bytes, &u->sink->sample_spec);
|
||||
}
|
||||
|
||||
if (u->memchunk.memblock)
|
||||
|
|
@ -437,7 +437,7 @@ static pa_usec_t io_source_get_latency(struct userdata *u) {
|
|||
pa_log_info("Device doesn't support SNDCTL_DSP_GETISPACE: %s", pa_cstrerror(errno));
|
||||
u->use_getispace = 0;
|
||||
} else
|
||||
r = pa_bytes_to_usec(info.bytes, &u->source->sample_spec);
|
||||
r = pa_bytes_to_usec((size_t) info.bytes, &u->source->sample_spec);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
@ -528,8 +528,9 @@ static int unsuspend(struct userdata *u) {
|
|||
if ((u->fd = pa_oss_open(u->device_name, &m, NULL)) < 0) {
|
||||
pa_log_warn("Resume failed, device busy (%s)", pa_cstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (m != u->mode)
|
||||
if (m != u->mode) {
|
||||
pa_log_warn("Resume failed, couldn't open device with original access mode.");
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -859,7 +860,7 @@ static int source_set_volume(pa_source *s) {
|
|||
static void thread_func(void *userdata) {
|
||||
struct userdata *u = userdata;
|
||||
int write_type = 0, read_type = 0;
|
||||
unsigned short revents = 0;
|
||||
short revents = 0;
|
||||
|
||||
pa_assert(u);
|
||||
|
||||
|
|
@ -935,7 +936,7 @@ static void thread_func(void *userdata) {
|
|||
ssize_t t;
|
||||
|
||||
if (u->memchunk.length <= 0)
|
||||
pa_sink_render(u->sink, l, &u->memchunk);
|
||||
pa_sink_render(u->sink, (size_t) l, &u->memchunk);
|
||||
|
||||
pa_assert(u->memchunk.length > 0);
|
||||
|
||||
|
|
@ -965,8 +966,8 @@ static void thread_func(void *userdata) {
|
|||
|
||||
} else {
|
||||
|
||||
u->memchunk.index += t;
|
||||
u->memchunk.length -= t;
|
||||
u->memchunk.index += (size_t) t;
|
||||
u->memchunk.length -= (size_t) t;
|
||||
|
||||
if (u->memchunk.length <= 0) {
|
||||
pa_memblock_unref(u->memchunk.memblock);
|
||||
|
|
@ -1031,7 +1032,8 @@ static void thread_func(void *userdata) {
|
|||
}
|
||||
|
||||
while (l > 0) {
|
||||
ssize_t t, k;
|
||||
ssize_t t;
|
||||
size_t k;
|
||||
|
||||
pa_assert(l > 0);
|
||||
|
||||
|
|
@ -1039,8 +1041,8 @@ static void thread_func(void *userdata) {
|
|||
|
||||
k = pa_memblock_get_length(memchunk.memblock);
|
||||
|
||||
if (k > l)
|
||||
k = l;
|
||||
if (k > (size_t) l)
|
||||
k = (size_t) l;
|
||||
|
||||
k = (k/u->frame_size)*u->frame_size;
|
||||
|
||||
|
|
@ -1071,7 +1073,7 @@ static void thread_func(void *userdata) {
|
|||
|
||||
} else {
|
||||
memchunk.index = 0;
|
||||
memchunk.length = t;
|
||||
memchunk.length = (size_t) t;
|
||||
|
||||
pa_source_post(u->source, &memchunk);
|
||||
pa_memblock_unref(memchunk.memblock);
|
||||
|
|
@ -1099,9 +1101,9 @@ static void thread_func(void *userdata) {
|
|||
pa_assert(u->fd >= 0);
|
||||
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
|
||||
pollfd->events =
|
||||
((u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) ? POLLIN : 0) |
|
||||
((u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state)) ? POLLOUT : 0);
|
||||
pollfd->events = (short)
|
||||
(((u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) ? POLLIN : 0) |
|
||||
((u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state)) ? POLLOUT : 0));
|
||||
}
|
||||
|
||||
/* Hmm, nothing to do. Let's sleep */
|
||||
|
|
@ -1179,10 +1181,10 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
nfrags = m->core->default_n_fragments;
|
||||
frag_size = pa_usec_to_bytes(m->core->default_fragment_size_msec*1000, &ss);
|
||||
nfrags = (int) m->core->default_n_fragments;
|
||||
frag_size = (int) pa_usec_to_bytes(m->core->default_fragment_size_msec*1000, &ss);
|
||||
if (frag_size <= 0)
|
||||
frag_size = pa_frame_size(&ss);
|
||||
frag_size = (int) pa_frame_size(&ss);
|
||||
|
||||
if (pa_modargs_get_value_s32(ma, "fragments", &nfrags) < 0 || pa_modargs_get_value_s32(ma, "fragment_size", &frag_size) < 0) {
|
||||
pa_log("Failed to parse fragments arguments");
|
||||
|
|
@ -1238,8 +1240,8 @@ int pa__init(pa_module*m) {
|
|||
u->mode = mode;
|
||||
u->frame_size = pa_frame_size(&ss);
|
||||
u->device_name = pa_xstrdup(dev);
|
||||
u->in_nfrags = u->out_nfrags = u->nfrags = nfrags;
|
||||
u->out_fragment_size = u->in_fragment_size = u->frag_size = frag_size;
|
||||
u->in_nfrags = u->out_nfrags = (uint32_t) (u->nfrags = nfrags);
|
||||
u->out_fragment_size = u->in_fragment_size = (uint32_t) (u->frag_size = frag_size);
|
||||
u->use_mmap = use_mmap;
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
|
||||
|
|
@ -1248,15 +1250,15 @@ int pa__init(pa_module*m) {
|
|||
|
||||
if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) >= 0) {
|
||||
pa_log_info("Input -- %u fragments of size %u.", info.fragstotal, info.fragsize);
|
||||
u->in_fragment_size = info.fragsize;
|
||||
u->in_nfrags = info.fragstotal;
|
||||
u->in_fragment_size = (uint32_t) info.fragsize;
|
||||
u->in_nfrags = (uint32_t) info.fragstotal;
|
||||
u->use_getispace = TRUE;
|
||||
}
|
||||
|
||||
if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) >= 0) {
|
||||
pa_log_info("Output -- %u fragments of size %u.", info.fragstotal, info.fragsize);
|
||||
u->out_fragment_size = info.fragsize;
|
||||
u->out_nfrags = info.fragstotal;
|
||||
u->out_fragment_size = (uint32_t) info.fragsize;
|
||||
u->out_nfrags = (uint32_t) info.fragstotal;
|
||||
u->use_getospace = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue