From 3fa19ab457ff71d148a6dff5eb7362582e82ce61 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 24 May 2006 13:23:15 +0000 Subject: Fix warnings. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@959 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/polyp/stream.c | 2 +- src/polypcore/modinfo.c | 15 +++++++++++---- src/polypcore/module.c | 11 +++++++++-- src/polypcore/pipe.h | 4 ++++ src/polypcore/protocol-esound.c | 2 -- src/polypcore/random.c | 2 +- src/polypcore/x11wrap.c | 3 ++- src/utils/padsp.c | 21 ++++++++++++++------- 8 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/polyp/stream.c b/src/polyp/stream.c index 2e168045..e41c588e 100644 --- a/src/polyp/stream.c +++ b/src/polyp/stream.c @@ -872,7 +872,7 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t pa_operation *o; pa_tagstruct *t; struct timeval now; - int cidx; + int cidx = 0; assert(s); assert(s->ref >= 1); 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; diff --git a/src/utils/padsp.c b/src/utils/padsp.c index 10b08eae..87d0b257 100644 --- a/src/utils/padsp.c +++ b/src/utils/padsp.c @@ -102,11 +102,18 @@ static int (*_open64)(const char *, int, mode_t) = NULL; static FILE* (*_fopen64)(const char *path, const char *mode) = NULL; static int (*_fclose)(FILE *f) = NULL; +/* dlsym() violates ISO C, so confide the breakage into this function to + * avoid warnings. */ +typedef void (*fnptr)(void); +static inline fnptr dlsym_fn(void *handle, const char *symbol) { + return (fnptr) (long) dlsym(handle, symbol); +} + #define LOAD_IOCTL_FUNC() \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_ioctl) \ - _ioctl = (int (*)(int, int, void*)) dlsym(RTLD_NEXT, "ioctl"); \ + _ioctl = (int (*)(int, int, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) @@ -114,7 +121,7 @@ do { \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_open) \ - _open = (int (*)(const char *, int, mode_t)) dlsym(RTLD_NEXT, "open"); \ + _open = (int (*)(const char *, int, mode_t)) dlsym_fn(RTLD_NEXT, "open"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) @@ -122,7 +129,7 @@ do { \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_open64) \ - _open64 = (int (*)(const char *, int, mode_t)) dlsym(RTLD_NEXT, "open64"); \ + _open64 = (int (*)(const char *, int, mode_t)) dlsym_fn(RTLD_NEXT, "open64"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) @@ -130,7 +137,7 @@ do { \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_close) \ - _close = (int (*)(int)) dlsym(RTLD_NEXT, "close"); \ + _close = (int (*)(int)) dlsym_fn(RTLD_NEXT, "close"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) @@ -138,7 +145,7 @@ do { \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_fopen) \ - _fopen = (FILE* (*)(const char *, const char*)) dlsym(RTLD_NEXT, "fopen"); \ + _fopen = (FILE* (*)(const char *, const char*)) dlsym_fn(RTLD_NEXT, "fopen"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) @@ -146,7 +153,7 @@ do { \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_fopen64) \ - _fopen64 = (FILE* (*)(const char *, const char*)) dlsym(RTLD_NEXT, "fopen64"); \ + _fopen64 = (FILE* (*)(const char *, const char*)) dlsym_fn(RTLD_NEXT, "fopen64"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) @@ -154,7 +161,7 @@ do { \ do { \ pthread_mutex_lock(&func_mutex); \ if (!_fclose) \ - _fclose = (int (*)(FILE *)) dlsym(RTLD_NEXT, "fclose"); \ + _fclose = (int (*)(FILE *)) dlsym_fn(RTLD_NEXT, "fclose"); \ pthread_mutex_unlock(&func_mutex); \ } while(0) -- cgit