summaryrefslogtreecommitdiffstats
path: root/src/polypcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/polypcore')
-rw-r--r--src/polypcore/modinfo.c15
-rw-r--r--src/polypcore/module.c11
-rw-r--r--src/polypcore/pipe.h4
-rw-r--r--src/polypcore/protocol-esound.c2
-rw-r--r--src/polypcore/random.c2
-rw-r--r--src/polypcore/x11wrap.c3
6 files changed, 27 insertions, 10 deletions
diff --git a/src/polypcore/modinfo.c b/src/polypcore/modinfo.c
index 4a9be0f0..a2fffb01 100644
--- a/src/polypcore/modinfo.c
+++ b/src/polypcore/modinfo.c
@@ -38,6 +38,13 @@
#define PA_SYMBOL_USAGE "pa__get_usage"
#define PA_SYMBOL_VERSION "pa__get_version"
+/* lt_dlsym() violates ISO C, so confide the breakage into this function to
+ * avoid warnings. */
+typedef void (*fnptr)(void);
+static inline fnptr lt_dlsym_fn(lt_dlhandle handle, const char *symbol) {
+ return (fnptr) (long) lt_dlsym(handle, symbol);
+}
+
pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl) {
pa_modinfo *i;
const char* (*func)(void);
@@ -45,16 +52,16 @@ pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl) {
i = pa_xnew0(pa_modinfo, 1);
- if ((func = (const char* (*)(void)) lt_dlsym(dl, PA_SYMBOL_AUTHOR)))
+ if ((func = (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_AUTHOR)))
i->author = pa_xstrdup(func());
- if ((func = (const char* (*)(void)) lt_dlsym(dl, PA_SYMBOL_DESCRIPTION)))
+ if ((func = (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_DESCRIPTION)))
i->description = pa_xstrdup(func());
- if ((func = (const char* (*)(void)) lt_dlsym(dl, PA_SYMBOL_USAGE)))
+ if ((func = (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_USAGE)))
i->usage = pa_xstrdup(func());
- if ((func = (const char* (*)(void)) lt_dlsym(dl, PA_SYMBOL_VERSION)))
+ if ((func = (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_VERSION)))
i->version = pa_xstrdup(func());
return i;
diff --git a/src/polypcore/module.c b/src/polypcore/module.c
index 0286bba8..b938750c 100644
--- a/src/polypcore/module.c
+++ b/src/polypcore/module.c
@@ -44,6 +44,13 @@
#define UNLOAD_POLL_TIME 2
+/* lt_dlsym() violates ISO C, so confide the breakage into this function to
+ * avoid warnings. */
+typedef void (*fnptr)(void);
+static inline fnptr lt_dlsym_fn(lt_dlhandle handle, const char *symbol) {
+ return (fnptr) (long) lt_dlsym(handle, symbol);
+}
+
static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, PA_GCC_UNUSED const struct timeval *tv, void *userdata) {
pa_core *c = userdata;
struct timeval ntv;
@@ -75,12 +82,12 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
goto fail;
}
- if (!(m->init = (int (*)(pa_core *_c, pa_module*_m)) lt_dlsym(m->dl, PA_SYMBOL_INIT))) {
+ if (!(m->init = (int (*)(pa_core *_c, pa_module*_m)) lt_dlsym_fn(m->dl, PA_SYMBOL_INIT))) {
pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.", name);
goto fail;
}
- if (!(m->done = (void (*)(pa_core *_c, pa_module*_m)) lt_dlsym(m->dl, PA_SYMBOL_DONE))) {
+ if (!(m->done = (void (*)(pa_core *_c, pa_module*_m)) lt_dlsym_fn(m->dl, PA_SYMBOL_DONE))) {
pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.", name);
goto fail;
}
diff --git a/src/polypcore/pipe.h b/src/polypcore/pipe.h
index e9167782..276b072d 100644
--- a/src/polypcore/pipe.h
+++ b/src/polypcore/pipe.h
@@ -22,6 +22,10 @@
USA.
***/
+#ifndef HAVE_PIPE
+
int pipe(int filedes[2]);
#endif
+
+#endif
diff --git a/src/polypcore/protocol-esound.c b/src/polypcore/protocol-esound.c
index 01a72e84..d7c9475a 100644
--- a/src/polypcore/protocol-esound.c
+++ b/src/polypcore/protocol-esound.c
@@ -515,7 +515,6 @@ static int esd_proto_server_info(struct connection *c, PA_GCC_UNUSED esd_proto_t
}
static int esd_proto_all_info(struct connection *c, esd_proto_t request, const void *data, size_t length) {
- uint8_t *response;
size_t t, k, s;
struct connection *conn;
uint32_t idx = PA_IDXSET_INVALID;
@@ -585,7 +584,6 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
}
assert(t == s*(nsamples+1)+k);
- response += k;
t -= k;
connection_write(c, terminator, k);
diff --git a/src/polypcore/random.c b/src/polypcore/random.c
index 4bfce975..d7a37b0b 100644
--- a/src/polypcore/random.c
+++ b/src/polypcore/random.c
@@ -48,7 +48,7 @@ static int random_proper(void *ret_data, size_t length) {
#else /* OS_IS_WIN32 */
- int fd, ret;
+ int fd, ret = -1;
ssize_t r = 0;
const char **device;
diff --git a/src/polypcore/x11wrap.c b/src/polypcore/x11wrap.c
index 41a40764..b53a43b6 100644
--- a/src/polypcore/x11wrap.c
+++ b/src/polypcore/x11wrap.c
@@ -107,9 +107,10 @@ static void internal_io_event(pa_mainloop_api *m, pa_io_event *e, int fd, PA_GCC
/* Add a new IO source for the specified X11 internal connection */
static pa_x11_internal* x11_internal_add(pa_x11_wrapper *w, int fd) {
pa_x11_internal *i;
- assert(i && fd >= 0);
+ assert(fd >= 0);
i = pa_xmalloc(sizeof(pa_x11_internal));
+ assert(i);
i->wrapper = w;
i->io_event = w->core->mainloop->io_new(w->core->mainloop, fd, PA_IO_EVENT_INPUT, internal_io_event, w);
i->fd = fd;