Fix warnings.

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@959 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2006-05-24 13:23:15 +00:00
parent 2843b1a318
commit 3fa19ab457
8 changed files with 42 additions and 18 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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;
}

View file

@ -22,6 +22,10 @@
USA.
***/
#ifndef HAVE_PIPE
int pipe(int filedes[2]);
#endif
#endif

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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)