[polypaudio-commits] r959 - in /trunk/src: polyp/stream.c polypcore/modinfo.c polypcore/module.c polypcore/pipe.h polypcore/protocol-esound.c polypcore/random.c polypcore/x11wrap.c utils/padsp.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed May 24 06:23:16 PDT 2006


Author: ossman
Date: Wed May 24 15:23:15 2006
New Revision: 959

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=959&root=polypaudio&view=rev
Log:
Fix warnings.

Modified:
    trunk/src/polyp/stream.c
    trunk/src/polypcore/modinfo.c
    trunk/src/polypcore/module.c
    trunk/src/polypcore/pipe.h
    trunk/src/polypcore/protocol-esound.c
    trunk/src/polypcore/random.c
    trunk/src/polypcore/x11wrap.c
    trunk/src/utils/padsp.c

Modified: trunk/src/polyp/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polyp/stream.c (original)
+++ trunk/src/polyp/stream.c Wed May 24 15:23:15 2006
@@ -872,7 +872,7 @@
     pa_operation *o;
     pa_tagstruct *t;
     struct timeval now;
-    int cidx;
+    int cidx = 0;
     
     assert(s);
     assert(s->ref >= 1);

Modified: trunk/src/polypcore/modinfo.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/modinfo.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polypcore/modinfo.c (original)
+++ trunk/src/polypcore/modinfo.c Wed May 24 15:23:15 2006
@@ -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 @@
 
     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;

Modified: trunk/src/polypcore/module.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/module.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polypcore/module.c (original)
+++ trunk/src/polypcore/module.c Wed May 24 15:23:15 2006
@@ -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 @@
         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;
     }

Modified: trunk/src/polypcore/pipe.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/pipe.h?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polypcore/pipe.h (original)
+++ trunk/src/polypcore/pipe.h Wed May 24 15:23:15 2006
@@ -22,6 +22,10 @@
    USA.
 ***/
 
+#ifndef HAVE_PIPE
+
 int pipe(int filedes[2]);
 
 #endif
+
+#endif

Modified: trunk/src/polypcore/protocol-esound.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-esound.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-esound.c (original)
+++ trunk/src/polypcore/protocol-esound.c Wed May 24 15:23:15 2006
@@ -515,7 +515,6 @@
 }
 
 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 @@
     }
 
     assert(t == s*(nsamples+1)+k);
-    response += k;
     t -= k;
 
     connection_write(c, terminator, k);

Modified: trunk/src/polypcore/random.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/random.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polypcore/random.c (original)
+++ trunk/src/polypcore/random.c Wed May 24 15:23:15 2006
@@ -48,7 +48,7 @@
 
 #else /* OS_IS_WIN32 */
 
-    int fd, ret;
+    int fd, ret = -1;
     ssize_t r = 0;
     const char **device;
 

Modified: trunk/src/polypcore/x11wrap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/x11wrap.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/polypcore/x11wrap.c (original)
+++ trunk/src/polypcore/x11wrap.c Wed May 24 15:23:15 2006
@@ -107,9 +107,10 @@
 /* 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;

Modified: trunk/src/utils/padsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/padsp.c?rev=959&root=polypaudio&r1=958&r2=959&view=diff
==============================================================================
--- trunk/src/utils/padsp.c (original)
+++ trunk/src/utils/padsp.c Wed May 24 15:23:15 2006
@@ -102,11 +102,18 @@
 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 { \
     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 { \
     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 { \
     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 { \
     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 { \
     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 { \
     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)
 




More information about the pulseaudio-commits mailing list