]> code.delx.au - pulseaudio/commitdiff
remove most -W compiler warnings
authorLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2004 00:46:56 +0000 (00:46 +0000)
committerLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2004 00:46:56 +0000 (00:46 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@164 fefdeb5f-60dc-0310-8127-8f9354f1896f

14 files changed:
doc/todo
polyp/memchunk.c
polyp/module-oss-mmap.c
polyp/pacat.c
polyp/parec-simple.c
polyp/polyplib-internal.h
polyp/polyplib-simple.c
polyp/protocol-esound.c
polyp/protocol-simple.c
polyp/pstream.c
polyp/resampler.c
polyp/sample-util.c
polyp/socket-client.c
polyp/strbuf.c

index f8ebd9bbee1ad9fe140a8c0464ffa4f5d8c11713..d3baff1611885a6dfadcf220261dac75621d7df5 100644 (file)
--- a/doc/todo
+++ b/doc/todo
    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?
index 920189e28f72f7557e9bd20a907b45120fc462b1..87b9c1bd3b0c72066869289e26b3cdec82d5e60a 100644 (file)
@@ -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) {
index 05e0617833597f9c8b233e804655879cd72a62e4..5c3be1ad4839e1694c24e1425ea61d6acc90466b 100644 (file)
@@ -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;
             
index 9efa552a833796f6c6f2ecae1366c0c284536e3c..b251cc35ff92adc4d17089fccbaabe713ac67640 100644 (file)
@@ -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);
 
index 74f0a0f7a681f50aafab7e1df424bc256f919da0..7e0931ae0fd217e53c327d67edac1740ecaabc19 100644 (file)
@@ -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;
     }
 
index 8f1a4942698b87e9770c2241538f8ed7d2cbac41..813bb04e0164be6dee2688c9d07fd0978ccc511c 100644 (file)
@@ -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
index c71d59a4a45e9994a8258629ef62ab30b1e723fb..ccd39c2a67301aa7626b85beb48a7949b4913246 100644 (file)
@@ -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;
index 2059dab83394206e28eb3646dc1bc8870dea5bbe..d6e2bf6b1f76562854bee9e5939234b20dc7e252 100644 (file)
@@ -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;
index b03c2e54ace9354adc26342519616f59d65fa991..41c1f484659b088b8512098731b26f66f06e492a 100644 (file)
@@ -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;
index 02dba72d34045698861fa4623772c09dca196044..438dccc712ea425a63d764341e1a513bf182f54f 100644 (file)
@@ -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);
     }
 
index ed44cbb7e36cd99f7b876ae026b98e952078a26c..b6b8760763b4412051ec316cc585645964ecbfdf 100644 (file)
@@ -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;
 }
index 6a09478f6108376e445a25021997e94b4047b261..51b22fbe1f69d3cc619843e3114034cfda524813 100644 (file)
@@ -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;
index 3852c1adffeb89e969244425553c1591d5928189..25940122397050a8c1ceb99533a0f44dd0187108 100644 (file)
@@ -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);
index ef48a3fb24d6dcad7722e142fe85682cc8eb8161..169604e8266315a2621d68a1963b53199b1a176b 100644 (file)
@@ -36,7 +36,7 @@
 struct chunk {
     struct chunk *next;
     size_t length;
-    char text[0];
+    char text[];
 };
 
 struct pa_strbuf {