From 36550f4a66ae28e1b81b9b818c38cd0fcd1302a1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 1 Sep 2004 00:46:56 +0000 Subject: remove most -W compiler warnings git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@164 fefdeb5f-60dc-0310-8127-8f9354f1896f --- doc/todo | 8 +++----- polyp/memchunk.c | 6 +++--- polyp/module-oss-mmap.c | 4 ++-- polyp/pacat.c | 4 ++-- polyp/parec-simple.c | 2 +- polyp/polyplib-internal.h | 2 +- polyp/polyplib-simple.c | 6 +++--- polyp/protocol-esound.c | 30 +++++++++++++++--------------- polyp/protocol-simple.c | 4 ++-- polyp/pstream.c | 10 +++++----- polyp/resampler.c | 4 ++-- polyp/sample-util.c | 8 ++++---- polyp/socket-client.c | 3 ++- polyp/strbuf.c | 2 +- 14 files changed, 46 insertions(+), 47 deletions(-) diff --git a/doc/todo b/doc/todo index f8ebd9bb..d3baff16 100644 --- a/doc/todo +++ b/doc/todo @@ -10,12 +10,13 @@ autoload management - more complete pactl - daemon autostart -- cleanup tagstruct (add s32, pa_volume_t, pa_usec_t) -- xmlrpc +- cleanup tagstruct and modargs (add s32, pa_volume_t, pa_usec_t) - remove all gcc warnings - esd compatible startup script or personality +- limit number of concurrent streams ** later *** +- xmlrpc/http - slp/rendezvous - modinfo - make alsa modules use mmap @@ -28,6 +29,3 @@ backends for: - gstreamer - portaudio - python - -modules: -- http? diff --git a/polyp/memchunk.c b/polyp/memchunk.c index 920189e2..87b9c1bd 100644 --- a/polyp/memchunk.c +++ b/polyp/memchunk.c @@ -40,7 +40,7 @@ void pa_memchunk_make_writable(struct pa_memchunk *c, struct pa_memblock_stat *s n = pa_memblock_new(c->length, s); assert(n); - memcpy(n->data, c->memblock->data+c->index, c->length); + memcpy(n->data, (uint8_t*) c->memblock->data+c->index, c->length); pa_memblock_unref(c->memblock); c->memblock = n; c->index = 0; @@ -100,7 +100,7 @@ int pa_mcalign_pop(struct pa_mcalign *m, struct pa_memchunk *c) { l = m->chunk.length; assert(m->buffer && l); - memcpy(m->buffer + m->buffer_fill, m->chunk.memblock->data + m->chunk.index, l); + memcpy((uint8_t*) m->buffer + m->buffer_fill, (uint8_t*) m->chunk.memblock->data + m->chunk.index, l); m->buffer_fill += l; m->chunk.index += l; m->chunk.length -= l; @@ -132,7 +132,7 @@ int pa_mcalign_pop(struct pa_mcalign *m, struct pa_memchunk *c) { assert(!m->buffer); m->buffer = pa_xmalloc(m->base); m->chunk.length -= m->buffer_fill; - memcpy(m->buffer, m->chunk.memblock->data + m->chunk.index + m->chunk.length, m->buffer_fill); + memcpy(m->buffer, (uint8_t*) m->chunk.memblock->data + m->chunk.index + m->chunk.length, m->buffer_fill); } if (m->chunk.length) { diff --git a/polyp/module-oss-mmap.c b/polyp/module-oss-mmap.c index 05e06178..5c3be1ad 100644 --- a/polyp/module-oss-mmap.c +++ b/polyp/module-oss-mmap.c @@ -100,7 +100,7 @@ static void out_fill_memblocks(struct userdata *u, unsigned n) { if (u->out_memblocks[u->out_current]) pa_memblock_unref_fixed(u->out_memblocks[u->out_current]); - chunk.memblock = u->out_memblocks[u->out_current] = pa_memblock_new_fixed(u->out_mmap+u->out_fragment_size*u->out_current, u->out_fragment_size, u->core->memblock_stat); + chunk.memblock = u->out_memblocks[u->out_current] = pa_memblock_new_fixed((uint8_t*)u->out_mmap+u->out_fragment_size*u->out_current, u->out_fragment_size, u->core->memblock_stat); assert(chunk.memblock); chunk.length = chunk.memblock->length; chunk.index = 0; @@ -141,7 +141,7 @@ static void in_post_memblocks(struct userdata *u, unsigned n) { struct pa_memchunk chunk; if (!u->in_memblocks[u->in_current]) { - chunk.memblock = u->in_memblocks[u->in_current] = pa_memblock_new_fixed(u->in_mmap+u->in_fragment_size*u->in_current, u->in_fragment_size, u->core->memblock_stat); + chunk.memblock = u->in_memblocks[u->in_current] = pa_memblock_new_fixed((uint8_t*) u->in_mmap+u->in_fragment_size*u->in_current, u->in_fragment_size, u->core->memblock_stat); chunk.length = chunk.memblock->length; chunk.index = 0; diff --git a/polyp/pacat.c b/polyp/pacat.c index 9efa552a..b251cc35 100644 --- a/polyp/pacat.c +++ b/polyp/pacat.c @@ -65,7 +65,7 @@ static void do_stream_write(size_t length) { if (l > buffer_length) l = buffer_length; - pa_stream_write(stream, buffer+buffer_index, l, NULL, 0); + pa_stream_write(stream, (uint8_t*) buffer + buffer_index, l, NULL, 0); buffer_length -= l; buffer_index += l; @@ -250,7 +250,7 @@ static void stdout_callback(struct pa_mainloop_api*a, struct pa_io_event *e, int assert(buffer_length); - if ((r = write(fd, buffer+buffer_index, buffer_length)) <= 0) { + if ((r = write(fd, (uint8_t*) buffer+buffer_index, buffer_length)) <= 0) { fprintf(stderr, "write() failed: %s\n", strerror(errno)); quit(1); diff --git a/polyp/parec-simple.c b/polyp/parec-simple.c index 74f0a0f7..7e0931ae 100644 --- a/polyp/parec-simple.c +++ b/polyp/parec-simple.c @@ -47,7 +47,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) { break; ret += r; - data += r; + data = (uint8_t*) data + r; size -= r; } diff --git a/polyp/polyplib-internal.h b/polyp/polyplib-internal.h index 8f1a4942..813bb04e 100644 --- a/polyp/polyplib-internal.h +++ b/polyp/polyplib-internal.h @@ -34,7 +34,7 @@ #include "llist.h" #include "native-common.h" -#define DEFAULT_TLENGTH (10240*4) +#define DEFAULT_TLENGTH (10240*8) #define DEFAULT_MAXLENGTH ((DEFAULT_TLENGTH*3)/2) #define DEFAULT_PREBUF DEFAULT_TLENGTH #define DEFAULT_MINREQ 512 diff --git a/polyp/polyplib-simple.c b/polyp/polyplib-simple.c index c71d59a4..ccd39c2a 100644 --- a/polyp/polyplib-simple.c +++ b/polyp/polyplib-simple.c @@ -188,7 +188,7 @@ int pa_simple_write(struct pa_simple *p, const void*data, size_t length, int *pe l = length; pa_stream_write(p->stream, data, l, NULL, 0); - data += l; + data = (uint8_t*) data + l; length -= l; } @@ -222,9 +222,9 @@ int pa_simple_read(struct pa_simple *p, void*data, size_t length, int *perror) { if (p->read_length <= l) l = p->read_length; - memcpy(data, p->read_data+p->read_index, l); + memcpy(data, (uint8_t*) p->read_data+p->read_index, l); - data += l; + data = (uint8_t*) data + l; length -= l; p->read_index += l; diff --git a/polyp/protocol-esound.c b/polyp/protocol-esound.c index 2059dab8..d6e2bf6b 100644 --- a/polyp/protocol-esound.c +++ b/polyp/protocol-esound.c @@ -210,7 +210,7 @@ static void* connection_write(struct connection *c, size_t length) { i = c->write_data_length; c->write_data_length += length; - return c->write_data+i; + return (uint8_t*) c->write_data+i; } static void format_esd2native(int format, struct pa_sample_spec *ss) { @@ -245,7 +245,7 @@ static int esd_proto_connect(struct connection *c, esd_proto_t request, const vo c->authorized = 1; } - ekey = *(uint32_t*)(data+ESD_KEY_LEN); + ekey = *(uint32_t*)((uint8_t*) data+ESD_KEY_LEN); if (ekey == ESD_ENDIAN_KEY) c->swap_byte_order = 0; else if (ekey == ESD_SWAP_ENDIAN_KEY) @@ -283,7 +283,7 @@ static int esd_proto_stream_play(struct connection *c, esd_proto_t request, cons return -1; } - strncpy(name, data + sizeof(int)*2, sizeof(name)); + strncpy(name, (char*) data + sizeof(int)*2, sizeof(name)); name[sizeof(name)-1] = 0; pa_client_rename(c->client, name); @@ -347,7 +347,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co return -1; } - strncpy(name, data + sizeof(int)*2, sizeof(name)); + strncpy(name, (char*) data + sizeof(int)*2, sizeof(name)); name[sizeof(name)-1] = 0; pa_client_rename(c->client, name); @@ -415,7 +415,7 @@ static int esd_proto_server_info(struct connection *c, esd_proto_t request, cons } static int esd_proto_all_info(struct connection *c, esd_proto_t request, const void *data, size_t length) { - void *response; + uint8_t *response; size_t t, k, s; struct connection *conn; size_t index = PA_IDXSET_INVALID; @@ -451,7 +451,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v /* name */ assert(conn->client); - strncpy(response, conn->client->name, ESD_NAME_MAX); + strncpy((char*) response, conn->client->name, ESD_NAME_MAX); response += ESD_NAME_MAX; /* rate */ @@ -491,9 +491,9 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v /* name */ if (strncmp(ce->name, SCACHE_PREFIX, sizeof(SCACHE_PREFIX)-1) == 0) - strncpy(response, ce->name+sizeof(SCACHE_PREFIX)-1, ESD_NAME_MAX); + strncpy((char*) response, ce->name+sizeof(SCACHE_PREFIX)-1, ESD_NAME_MAX); else - snprintf(response, ESD_NAME_MAX, "native.%s", ce->name); + snprintf((char*) response, ESD_NAME_MAX, "native.%s", ce->name); response += ESD_NAME_MAX; /* rate */ @@ -570,7 +570,7 @@ static int esd_proto_sample_cache(struct connection *c, esd_proto_t request, con return -1; strcpy(name, SCACHE_PREFIX); - strncpy(name+sizeof(SCACHE_PREFIX)-1, data+3*sizeof(int), ESD_NAME_MAX); + strncpy(name+sizeof(SCACHE_PREFIX)-1, (char*) data+3*sizeof(int), ESD_NAME_MAX); name[sizeof(name)-1] = 0; assert(!c->scache_memchunk.memblock); @@ -661,7 +661,7 @@ static int do_read(struct connection *c) { ssize_t r; assert(c->read_data_length < sizeof(c->request)); - if ((r = pa_iochannel_read(c->io, ((void*) &c->request) + c->read_data_length, sizeof(c->request) - c->read_data_length)) <= 0) { + if ((r = pa_iochannel_read(c->io, ((uint8_t*) &c->request) + c->read_data_length, sizeof(c->request) - c->read_data_length)) <= 0) { fprintf(stderr, "protocol-esound.c: read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); return -1; } @@ -708,7 +708,7 @@ static int do_read(struct connection *c) { assert(c->read_data && c->read_data_length < handler->data_length); - if ((r = pa_iochannel_read(c->io, c->read_data + c->read_data_length, handler->data_length - c->read_data_length)) <= 0) { + if ((r = pa_iochannel_read(c->io, (uint8_t*) c->read_data + c->read_data_length, handler->data_length - c->read_data_length)) <= 0) { fprintf(stderr, "protocol-esound.c: read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); return -1; } @@ -728,7 +728,7 @@ static int do_read(struct connection *c) { assert(c->scache_memchunk.memblock && c->scache_name && c->scache_memchunk.index < c->scache_memchunk.length); - if ((r = pa_iochannel_read(c->io, c->scache_memchunk.memblock->data+c->scache_memchunk.index, c->scache_memchunk.length-c->scache_memchunk.index)) <= 0) { + if ((r = pa_iochannel_read(c->io, (uint8_t*) c->scache_memchunk.memblock->data+c->scache_memchunk.index, c->scache_memchunk.length-c->scache_memchunk.index)) <= 0) { fprintf(stderr, __FILE__": read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); return -1; } @@ -783,7 +783,7 @@ static int do_read(struct connection *c) { c->playback.memblock_index = 0; } - if ((r = pa_iochannel_read(c->io, c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) { + if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) { fprintf(stderr, __FILE__": read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); return -1; } @@ -811,7 +811,7 @@ static int do_write(struct connection *c) { ssize_t r; assert(c->write_data_index < c->write_data_length); - if ((r = pa_iochannel_write(c->io, c->write_data+c->write_data_index, c->write_data_length-c->write_data_index)) < 0) { + if ((r = pa_iochannel_write(c->io, (uint8_t*) c->write_data+c->write_data_index, c->write_data_length-c->write_data_index)) < 0) { fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno)); return -1; } @@ -829,7 +829,7 @@ static int do_write(struct connection *c) { assert(chunk.memblock && chunk.length); - if ((r = pa_iochannel_write(c->io, chunk.memblock->data+chunk.index, chunk.length)) < 0) { + if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) { pa_memblock_unref(chunk.memblock); fprintf(stderr, __FILE__": write(): %s\n", strerror(errno)); return -1; diff --git a/polyp/protocol-simple.c b/polyp/protocol-simple.c index b03c2e54..41c1f484 100644 --- a/polyp/protocol-simple.c +++ b/polyp/protocol-simple.c @@ -120,7 +120,7 @@ static int do_read(struct connection *c) { c->playback.memblock_index = 0; } - if ((r = pa_iochannel_read(c->io, c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) { + if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) { fprintf(stderr, __FILE__": read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); return -1; } @@ -153,7 +153,7 @@ static int do_write(struct connection *c) { assert(chunk.memblock && chunk.length); - if ((r = pa_iochannel_write(c->io, chunk.memblock->data+chunk.index, chunk.length)) < 0) { + if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) { pa_memblock_unref(chunk.memblock); fprintf(stderr, "write(): %s\n", strerror(errno)); return -1; diff --git a/polyp/pstream.c b/polyp/pstream.c index 02dba72d..438dccc7 100644 --- a/polyp/pstream.c +++ b/polyp/pstream.c @@ -272,7 +272,7 @@ static void prepare_next_write_item(struct pa_pstream *p) { p->write.descriptor[PA_PSTREAM_DESCRIPTOR_DELTA] = 0; } else { assert(p->write.current->type == PA_PSTREAM_ITEM_MEMBLOCK && p->write.current->chunk.memblock); - p->write.data = p->write.current->chunk.memblock->data + p->write.current->chunk.index; + p->write.data = (uint8_t*) p->write.current->chunk.memblock->data + p->write.current->chunk.index; p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl(p->write.current->chunk.length); p->write.descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL] = htonl(p->write.current->channel); p->write.descriptor[PA_PSTREAM_DESCRIPTOR_DELTA] = htonl(p->write.current->delta); @@ -294,10 +294,10 @@ static void do_write(struct pa_pstream *p) { assert(p->write.data); if (p->write.index < PA_PSTREAM_DESCRIPTOR_SIZE) { - d = (void*) p->write.descriptor + p->write.index; + d = (uint8_t*) p->write.descriptor + p->write.index; l = PA_PSTREAM_DESCRIPTOR_SIZE - p->write.index; } else { - d = (void*) p->write.data + p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE; + d = (uint8_t*) p->write.data + p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE; l = ntohl(p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE); } @@ -330,11 +330,11 @@ static void do_read(struct pa_pstream *p) { assert(p); if (p->read.index < PA_PSTREAM_DESCRIPTOR_SIZE) { - d = (void*) p->read.descriptor + p->read.index; + d = (uint8_t*) p->read.descriptor + p->read.index; l = PA_PSTREAM_DESCRIPTOR_SIZE - p->read.index; } else { assert(p->read.data); - d = (void*) p->read.data + p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE; + d = (uint8_t*) p->read.data + p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE; l = ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE); } diff --git a/polyp/resampler.c b/polyp/resampler.c index ed44cbb7..b6b87607 100644 --- a/polyp/resampler.c +++ b/polyp/resampler.c @@ -146,7 +146,7 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru r->i_buf = pa_xrealloc(r->i_buf, sizeof(float) * (r->i_alloc = eff_ins)); assert(r->i_buf); - r->to_float32_func(eff_ins, in->memblock->data+in->index, i_nchannels, r->i_buf); + r->to_float32_func(eff_ins, (uint8_t*) in->memblock->data+in->index, i_nchannels, r->i_buf); if (r->src_state) { int ret; @@ -179,6 +179,6 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru } else cbuf = r->i_buf; - r->from_float32_func(eff_ons, cbuf, out->memblock->data+out->index, o_nchannels); + r->from_float32_func(eff_ons, cbuf, (uint8_t*)out->memblock->data+out->index, o_nchannels); out->length = ons*r->o_sz; } diff --git a/polyp/sample-util.c b/polyp/sample-util.c index 6a09478f..51b22fbe 100644 --- a/polyp/sample-util.c +++ b/polyp/sample-util.c @@ -37,7 +37,7 @@ struct pa_memblock *pa_silence_memblock(struct pa_memblock* b, const struct pa_s void pa_silence_memchunk(struct pa_memchunk *c, const struct pa_sample_spec *spec) { assert(c && c->memblock && c->memblock->data && spec && c->length); - pa_silence_memory(c->memblock->data+c->index, c->length, spec); + pa_silence_memory((uint8_t*) c->memblock->data+c->index, c->length, spec); } void pa_silence_memory(void *p, size_t length, const struct pa_sample_spec *spec) { @@ -85,7 +85,7 @@ size_t pa_mix(struct pa_mix_info channels[], unsigned nchannels, void *data, siz if (volume == PA_VOLUME_MUTED) v = 0; else { - v = *((int16_t*) (channels[c].chunk.memblock->data + channels[c].chunk.index + d)); + v = *((int16_t*) ((uint8_t*) channels[c].chunk.memblock->data + channels[c].chunk.index + d)); if (volume != PA_VOLUME_NORM) v = (int32_t) ((float)v*volume/PA_VOLUME_NORM); @@ -103,7 +103,7 @@ size_t pa_mix(struct pa_mix_info channels[], unsigned nchannels, void *data, siz if (sum > 0x7FFF) sum = 0x7FFF; *((int16_t*) data) = sum; - data += sizeof(int16_t); + data = (uint8_t*) data + sizeof(int16_t); } } @@ -122,7 +122,7 @@ void pa_volume_memchunk(struct pa_memchunk*c, const struct pa_sample_spec *spec, return; } - for (d = (c->memblock->data+c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) { + for (d = (int16_t*) ((uint8_t*) c->memblock->data+c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) { int32_t t = (int32_t)(*d); t *= volume; diff --git a/polyp/socket-client.c b/polyp/socket-client.c index 3852c1ad..25940122 100644 --- a/polyp/socket-client.c +++ b/polyp/socket-client.c @@ -65,7 +65,8 @@ static struct pa_socket_client*pa_socket_client_new(struct pa_mainloop_api *m) { static void do_call(struct pa_socket_client *c) { struct pa_iochannel *io = NULL; - int error, lerror; + int error; + socklen_t lerror; assert(c && c->callback); pa_socket_client_ref(c); diff --git a/polyp/strbuf.c b/polyp/strbuf.c index ef48a3fb..169604e8 100644 --- a/polyp/strbuf.c +++ b/polyp/strbuf.c @@ -36,7 +36,7 @@ struct chunk { struct chunk *next; size_t length; - char text[0]; + char text[]; }; struct pa_strbuf { -- cgit