[polypaudio-commits] r972 - in /trunk: doc/ src/ src/daemon/ src/modules/ src/modules/rtp/ src/polyp/ src/polypcore/ src/utils/
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu May 25 10:16:58 PDT 2006
Author: lennart
Date: Thu May 25 19:16:55 2006
New Revision: 972
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=972&root=polypaudio&view=rev
Log:
* split pa_cstrerror() into its own file polypcore/core-error.[ch]
* fix building of padsp
* remove a warning when compiling padsp.c
Added:
trunk/src/polypcore/core-error.c
- copied, changed from r970, trunk/src/polyp/error.c
trunk/src/polypcore/core-error.h
- copied, changed from r970, trunk/src/polyp/error.h
Modified:
trunk/doc/todo
trunk/src/Makefile.am
trunk/src/daemon/caps.c
trunk/src/daemon/daemon-conf.c
trunk/src/daemon/main.c
trunk/src/modules/module-alsa-source.c
trunk/src/modules/module-detect.c
trunk/src/modules/module-esound-compat-spawnfd.c
trunk/src/modules/module-esound-compat-spawnpid.c
trunk/src/modules/module-esound-sink.c
trunk/src/modules/module-jack-sink.c
trunk/src/modules/module-jack-source.c
trunk/src/modules/module-match.c
trunk/src/modules/module-mmkbd-evdev.c
trunk/src/modules/module-oss-mmap.c
trunk/src/modules/module-oss.c
trunk/src/modules/module-pipe-sink.c
trunk/src/modules/module-pipe-source.c
trunk/src/modules/module-protocol-stub.c
trunk/src/modules/module-volume-restore.c
trunk/src/modules/oss-util.c
trunk/src/modules/rtp/module-rtp-recv.c
trunk/src/modules/rtp/module-rtp-send.c
trunk/src/modules/rtp/rtp.c
trunk/src/modules/rtp/sap.c
trunk/src/polyp/client-conf.c
trunk/src/polyp/context.c
trunk/src/polyp/error.c
trunk/src/polyp/error.h
trunk/src/polyp/mainloop-signal.c
trunk/src/polyp/mainloop.c
trunk/src/polyp/util.c
trunk/src/polypcore/authkey.c
trunk/src/polypcore/cli-command.c
trunk/src/polypcore/conf-parser.c
trunk/src/polypcore/core-scache.c
trunk/src/polypcore/core-util.c
trunk/src/polypcore/iochannel.c
trunk/src/polypcore/ioline.c
trunk/src/polypcore/pid.c
trunk/src/polypcore/protocol-esound.c
trunk/src/polypcore/protocol-simple.c
trunk/src/polypcore/socket-client.c
trunk/src/polypcore/socket-server.c
trunk/src/polypcore/socket-util.c
trunk/src/utils/pacmd.c
trunk/src/utils/padsp.c
Modified: trunk/doc/todo
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/doc/todo?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/doc/todo (original)
+++ trunk/doc/todo Thu May 25 19:16:55 2006
@@ -2,8 +2,6 @@
Pre 0.9.0
- add API to query the bufferattrs after stream creation
-- add proper padsp script that makes $PADSP_xxx env vars from the command line arguments, just like esddsp does
-- move pa_cstrerror() to polypcore/core-error.h
Post 0.9.0:
- alsa mmap driver
Modified: trunk/src/Makefile.am
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/Makefile.am?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Thu May 25 19:16:55 2006
@@ -402,6 +402,7 @@
polypcore/strbuf.c polypcore/strbuf.h \
polypcore/strlist.c polypcore/strlist.h \
polypcore/tagstruct.c polypcore/tagstruct.h \
+ polypcore/core-error.c polypcore/core-error.h \
polypcore/winsock.h
if OS_IS_WIN32
@@ -574,7 +575,8 @@
polypcore/source-output.c polypcore/source-output.h \
polypcore/strbuf.c polypcore/strbuf.h \
polypcore/tokenizer.c polypcore/tokenizer.h \
- polypcore/winsock.h
+ polypcore/winsock.h \
+ polypcore/core-error.c polypcore/core-error.h
if OS_IS_WIN32
libpolypcore_la_SOURCES += \
@@ -1186,3 +1188,5 @@
chmod u+s $(DESTDIR)$(bindir)/polypaudio
ln -sf pacat $(DESTDIR)$(bindir)/parec
rm -f $(DESTDIR)$(modlibexecdir)/*.a
+
+.PHONY: utils/padsp
Modified: trunk/src/daemon/caps.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/caps.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/daemon/caps.c (original)
+++ trunk/src/daemon/caps.c Thu May 25 19:16:55 2006
@@ -32,7 +32,7 @@
#include <sys/capability.h>
#endif
-#include <polyp/error.h>
+#include <polypcore/core-error.h>
#include <polypcore/log.h>
Modified: trunk/src/daemon/daemon-conf.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/daemon-conf.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/daemon/daemon-conf.c (original)
+++ trunk/src/daemon/daemon-conf.c Thu May 25 19:16:55 2006
@@ -29,9 +29,9 @@
#include <assert.h>
#include <unistd.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/strbuf.h>
#include <polypcore/conf-parser.h>
Modified: trunk/src/daemon/main.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/main.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/daemon/main.c (original)
+++ trunk/src/daemon/main.c Thu May 25 19:16:55 2006
@@ -50,11 +50,11 @@
#include "../polypcore/winsock.h"
-#include <polyp/error.h>
#include <polyp/mainloop.h>
#include <polyp/mainloop-signal.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core.h>
#include <polypcore/memblock.h>
#include <polypcore/module.h>
Modified: trunk/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-alsa-source.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-alsa-source.c (original)
+++ trunk/src/modules/module-alsa-source.c Thu May 25 19:16:55 2006
@@ -34,9 +34,9 @@
#include <asoundlib.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core.h>
#include <polypcore/module.h>
#include <polypcore/memchunk.h>
Modified: trunk/src/modules/module-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-detect.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-detect.c (original)
+++ trunk/src/modules/module-detect.c Thu May 25 19:16:55 2006
@@ -33,9 +33,9 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/modargs.h>
#include <polypcore/log.h>
Modified: trunk/src/modules/module-esound-compat-spawnfd.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-esound-compat-spawnfd.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-esound-compat-spawnfd.c (original)
+++ trunk/src/modules/module-esound-compat-spawnfd.c Thu May 25 19:16:55 2006
@@ -28,8 +28,7 @@
#include <string.h>
#include <errno.h>
-#include <polyp/error.h>
-
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/modargs.h>
#include <polypcore/core-util.h>
Modified: trunk/src/modules/module-esound-compat-spawnpid.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-esound-compat-spawnpid.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-esound-compat-spawnpid.c (original)
+++ trunk/src/modules/module-esound-compat-spawnpid.c Thu May 25 19:16:55 2006
@@ -28,8 +28,7 @@
#include <errno.h>
#include <signal.h>
-#include <polyp/error.h>
-
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/core-util.h>
#include <polypcore/modargs.h>
Modified: trunk/src/modules/module-esound-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-esound-sink.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-esound-sink.c (original)
+++ trunk/src/modules/module-esound-sink.c Thu May 25 19:16:55 2006
@@ -33,9 +33,9 @@
#include <unistd.h>
#include <limits.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/sink.h>
#include <polypcore/module.h>
Modified: trunk/src/modules/module-jack-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-jack-sink.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-jack-sink.c (original)
+++ trunk/src/modules/module-jack-sink.c Thu May 25 19:16:55 2006
@@ -36,9 +36,9 @@
#include <jack/jack.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/sink.h>
#include <polypcore/module.h>
Modified: trunk/src/modules/module-jack-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-jack-source.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-jack-source.c (original)
+++ trunk/src/modules/module-jack-source.c Thu May 25 19:16:55 2006
@@ -36,9 +36,9 @@
#include <jack/jack.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/source.h>
#include <polypcore/module.h>
Modified: trunk/src/modules/module-match.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-match.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-match.c (original)
+++ trunk/src/modules/module-match.c Thu May 25 19:16:55 2006
@@ -32,9 +32,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/core-util.h>
#include <polypcore/modargs.h>
Modified: trunk/src/modules/module-mmkbd-evdev.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-mmkbd-evdev.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-mmkbd-evdev.c (original)
+++ trunk/src/modules/module-mmkbd-evdev.c Thu May 25 19:16:55 2006
@@ -33,9 +33,9 @@
#include <linux/input.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/log.h>
#include <polypcore/namereg.h>
Modified: trunk/src/modules/module-oss-mmap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-oss-mmap.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-oss-mmap.c (original)
+++ trunk/src/modules/module-oss-mmap.c Thu May 25 19:16:55 2006
@@ -36,9 +36,9 @@
#include <limits.h>
#include <sys/mman.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/sink.h>
#include <polypcore/source.h>
Modified: trunk/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-oss.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-oss.c (original)
+++ trunk/src/modules/module-oss.c Thu May 25 19:16:55 2006
@@ -35,9 +35,9 @@
#include <unistd.h>
#include <limits.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/sink.h>
#include <polypcore/source.h>
Modified: trunk/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-pipe-sink.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-pipe-sink.c (original)
+++ trunk/src/modules/module-pipe-sink.c Thu May 25 19:16:55 2006
@@ -33,9 +33,9 @@
#include <unistd.h>
#include <limits.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/sink.h>
#include <polypcore/module.h>
Modified: trunk/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-pipe-source.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-pipe-source.c (original)
+++ trunk/src/modules/module-pipe-source.c Thu May 25 19:16:55 2006
@@ -33,9 +33,9 @@
#include <unistd.h>
#include <limits.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/iochannel.h>
#include <polypcore/source.h>
#include <polypcore/module.h>
Modified: trunk/src/modules/module-protocol-stub.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-protocol-stub.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-protocol-stub.c (original)
+++ trunk/src/modules/module-protocol-stub.c Thu May 25 19:16:55 2006
@@ -42,9 +42,9 @@
#include "../polypcore/winsock.h"
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/socket-server.h>
#include <polypcore/socket-util.h>
Modified: trunk/src/modules/module-volume-restore.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-volume-restore.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/module-volume-restore.c (original)
+++ trunk/src/modules/module-volume-restore.c Thu May 25 19:16:55 2006
@@ -32,9 +32,9 @@
#include <stdlib.h>
#include <ctype.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/core-util.h>
#include <polypcore/modargs.h>
Modified: trunk/src/modules/oss-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/oss-util.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/oss-util.c (original)
+++ trunk/src/modules/oss-util.c Thu May 25 19:16:55 2006
@@ -34,8 +34,7 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include <polyp/error.h>
-
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
Modified: trunk/src/modules/rtp/module-rtp-recv.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/rtp/module-rtp-recv.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/rtp/module-rtp-recv.c (original)
+++ trunk/src/modules/rtp/module-rtp-recv.c Thu May 25 19:16:55 2006
@@ -31,10 +31,10 @@
#include <string.h>
#include <unistd.h>
-#include <polyp/error.h>
#include <polyp/timeval.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/llist.h>
#include <polypcore/sink.h>
Modified: trunk/src/modules/rtp/module-rtp-send.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/rtp/module-rtp-send.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/rtp/module-rtp-send.c (original)
+++ trunk/src/modules/rtp/module-rtp-send.c Thu May 25 19:16:55 2006
@@ -32,11 +32,11 @@
#include <string.h>
#include <unistd.h>
-#include <polyp/error.h>
#include <polyp/timeval.h>
#include <polyp/util.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/module.h>
#include <polypcore/llist.h>
#include <polypcore/source.h>
Modified: trunk/src/modules/rtp/rtp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/rtp/rtp.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/rtp/rtp.c (original)
+++ trunk/src/modules/rtp/rtp.c Thu May 25 19:16:55 2006
@@ -36,8 +36,7 @@
#include <sys/filio.h>
#endif
-#include <polyp/error.h>
-
+#include <polypcore/core-error.h>
#include <polypcore/log.h>
#include "rtp.h"
Modified: trunk/src/modules/rtp/sap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/rtp/sap.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/modules/rtp/sap.c (original)
+++ trunk/src/modules/rtp/sap.c Thu May 25 19:16:55 2006
@@ -38,9 +38,9 @@
#include <sys/filio.h>
#endif
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
Modified: trunk/src/polyp/client-conf.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/client-conf.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/client-conf.c (original)
+++ trunk/src/polyp/client-conf.c Thu May 25 19:16:55 2006
@@ -29,7 +29,7 @@
#include <errno.h>
#include <string.h>
-#include <polyp/error.h>
+#include <polypcore/core-error.h>
#include <polyp/xmalloc.h>
#include <polypcore/log.h>
Modified: trunk/src/polyp/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/context.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/context.c (original)
+++ trunk/src/polyp/context.c Thu May 25 19:16:55 2006
@@ -47,7 +47,7 @@
#include "../polypcore/winsock.h"
-#include <polyp/error.h>
+#include <polypcore/core-error.h>
#include <polyp/version.h>
#include <polyp/xmalloc.h>
Modified: trunk/src/polyp/error.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/error.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/error.c (original)
+++ trunk/src/polyp/error.c Thu May 25 19:16:55 2006
@@ -28,15 +28,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_PTHREAD
-#include <pthread.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
-#include <polyp/utf8.h>
#include <polyp/xmalloc.h>
#include <polypcore/core-util.h>
@@ -44,191 +35,32 @@
#include "error.h"
-static const char* const errortab[PA_ERR_MAX] = {
- [PA_OK] = "OK",
- [PA_ERR_ACCESS] = "Access denied",
- [PA_ERR_COMMAND] = "Unknown command",
- [PA_ERR_INVALID] = "Invalid argument",
- [PA_ERR_EXIST] = "Entity exists",
- [PA_ERR_NOENTITY] = "No such entity",
- [PA_ERR_CONNECTIONREFUSED] = "Connection refused",
- [PA_ERR_PROTOCOL] = "Protocol error",
- [PA_ERR_TIMEOUT] = "Timeout",
- [PA_ERR_AUTHKEY] = "No authorization key",
- [PA_ERR_INTERNAL] = "Internal error",
- [PA_ERR_CONNECTIONTERMINATED] = "Connection terminated",
- [PA_ERR_KILLED] = "Entity killed",
- [PA_ERR_INVALIDSERVER] = "Invalid server",
- [PA_ERR_MODINITFAILED] = "Module initalization failed",
- [PA_ERR_BADSTATE] = "Bad state",
- [PA_ERR_NODATA] = "No data",
- [PA_ERR_VERSION] = "Incompatible protocol version",
- [PA_ERR_TOOLARGE] = "Too large"
-};
+const char*pa_strerror(int error) {
-const char*pa_strerror(int error) {
+ static const char* const errortab[PA_ERR_MAX] = {
+ [PA_OK] = "OK",
+ [PA_ERR_ACCESS] = "Access denied",
+ [PA_ERR_COMMAND] = "Unknown command",
+ [PA_ERR_INVALID] = "Invalid argument",
+ [PA_ERR_EXIST] = "Entity exists",
+ [PA_ERR_NOENTITY] = "No such entity",
+ [PA_ERR_CONNECTIONREFUSED] = "Connection refused",
+ [PA_ERR_PROTOCOL] = "Protocol error",
+ [PA_ERR_TIMEOUT] = "Timeout",
+ [PA_ERR_AUTHKEY] = "No authorization key",
+ [PA_ERR_INTERNAL] = "Internal error",
+ [PA_ERR_CONNECTIONTERMINATED] = "Connection terminated",
+ [PA_ERR_KILLED] = "Entity killed",
+ [PA_ERR_INVALIDSERVER] = "Invalid server",
+ [PA_ERR_MODINITFAILED] = "Module initalization failed",
+ [PA_ERR_BADSTATE] = "Bad state",
+ [PA_ERR_NODATA] = "No data",
+ [PA_ERR_VERSION] = "Incompatible protocol version",
+ [PA_ERR_TOOLARGE] = "Too large"
+ };
+
if (error < 0 || error >= PA_ERR_MAX)
return NULL;
return errortab[error];
}
-
-#ifdef HAVE_PTHREAD
-
-static pthread_once_t cstrerror_once = PTHREAD_ONCE_INIT;
-static pthread_key_t tlsstr_key;
-
-static void inittls(void) {
- int ret;
-
- ret = pthread_key_create(&tlsstr_key, pa_xfree);
- if (ret) {
- fprintf(stderr, __FILE__ ": CRITICAL: Unable to allocate TLS key (%d)\n", errno);
- exit(-1);
- }
-}
-
-#elif HAVE_WINDOWS_H
-
-static DWORD tlsstr_key = TLS_OUT_OF_INDEXES;
-static DWORD monitor_key = TLS_OUT_OF_INDEXES;
-
-static void inittls(void) {
- HANDLE mutex;
- char name[64];
-
- sprintf(name, "polypaudio%d", (int)GetCurrentProcessId());
-
- mutex = CreateMutex(NULL, FALSE, name);
- if (!mutex) {
- fprintf(stderr, __FILE__ ": CRITICAL: Unable to create named mutex (%d)\n", (int)GetLastError());
- exit(-1);
- }
-
- WaitForSingleObject(mutex, INFINITE);
-
- if (tlsstr_key == TLS_OUT_OF_INDEXES) {
- tlsstr_key = TlsAlloc();
- monitor_key = TlsAlloc();
- if ((tlsstr_key == TLS_OUT_OF_INDEXES) || (monitor_key == TLS_OUT_OF_INDEXES)) {
- fprintf(stderr, __FILE__ ": CRITICAL: Unable to allocate TLS key (%d)\n", (int)GetLastError());
- exit(-1);
- }
- }
-
- ReleaseMutex(mutex);
-
- CloseHandle(mutex);
-}
-
-/*
- * This is incredibly brain dead, but this is necessary when dealing with
- * the hell that is Win32.
- */
-struct monitor_data {
- HANDLE thread;
- void *data;
-};
-
-static DWORD WINAPI monitor_thread(LPVOID param) {
- struct monitor_data *data;
-
- data = (struct monitor_data*)param;
- assert(data);
-
- WaitForSingleObject(data->thread, INFINITE);
-
- CloseHandle(data->thread);
- pa_xfree(data->data);
- pa_xfree(data);
-
- return 0;
-}
-
-static void start_monitor(void) {
- HANDLE thread;
- struct monitor_data *data;
-
- data = pa_xnew(struct monitor_data, 1);
- assert(data);
-
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
- GetCurrentProcess(), &data->thread, 0, FALSE, DUPLICATE_SAME_ACCESS);
-
- thread = CreateThread(NULL, 0, monitor_thread, data, 0, NULL);
- assert(thread);
-
- TlsSetValue(monitor_key, data);
-
- CloseHandle(thread);
-}
-
-#else
-
-/* Unsafe, but we have no choice */
-static char *tlsstr;
-
-#endif
-
-const char* pa_cstrerror(int errnum) {
- const char *origbuf;
-
-#ifdef HAVE_STRERROR_R
- char errbuf[128];
-#endif
-
-#ifdef HAVE_PTHREAD
- char *tlsstr;
-
- pthread_once(&cstrerror_once, inittls);
-
- tlsstr = pthread_getspecific(tlsstr_key);
-#elif defined(HAVE_WINDOWS_H)
- char *tlsstr;
- struct monitor_data *data;
-
- inittls();
-
- tlsstr = TlsGetValue(tlsstr_key);
- if (!tlsstr)
- start_monitor();
- data = TlsGetValue(monitor_key);
-#endif
-
- if (tlsstr)
- pa_xfree(tlsstr);
-
-#ifdef HAVE_STRERROR_R
-
-#ifdef __GLIBC__
- origbuf = strerror_r(errnum, errbuf, sizeof(errbuf));
- if (origbuf == NULL)
- origbuf = "";
-#else
- if (strerror_r(errnum, errbuf, sizeof(errbuf)) == 0) {
- origbuf = errbuf;
- errbuf[sizeof(errbuf) - 1] = '\0';
- } else
- origbuf = "";
-#endif
-
-#else
- /* This might not be thread safe, but we hope for the best */
- origbuf = strerror(errnum);
-#endif
-
- tlsstr = pa_locale_to_utf8(origbuf);
- if (!tlsstr) {
- fprintf(stderr, "Unable to convert, filtering\n");
- tlsstr = pa_utf8_filter(origbuf);
- }
-
-#ifdef HAVE_PTHREAD
- pthread_setspecific(tlsstr_key, tlsstr);
-#elif defined(HAVE_WINDOWS_H)
- TlsSetValue(tlsstr_key, tlsstr);
- data->data = tlsstr;
-#endif
-
- return tlsstr;
-}
Modified: trunk/src/polyp/error.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/error.h?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/error.h (original)
+++ trunk/src/polyp/error.h Thu May 25 19:16:55 2006
@@ -33,12 +33,6 @@
/** Return a human readable error message for the specified numeric error code */
const char* pa_strerror(int error);
-/** A wrapper around the standard strerror() function that converts the
- * string to UTF-8. The function is thread safe but the returned string is
- * only guaranteed to exist until the thread exits or pa_cstrerror() is
- * called again from the same thread. */
-const char* pa_cstrerror(int errnum);
-
PA_C_DECL_END
#endif
Modified: trunk/src/polyp/mainloop-signal.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/mainloop-signal.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/mainloop-signal.c (original)
+++ trunk/src/polyp/mainloop-signal.c Thu May 25 19:16:55 2006
@@ -36,7 +36,7 @@
#include <windows.h>
#endif
-#include <polyp/error.h>
+#include <polypcore/core-error.h>
#include <polyp/xmalloc.h>
#include <polypcore/core-util.h>
Modified: trunk/src/polyp/mainloop.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/mainloop.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/mainloop.c (original)
+++ trunk/src/polyp/mainloop.c Thu May 25 19:16:55 2006
@@ -44,7 +44,7 @@
#include "../polypcore/pipe.h"
#endif
-#include <polyp/error.h>
+#include <polypcore/core-error.h>
#include <polyp/timeval.h>
#include <polyp/xmalloc.h>
Modified: trunk/src/polyp/util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/util.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polyp/util.c (original)
+++ trunk/src/polyp/util.c Thu May 25 19:16:55 2006
@@ -51,8 +51,7 @@
#include "../polypcore/winsock.h"
-#include <polyp/error.h>
-
+#include <polypcore/core-error.h>
#include <polypcore/log.h>
#include <polypcore/core-util.h>
Modified: trunk/src/polypcore/authkey.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/authkey.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/authkey.c (original)
+++ trunk/src/polypcore/authkey.c Thu May 25 19:16:55 2006
@@ -35,8 +35,8 @@
#include <limits.h>
#include <sys/stat.h>
-#include <polyp/error.h>
#include <polyp/util.h>
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
#include <polypcore/random.h>
Modified: trunk/src/polypcore/cli-command.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/cli-command.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/cli-command.c (original)
+++ trunk/src/polypcore/cli-command.c Thu May 25 19:16:55 2006
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <errno.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/module.h>
@@ -50,6 +49,7 @@
#include <polypcore/sound-file-stream.h>
#include <polypcore/props.h>
#include <polypcore/core-util.h>
+#include <polypcore/core-error.h>
#include "cli-command.h"
Modified: trunk/src/polypcore/conf-parser.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/conf-parser.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/conf-parser.c (original)
+++ trunk/src/polypcore/conf-parser.c Thu May 25 19:16:55 2006
@@ -28,9 +28,9 @@
#include <stdio.h>
#include <errno.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/log.h>
#include <polypcore/core-util.h>
Copied: trunk/src/polypcore/core-error.c (from r970, trunk/src/polyp/error.c)
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-error.c?p2=trunk/src/polypcore/core-error.c&p1=trunk/src/polyp/error.c&r1=970&r2=972&rev=972&root=polypaudio&view=diff
==============================================================================
--- trunk/src/polyp/error.c (original)
+++ trunk/src/polypcore/core-error.c Thu May 25 19:16:55 2006
@@ -42,36 +42,7 @@
#include <polypcore/core-util.h>
#include <polypcore/native-common.h>
-#include "error.h"
-
-static const char* const errortab[PA_ERR_MAX] = {
- [PA_OK] = "OK",
- [PA_ERR_ACCESS] = "Access denied",
- [PA_ERR_COMMAND] = "Unknown command",
- [PA_ERR_INVALID] = "Invalid argument",
- [PA_ERR_EXIST] = "Entity exists",
- [PA_ERR_NOENTITY] = "No such entity",
- [PA_ERR_CONNECTIONREFUSED] = "Connection refused",
- [PA_ERR_PROTOCOL] = "Protocol error",
- [PA_ERR_TIMEOUT] = "Timeout",
- [PA_ERR_AUTHKEY] = "No authorization key",
- [PA_ERR_INTERNAL] = "Internal error",
- [PA_ERR_CONNECTIONTERMINATED] = "Connection terminated",
- [PA_ERR_KILLED] = "Entity killed",
- [PA_ERR_INVALIDSERVER] = "Invalid server",
- [PA_ERR_MODINITFAILED] = "Module initalization failed",
- [PA_ERR_BADSTATE] = "Bad state",
- [PA_ERR_NODATA] = "No data",
- [PA_ERR_VERSION] = "Incompatible protocol version",
- [PA_ERR_TOOLARGE] = "Too large"
-};
-
-const char*pa_strerror(int error) {
- if (error < 0 || error >= PA_ERR_MAX)
- return NULL;
-
- return errortab[error];
-}
+#include "core-error.h"
#ifdef HAVE_PTHREAD
Copied: trunk/src/polypcore/core-error.h (from r970, trunk/src/polyp/error.h)
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-error.h?p2=trunk/src/polypcore/core-error.h&p1=trunk/src/polyp/error.h&r1=970&r2=972&rev=972&root=polypaudio&view=diff
==============================================================================
--- trunk/src/polyp/error.h (original)
+++ trunk/src/polypcore/core-error.h Thu May 25 19:16:55 2006
@@ -1,5 +1,5 @@
-#ifndef fooerrorhfoo
-#define fooerrorhfoo
+#ifndef foocoreerrorhfoo
+#define foocoreerrorhfoo
/* $Id$ */
@@ -30,9 +30,6 @@
PA_C_DECL_BEGIN
-/** Return a human readable error message for the specified numeric error code */
-const char* pa_strerror(int error);
-
/** A wrapper around the standard strerror() function that converts the
* string to UTF-8. The function is thread safe but the returned string is
* only guaranteed to exist until the thread exits or pa_cstrerror() is
Modified: trunk/src/polypcore/core-scache.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-scache.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/core-scache.c (original)
+++ trunk/src/polypcore/core-scache.c Thu May 25 19:16:55 2006
@@ -41,7 +41,6 @@
#include <windows.h>
#endif
-#include <polyp/error.h>
#include <polyp/mainloop.h>
#include <polyp/channelmap.h>
#include <polyp/timeval.h>
@@ -57,6 +56,7 @@
#include <polypcore/sound-file.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
+#include <polypcore/core-error.h>
#include "core-scache.h"
Modified: trunk/src/polypcore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-util.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/core-util.c (original)
+++ trunk/src/polypcore/core-util.c Thu May 25 19:16:55 2006
@@ -69,10 +69,10 @@
#include <samplerate.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polyp/util.h>
+#include <polypcore/core-error.h>
#include <polypcore/winsock.h>
#include <polypcore/log.h>
Modified: trunk/src/polypcore/iochannel.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/iochannel.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/iochannel.c (original)
+++ trunk/src/polypcore/iochannel.c Thu May 25 19:16:55 2006
@@ -38,9 +38,9 @@
#include "winsock.h"
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/socket-util.h>
#include <polypcore/log.h>
Modified: trunk/src/polypcore/ioline.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/ioline.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/ioline.c (original)
+++ trunk/src/polypcore/ioline.c Thu May 25 19:16:55 2006
@@ -29,9 +29,9 @@
#include <stdlib.h>
#include <string.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/log.h>
#include "ioline.h"
Modified: trunk/src/polypcore/pid.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/pid.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/pid.c (original)
+++ trunk/src/polypcore/pid.c Thu May 25 19:16:55 2006
@@ -39,9 +39,9 @@
#include <windows.h>
#endif
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
Modified: trunk/src/polypcore/protocol-esound.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-esound.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-esound.c (original)
+++ trunk/src/polypcore/protocol-esound.c Thu May 25 19:16:55 2006
@@ -30,7 +30,6 @@
#include <stdlib.h>
#include <limits.h>
-#include <polyp/error.h>
#include <polyp/sample.h>
#include <polyp/timeval.h>
#include <polyp/utf8.h>
@@ -49,6 +48,7 @@
#include <polypcore/namereg.h>
#include <polypcore/log.h>
#include <polypcore/core-util.h>
+#include <polypcore/core-error.h>
#include "endianmacros.h"
Modified: trunk/src/polypcore/protocol-simple.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-simple.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-simple.c (original)
+++ trunk/src/polypcore/protocol-simple.c Thu May 25 19:16:55 2006
@@ -30,7 +30,6 @@
#include <errno.h>
#include <string.h>
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/sink-input.h>
@@ -39,6 +38,7 @@
#include <polypcore/sample-util.h>
#include <polypcore/namereg.h>
#include <polypcore/log.h>
+#include <polypcore/core-error.h>
#include "protocol-simple.h"
Modified: trunk/src/polypcore/socket-client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/socket-client.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/socket-client.c (original)
+++ trunk/src/polypcore/socket-client.c Thu May 25 19:16:55 2006
@@ -54,10 +54,10 @@
#include "winsock.h"
-#include <polyp/error.h>
#include <polyp/timeval.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/socket-util.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
Modified: trunk/src/polypcore/socket-server.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/socket-server.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/socket-server.c (original)
+++ trunk/src/polypcore/socket-server.c Thu May 25 19:16:55 2006
@@ -64,11 +64,11 @@
#include <polyp/xmalloc.h>
#include <polyp/util.h>
-#include <polyp/error.h>
#include <polypcore/socket-util.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
+#include <polypcore/core-error.h>
#include "socket-server.h"
Modified: trunk/src/polypcore/socket-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/socket-util.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/polypcore/socket-util.c (original)
+++ trunk/src/polypcore/socket-util.c Thu May 25 19:16:55 2006
@@ -59,9 +59,9 @@
#include "winsock.h"
-#include <polyp/error.h>
#include <polyp/xmalloc.h>
+#include <polypcore/core-error.h>
#include <polypcore/core-util.h>
#include <polypcore/log.h>
Modified: trunk/src/utils/pacmd.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/pacmd.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/utils/pacmd.c (original)
+++ trunk/src/utils/pacmd.c Thu May 25 19:16:55 2006
@@ -54,7 +54,7 @@
}
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- pa_log(__FILE__": socket(PF_UNIX, SOCK_STREAM, 0): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": socket(PF_UNIX, SOCK_STREAM, 0): %s", strerror(errno));
goto fail;
}
@@ -66,7 +66,7 @@
int r;
if ((r = connect(fd, (struct sockaddr*) &sa, sizeof(sa))) < 0 && (errno != ECONNREFUSED && errno != ENOENT)) {
- pa_log(__FILE__": connect(): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": connect(): %s", strerror(errno));
goto fail;
}
@@ -97,7 +97,7 @@
for (;;) {
if (select(FD_SETSIZE, &ifds, &ofds, NULL, NULL) < 0) {
- pa_log(__FILE__": select(): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": select(): %s", strerror(errno));
goto fail;
}
@@ -109,7 +109,7 @@
if (r == 0)
break;
- pa_log(__FILE__": read(): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": read(): %s", strerror(errno));
goto fail;
}
@@ -125,7 +125,7 @@
if (r == 0)
break;
- pa_log(__FILE__": read(): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": read(): %s", strerror(errno));
goto fail;
}
@@ -138,7 +138,7 @@
assert(obuf_length);
if ((r = write(1, obuf + obuf_index, obuf_length)) < 0) {
- pa_log(__FILE__": write(): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": write(): %s", strerror(errno));
goto fail;
}
@@ -152,7 +152,7 @@
assert(ibuf_length);
if ((r = write(fd, ibuf + ibuf_index, ibuf_length)) < 0) {
- pa_log(__FILE__": write(): %s", pa_cstrerror(errno));
+ pa_log(__FILE__": write(): %s", strerror(errno));
goto fail;
}
Modified: trunk/src/utils/padsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/padsp.c?rev=972&root=polypaudio&r1=971&r2=972&view=diff
==============================================================================
--- trunk/src/utils/padsp.c (original)
+++ trunk/src/utils/padsp.c Thu May 25 19:16:55 2006
@@ -361,7 +361,7 @@
i->n_fragments = 0;
}
-static char *client_name(char *buf, size_t n) {
+static const char *client_name(char *buf, size_t n) {
char p[PATH_MAX];
const char *e;
@@ -376,7 +376,7 @@
return buf;
}
-static char *stream_name(void) {
+static const char *stream_name(void) {
const char *e;
if ((e = getenv("PADSP_STREAM_NAME")))
More information about the pulseaudio-commits
mailing list