[pulseaudio-commits] 3 commits - src/modules src/pulsecore src/utils

Peter Meerwald pmeerw at kemper.freedesktop.org
Wed Mar 8 13:32:09 UTC 2017


 src/modules/dbus/module-dbus-protocol.c |    4 ++--
 src/modules/raop/raop-client.c          |   30 +++++++++++++++---------------
 src/modules/raop/raop-sink.c            |    2 +-
 src/pulsecore/core-util.c               |    4 ++--
 src/pulsecore/dbus-util.c               |    4 ++--
 src/pulsecore/shm.c                     |    2 +-
 src/utils/padsp.c                       |    6 +++---
 7 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 74abce331b8423219911de33f99c0870f871633d
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Tue Mar 7 14:29:12 2017 +0100

    raop: Fix check for invalid file descriptor
    
    file descriptor 0 is valid
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/modules/raop/raop-client.c b/src/modules/raop/raop-client.c
index 1bd4c4a..f23cf93 100644
--- a/src/modules/raop/raop-client.c
+++ b/src/modules/raop/raop-client.c
@@ -968,10 +968,10 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
             break;
 
         annonce_error:
-            if (c->udp_cfd > 0)
+            if (c->udp_cfd >= 0)
                 pa_close(c->udp_cfd);
             c->udp_cfd = -1;
-            if (c->udp_tfd > 0)
+            if (c->udp_tfd >= 0)
                 pa_close(c->udp_tfd);
             c->udp_tfd = -1;
 
@@ -1073,11 +1073,11 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
             break;
 
         setup_error:
-            if (c->tcp_sfd > 0)
+            if (c->tcp_sfd >= 0)
                 pa_close(c->tcp_sfd);
             c->tcp_sfd = -1;
 
-            if (c->udp_sfd > 0)
+            if (c->udp_sfd >= 0)
                 pa_close(c->udp_sfd);
             c->udp_sfd = -1;
 
