From 1ad4ff1ca446fafb3abe9353a4048893dd3d9b77 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 24 Jun 2004 23:27:06 +0000 Subject: some fixes git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@36 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/Makefile.am | 4 ++-- src/main.c | 7 ++++++- src/module-protocol-stub.c | 5 ++++- src/pdispatch.c | 1 + src/polyp.c | 2 +- src/socket-client.c | 2 +- src/tagstruct.c | 8 ++++---- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index c3a33ce3..75da02c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,7 +28,7 @@ pkglib_LTLIBRARIES=libiochannel.la libsocket-server.la libsocket-client.la \ module-simple-protocol-unix.la module-cli-protocol-tcp.la \ libprotocol-cli.la module-cli-protocol-unix.la libtagstruct.la \ libpdispatch.la libprotocol-native.la libpstream-util.la \ - module-native-protocol-tcp.la module-native-protocol-unix.la \ + module-native-protocol-tcp.la module-native-protocol-unix.la \ libpolyp.la polypaudio_SOURCES = idxset.c idxset.h \ @@ -110,7 +110,7 @@ libprotocol_cli_la_LIBADD = libsocket-server.la libiochannel.la libcli.la libprotocol_native_la_SOURCES = protocol-native.c protocol-native.h libprotocol_native_la_LDFLAGS = -avoid-version -libprotocol_native_la_LIBADD = libsocket-server.la libiochannel.la libpacket.la libpstream.la libpstream-util.la +libprotocol_native_la_LIBADD = libsocket-server.la libiochannel.la libpacket.la libpstream.la libpstream-util.la libpdispatch.la libtagstruct_la_SOURCES = tagstruct.c tagstruct.h libtagstruct_la_LDFLAGS = -avoid-version diff --git a/src/main.c b/src/main.c index ef25b5e3..0fe333e0 100644 --- a/src/main.c +++ b/src/main.c @@ -39,8 +39,13 @@ int main(int argc, char *argv[]) { assert(c); module_load(c, "module-oss-mmap", "/dev/dsp1"); - module_load(c, "module-pipe-sink", NULL); +/* module_load(c, "module-pipe-sink", NULL); module_load(c, "module-simple-protocol-tcp", NULL); + module_load(c, "module-simple-protocol-unix", NULL);*/ + module_load(c, "module-cli-protocol-tcp", NULL); +/* module_load(c, "module-cli-protocol-unix", NULL); + module_load(c, "module-native-protocol-tcp", NULL);*/ + module_load(c, "module-native-protocol-unix", NULL); module_load(c, "module-cli", NULL); fprintf(stderr, "main: mainloop entry.\n"); diff --git a/src/module-protocol-stub.c b/src/module-protocol-stub.c index 2387017c..97bf5ef3 100644 --- a/src/module-protocol-stub.c +++ b/src/module-protocol-stub.c @@ -8,18 +8,21 @@ #include "protocol-simple.h" #define protocol_free protocol_simple_free #define IPV4_PORT 4711 + #define UNIX_SOCKET "/tmp/polypaudio_simple" #else #ifdef USE_PROTOCOL_CLI #include "protocol-cli.h" #define protocol_new protocol_cli_new #define protocol_free protocol_cli_free #define IPV4_PORT 4712 + #define UNIX_SOCKET "/tmp/polypaudio_cli" #else #ifdef USE_PROTOCOL_NATIVE #include "protocol-native.h" #define protocol_new protocol_native_new #define protocol_free protocol_native_free #define IPV4_PORT 4713 + #define UNIX_SOCKET "/tmp/polypaudio_native" #else #error "Broken build system" #endif @@ -34,7 +37,7 @@ int module_init(struct core *c, struct module*m) { if (!(s = socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, IPV4_PORT))) return -1; #else - if (!(s = socket_server_new_unix(c->mainloop, "/tmp/polypsimple"))) + if (!(s = socket_server_new_unix(c->mainloop, UNIX_SOCKET))) return -1; #endif diff --git a/src/pdispatch.c b/src/pdispatch.c index 48b6639d..15f4b1b5 100644 --- a/src/pdispatch.c +++ b/src/pdispatch.c @@ -46,6 +46,7 @@ struct pdispatch* pdispatch_new(struct pa_mainloop_api *mainloop, const struct p pd->mainloop = mainloop; pd->command_table = table; pd->n_commands = entries; + pd->replies = NULL; return pd; } diff --git a/src/polyp.c b/src/polyp.c index a373841a..69b85c21 100644 --- a/src/polyp.c +++ b/src/polyp.c @@ -15,7 +15,7 @@ #define DEFAULT_MAX_LENGTH 20480 #define DEFAULT_PREBUF 4096 #define DEFAULT_TIMEOUT 5 -#define DEFAULT_SERVER "/tmp/foo" +#define DEFAULT_SERVER "/tmp/polypaudio_native" struct pa_context { char *name; diff --git a/src/socket-client.c b/src/socket-client.c index 42859392..b10f8ab1 100644 --- a/src/socket-client.c +++ b/src/socket-client.c @@ -101,7 +101,7 @@ static int do_connect(struct socket_client *c, const struct sockaddr *sa, sockle assert(c->io_source); } else { c->fixed_source = c->mainloop->source_fixed(c->mainloop, connect_fixed_cb, c); - assert(c->io_source); + assert(c->fixed_source); } return 0; diff --git a/src/tagstruct.c b/src/tagstruct.c index 47e17839..407440d3 100644 --- a/src/tagstruct.c +++ b/src/tagstruct.c @@ -34,7 +34,7 @@ struct tagstruct *tagstruct_new(const uint8_t* data, size_t length) { t->data = (uint8_t*) data; t->allocated = t->length = data ? length : 0; t->rindex = 0; - t->dynamic = !!data; + t->dynamic = !data; return t; } @@ -57,7 +57,7 @@ uint8_t* tagstruct_free_data(struct tagstruct*t, size_t *l) { static void extend(struct tagstruct*t, size_t l) { assert(t && t->dynamic); - if (t->allocated <= l) + if (l <= t->allocated) return; t->data = realloc(t->data, t->allocated = l+100); @@ -75,7 +75,7 @@ void tagstruct_puts(struct tagstruct*t, const char *s) { } void tagstruct_putu32(struct tagstruct*t, uint32_t i) { - assert(t && i); + assert(t); extend(t, 5); t->data[t->length] = TAG_U32; *((uint32_t*) (t->data+t->length+1)) = htonl(i); @@ -83,7 +83,7 @@ void tagstruct_putu32(struct tagstruct*t, uint32_t i) { } void tagstruct_putu8(struct tagstruct*t, uint8_t c) { - assert(t && c); + assert(t); extend(t, 2); t->data[t->length] = TAG_U8; *(t->data+t->length+1) = c; -- cgit