@@ -1135,11 +1135,11 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
         case STATE_TEARDOWN: {
             pa_log_debug("RAOP: TEARDOWN");
 
-            if (c->tcp_sfd > 0)
+            if (c->tcp_sfd >= 0)
                 pa_close(c->tcp_sfd);
             c->tcp_sfd = -1;
 
-            if (c->udp_sfd > 0)
+            if (c->udp_sfd >= 0)
                 pa_close(c->udp_sfd);
             c->udp_sfd = -1;
 
@@ -1163,11 +1163,11 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
 
             c->is_recording = false;
 
-            if (c->tcp_sfd > 0)
+            if (c->tcp_sfd >= 0)
                 pa_close(c->tcp_sfd);
             c->tcp_sfd = -1;
 
-            if (c->udp_sfd > 0)
+            if (c->udp_sfd >= 0)
                 pa_close(c->udp_sfd);
             c->udp_sfd = -1;
 
@@ -1507,11 +1507,11 @@ bool pa_raop_client_is_alive(pa_raop_client *c) {
 
     switch (c->protocol) {
         case PA_RAOP_PROTOCOL_TCP:
-            if (c->tcp_sfd > 0)
+            if (c->tcp_sfd >= 0)
                 return true;
             break;
         case PA_RAOP_PROTOCOL_UDP:
-            if (c->udp_sfd > 0)
+            if (c->udp_sfd >= 0)
                 return true;
             break;
         default:
@@ -1531,11 +1531,11 @@ bool pa_raop_client_can_stream(pa_raop_client *c) {
 
     switch (c->protocol) {
         case PA_RAOP_PROTOCOL_TCP:
-            if (c->tcp_sfd > 0 && c->is_recording)
+            if (c->tcp_sfd >= 0 && c->is_recording)
                 return true;
             break;
         case PA_RAOP_PROTOCOL_UDP:
-            if (c->udp_sfd > 0 && c->is_recording)
+            if (c->udp_sfd >= 0 && c->is_recording)
                 return true;
             break;
         default:
@@ -1557,14 +1557,14 @@ int pa_raop_client_stream(pa_raop_client *c) {
 
     switch (c->protocol) {
         case PA_RAOP_PROTOCOL_TCP:
-            if (c->tcp_sfd > 0 && !c->is_recording) {
+            if (c->tcp_sfd >= 0 && !c->is_recording) {
                 c->is_recording = true;
                 c->is_first_packet = true;
                 c->sync_count = 0;
             }
             break;
         case PA_RAOP_PROTOCOL_UDP:
-            if (c->udp_sfd > 0 && !c->is_recording) {
+            if (c->udp_sfd >= 0 && !c->is_recording) {
                 c->is_recording = true;
                 c->is_first_packet = true;
                 c->sync_count = 0;
@@ -1722,7 +1722,7 @@ pa_volume_t pa_raop_client_adjust_volume(pa_raop_client *c, pa_volume_t volume)
 
 void pa_raop_client_handle_oob_packet(pa_raop_client *c, const int fd, const uint8_t packet[], ssize_t size) {
     pa_assert(c);
-    pa_assert(fd > 0);
+    pa_assert(fd >= 0);
     pa_assert(packet);
 
     if (c->protocol == PA_RAOP_PROTOCOL_UDP) {
diff --git a/src/modules/raop/raop-sink.c b/src/modules/raop/raop-sink.c
index d321a2d..c5ff8b9 100644
--- a/src/modules/raop/raop-sink.c
+++ b/src/modules/raop/raop-sink.c
@@ -247,7 +247,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
                     if (u->rtpoll_item) {
                         pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, &nbfds);
                         for (i = 0; i < nbfds; i++) {
-                            if (pollfd && pollfd->fd > 0)
+                            if (pollfd && pollfd->fd >= 0)
                                pa_close(pollfd->fd);
                             pollfd++;
                         }

commit 6b7b70c47298bf76d4509e85658b37c2b1f67378
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Tue Mar 7 14:53:13 2017 +0100

    core-util: Fix description of pa_split()
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index cd1c96d..d4cfa20 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1062,7 +1062,7 @@ int pa_parse_volume(const char *v, pa_volume_t *volume) {
     return 0;
 }
 
-/* Split the specified string wherever one of the strings in delimiter
+/* Split the specified string wherever one of the characters in delimiter
  * occurs. Each time it is called returns a newly allocated string
  * with pa_xmalloc(). The variable state points to, should be
  * initialized to NULL before the first call. */
@@ -1082,7 +1082,7 @@ char *pa_split(const char *c, const char *delimiter, const char**state) {
     return pa_xstrndup(current, l);
 }
 
-/* Split the specified string wherever one of the strings in delimiter
+/* Split the specified string wherever one of the characters in delimiter
  * occurs. Each time it is called returns a pointer to the substring within the
  * string and the length in 'n'. Note that the resultant string cannot be used
  * as-is without the length parameter, since it is merely pointing to a point

commit a199b9045ea154b0996f3f74fcbe4c1adcd0aa22
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Tue Mar 7 16:29:30 2017 +0100

    build: Use #ifdef to check for #defines
    
    for example, in case HAVE_MEMFD is #undef, checking with #if HAVE_MEMFD
    gives a warning (gcc 5.4.1, Ubuntu)
    
    pulsecore/shm.c: In function 'sharedmem_create':
    pulsecore/shm.c:208:5: warning: "HAVE_MEMFD" is not defined [-Wundef]
     #if HAVE_MEMFD
    
    use #ifdef or #if defined() to check for presence of a #define
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/modules/dbus/module-dbus-protocol.c b/src/modules/dbus/module-dbus-protocol.c
index 8079d6b..2cd206e 100644
--- a/src/modules/dbus/module-dbus-protocol.c
+++ b/src/modules/dbus/module-dbus-protocol.c
@@ -220,7 +220,7 @@ static void io_event_cb(pa_mainloop_api *mainloop, pa_io_event *e, int fd, pa_io
     unsigned int flags = 0;
     DBusWatch *watch = userdata;
 
-#if HAVE_DBUS_WATCH_GET_UNIX_FD
+#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
     pa_assert(fd == dbus_watch_get_unix_fd(watch));
 #else
     pa_assert(fd == dbus_watch_get_fd(watch));
@@ -291,7 +291,7 @@ static dbus_bool_t watch_add_cb(DBusWatch *watch, void *data) {
 
     ev = mainloop->io_new(
             mainloop,
-#if HAVE_DBUS_WATCH_GET_UNIX_FD
+#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
             dbus_watch_get_unix_fd(watch),
 #else
             dbus_watch_get_fd(watch),
diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index d786af4..80e2866 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -100,7 +100,7 @@ static void handle_io_event(pa_mainloop_api *ea, pa_io_event *e, int fd, pa_io_e
     unsigned int flags = 0;
     DBusWatch *watch = userdata;
 
-#if HAVE_DBUS_WATCH_GET_UNIX_FD
+#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
     pa_assert(fd == dbus_watch_get_unix_fd(watch));
 #else
     pa_assert(fd == dbus_watch_get_fd(watch));
@@ -153,7 +153,7 @@ static dbus_bool_t add_watch(DBusWatch *watch, void *data) {
 
     ev = c->mainloop->io_new(
             c->mainloop,
-#if HAVE_DBUS_WATCH_GET_UNIX_FD
+#ifdef HAVE_DBUS_WATCH_GET_UNIX_FD
             dbus_watch_get_unix_fd(watch),
 #else
             dbus_watch_get_fd(watch),
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index 919d71a..0742cb8 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -205,7 +205,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m
         pa_assert_se(pa_close(fd) == 0);
         m->fd = -1;
     }
-#if HAVE_MEMFD
+#ifdef HAVE_MEMFD
     else
         m->fd = fd;
 #endif
diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index 7a94114..f74122a 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -2285,7 +2285,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
             break;
         }
 
-#if HAVE_DECL_SOUND_PCM_READ_RATE
+#ifdef HAVE_DECL_SOUND_PCM_READ_RATE
         case SOUND_PCM_READ_RATE:
             debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_RATE\n");
 
@@ -2295,7 +2295,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
             break;
 #endif
 
-#if HAVE_DECL_SOUND_PCM_READ_CHANNELS
+#ifdef HAVE_DECL_SOUND_PCM_READ_CHANNELS
         case SOUND_PCM_READ_CHANNELS:
             debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_CHANNELS\n");
 
@@ -2305,7 +2305,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
             break;
 #endif
 
-#if HAVE_DECL_SOUND_PCM_READ_BITS
+#ifdef HAVE_DECL_SOUND_PCM_READ_BITS
         case SOUND_PCM_READ_BITS:
             debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_BITS\n");
 



More information about the pulseaudio-commits mailing list