[pulseaudio-commits] 7 commits - src/modules src/pulsecore src/tests

Peter Meerwald pmeerw at kemper.freedesktop.org
Mon Oct 9 08:42:59 UTC 2017


 src/modules/bluetooth/bluez5-util.c |    2 +-
 src/modules/raop/raop-client.c      |    6 +++---
 src/pulsecore/iochannel.c           |    2 +-
 src/pulsecore/protocol-esound.c     |    5 ++---
 src/pulsecore/protocol-simple.c     |    5 ++---
 src/pulsecore/resampler.c           |   10 +++++-----
 src/pulsecore/sink-input.c          |   11 +++--------
 src/pulsecore/source-output.c       |   11 +++--------
 src/tests/json-test.c               |    6 +++++-
 9 files changed, 25 insertions(+), 33 deletions(-)

New commits:
commit cbc442482118007bc03dcf6c3455b1cb3d877671
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 12:16:31 2017 +0200

    core: Fix gcc-7 -Wimplicit-fallthrough= warnings by rearranging comment
    
    'Fall through.' must appear separately
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c
index 4f83ac48..a0aca975 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.c
@@ -1354,11 +1354,10 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
         case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
             pa_usec_t *r = userdata;
 
+            /* The default handler will add in the extra latency added by the resampler. */
             *r = pa_bytes_to_usec(pa_memblockq_get_length(c->input_memblockq), &c->sink_input->sample_spec);
-
-            /* Fall through, the default handler will add in the extra
-             * latency added by the resampler */
         }
+        /* Fall through. */
 
         default:
             return pa_sink_input_process_msg(o, code, userdata, offset, chunk);
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index 923ec87b..5e2d6c8f 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -336,11 +336,10 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
         case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
             pa_usec_t *r = userdata;
 
+            /* The default handler will add in the extra latency added by the resampler.*/
             *r = pa_bytes_to_usec(pa_memblockq_get_length(c->input_memblockq), &c->sink_input->sample_spec);
-
-            /* Fall through, the default handler will add in the extra
-             * latency added by the resampler */
         }
+        /* Fall through. */
 
         default:
             return pa_sink_input_process_msg(o, code, userdata, offset, chunk);

commit 78f964d605336c030283fbda45d426ac3c7173ec
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 11:26:15 2017 +0200

    core: Fix typo and gcc-7 -Wimplicit-fallthrough= warnings
    
    Correct spelling of 'through' in a comment helps to fix a warning :)
    also drop some unrelated comments
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 063c4c5a..d42cbc29 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -161,7 +161,7 @@ static pa_resample_method_t fix_method(
                 method = PA_RESAMPLER_AUTO;
                 break;
             }
-                                     /* Else fall through */
+            /* Else fall through */
         case PA_RESAMPLER_FFMPEG:
         case PA_RESAMPLER_SOXR_MQ:
         case PA_RESAMPLER_SOXR_HQ:
@@ -273,20 +273,20 @@ static pa_sample_format_t choose_work_format(
     switch (method) {
         /* This block is for resampling functions that only
          * support the S16 sample format. */
-        case PA_RESAMPLER_SPEEX_FIXED_BASE:     /* fall through */
+        case PA_RESAMPLER_SPEEX_FIXED_BASE:
         case PA_RESAMPLER_FFMPEG:
             work_format = PA_SAMPLE_S16NE;
             break;
 
         /* This block is for resampling functions that support
          * any sample format. */
-        case PA_RESAMPLER_COPY:                 /* fall through */
+        case PA_RESAMPLER_COPY:
         case PA_RESAMPLER_TRIVIAL:
             if (!map_required && a == b) {
                 work_format = a;
                 break;
             }
-                                                /* Else fall trough */
+            /* Else fall through */
         case PA_RESAMPLER_PEAKS:
             /* PEAKS, COPY and TRIVIAL do not benefit from increased
              * working precision, so for better performance use s16ne
@@ -295,7 +295,7 @@ static pa_sample_format_t choose_work_format(
                 work_format = PA_SAMPLE_S16NE;
                 break;
             }
-                                                /* Else fall trough */
+            /* Else fall through */
         case PA_RESAMPLER_SOXR_MQ:
         case PA_RESAMPLER_SOXR_HQ:
         case PA_RESAMPLER_SOXR_VHQ:

commit 6f065f95898ef813d16c4b17c678da5fb6074ea6
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 11:20:54 2017 +0200

    core: Fix gcc-7 -Wimplicit-fallthrough= warnings
    
    the comment /* Fall through. */ fixes the warning, but gcc-7 seems to be more
    picky about the position in the code
    
    pulsecore/sink-input.c: In function ‘pa_sink_input_update_proplist’:
    pulsecore/sink-input.c:1531:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
                 for (state = NULL; (key = pa_proplist_iterate(i->proplist, &state));) {
                 ^~~
    pulsecore/sink-input.c:1539:9: note: here
             case PA_UPDATE_REPLACE: {
             ^~~~
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 4155b69a..d1e16ee2 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1526,7 +1526,7 @@ void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_p
     pa_assert_ctl_context();
 
     switch (mode) {
-        case PA_UPDATE_SET: {
+        case PA_UPDATE_SET:
             /* Delete everything that is not in p. */
             for (state = NULL; (key = pa_proplist_iterate(i->proplist, &state));) {
                 if (!pa_proplist_contains(p, key))
@@ -1534,18 +1534,14 @@ void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_p
             }
 
             /* Fall through. */
-        }
-
-        case PA_UPDATE_REPLACE: {
+        case PA_UPDATE_REPLACE:
             for (state = NULL; (key = pa_proplist_iterate(p, &state));) {
                 pa_proplist_get(p, key, (const void **) &value, &nbytes);
                 pa_sink_input_set_property_arbitrary(i, key, value, nbytes);
             }
 
             break;
-        }
-
-        case PA_UPDATE_MERGE: {
+        case PA_UPDATE_MERGE:
             for (state = NULL; (key = pa_proplist_iterate(p, &state));) {
                 if (pa_proplist_contains(i->proplist, key))
                     continue;
@@ -1555,7 +1551,6 @@ void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_p
             }
 
             break;
-        }
     }
 }
 
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index a4c99af0..d2b645c2 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -1171,7 +1171,7 @@ void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode
     pa_assert_ctl_context();
 
     switch (mode) {
-        case PA_UPDATE_SET: {
+        case PA_UPDATE_SET:
             /* Delete everything that is not in p. */
             for (state = NULL; (key = pa_proplist_iterate(o->proplist, &state));) {
                 if (!pa_proplist_contains(p, key))
@@ -1179,18 +1179,14 @@ void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode
             }
 
             /* Fall through. */
-        }
-
-        case PA_UPDATE_REPLACE: {
+        case PA_UPDATE_REPLACE:
             for (state = NULL; (key = pa_proplist_iterate(p, &state));) {
                 pa_proplist_get(p, key, (const void **) &value, &nbytes);
                 pa_source_output_set_property_arbitrary(o, key, value, nbytes);
             }
 
             break;
-        }
-
-        case PA_UPDATE_MERGE: {
+        case PA_UPDATE_MERGE:
             for (state = NULL; (key = pa_proplist_iterate(p, &state));) {
                 if (pa_proplist_contains(o->proplist, key))
                     continue;
@@ -1200,7 +1196,6 @@ void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode
             }
 
             break;
-        }
     }
 }
 

commit 0f94657cd0ed9a13c0fda061323fb430742a3ae4
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 11:12:26 2017 +0200

    raop: Fix typo
    
    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 24bec3ea..9dc4942f 100644
--- a/src/modules/raop/raop-client.c
+++ b/src/modules/raop/raop-client.c
@@ -526,7 +526,7 @@ static ssize_t resend_udp_audio_packets(pa_raop_client *c, uint16_t seq, uint16_
         if (buffer && packet->length > 0)
             written = pa_write(c->udp_cfd, buffer, packet->length, NULL);
         if (written < 0 && errno == EAGAIN) {
-            pa_log_debug("Discarding UDP (audio-restransmitted, seq=%d) packet due to EAGAIN", seq + i);
+            pa_log_debug("Discarding UDP (audio-retransmitted, seq=%d) packet due to EAGAIN", seq + i);
             pa_memblock_release(packet->memblock);
             continue;
         }

commit a39098fe4d9d3c2036848e8d586b6bd8fe7251ce
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 11:05:29 2017 +0200

    raop: Fix gcc-7 warnings, EWOULDBLOCK
    
    EAGAIN is used allover the code rather than EWOULDBLOCK
    POSIX allows EAGAIN and EWOULDBLOCK to have the same value (and in fact it is)
    don't check for EWOULDBLOCK
    
    modules/raop/raop-client.c: In function ‘send_udp_audio_packet’:
    modules/raop/raop-client.c:473:41: warning: logical ‘or’ of equal expressions [-Wlogical-op]
         if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                             ^~
    modules/raop/raop-client.c: In function ‘resend_udp_audio_packets’:
    modules/raop/raop-client.c:528:45: warning: logical ‘or’ of equal expressions [-Wlogical-op]
             if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                                 ^~
    
    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 ae950f70..24bec3ea 100644
--- a/src/modules/raop/raop-client.c
+++ b/src/modules/raop/raop-client.c
@@ -470,7 +470,7 @@ static ssize_t send_udp_audio_packet(pa_raop_client *c, pa_memchunk *block, size
     buffer += packet->index;
     if (buffer && packet->length > 0)
         written = pa_write(c->udp_sfd, buffer, packet->length, NULL);
-    if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
+    if (written < 0 && errno == EAGAIN) {
         pa_log_debug("Discarding UDP (audio, seq=%d) packet due to EAGAIN (%s)", c->seq, pa_cstrerror(errno));
         written = packet->length;
     }
@@ -525,7 +525,7 @@ static ssize_t resend_udp_audio_packets(pa_raop_client *c, uint16_t seq, uint16_
 
         if (buffer && packet->length > 0)
             written = pa_write(c->udp_cfd, buffer, packet->length, NULL);
-        if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
+        if (written < 0 && errno == EAGAIN) {
             pa_log_debug("Discarding UDP (audio-restransmitted, seq=%d) packet due to EAGAIN", seq + i);
             pa_memblock_release(packet->memblock);
             continue;
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index 89733752..e25824b7 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -227,7 +227,7 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) {
         return r; /* Fast path - we almost always successfully write everything */
 
     if (r < 0) {
-        if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
+        if (errno == EINTR || errno == EAGAIN)
             r = 0;
         else
             return r;

commit d911dd48ce55a71522b63b12cafbb2552d210e78
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 09:56:10 2017 +0200

    bluetooth: bluez5: Fix Coverity warning
    
    Use pa_assert_se() to check return value (pro forma) like everywhere else
    
    Coverity ID: #154313
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index 304a26e8..cc8d87f9 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -1024,7 +1024,7 @@ void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is
 
                 pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, d->path, "org.bluez.Device1", "Disconnect"));
                 dbus_message_set_no_reply(m, true);
-                dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL);
+                pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL));
                 dbus_message_unref(m);
             }
         }

commit bba8c350a589af3c38d09d7253c02a7ce040f6c6
Author: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
Date:   Wed Sep 6 09:53:06 2017 +0200

    json-test: Fix Coverity warning
    
    Cosmetic resource leak in test code
    
    Coverity ID: #1454314
    
    Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>

diff --git a/src/tests/json-test.c b/src/tests/json-test.c
index 3e956dba..0894a306 100644
--- a/src/tests/json-test.c
+++ b/src/tests/json-test.c
@@ -248,7 +248,11 @@ START_TEST(bad_test) {
     };
 
     for (i = 0; i < PA_ELEMENTSOF(bad_parse); i++) {
-        fail_unless(pa_json_parse(bad_parse[i]) == NULL);
+        pa_json_object *obj;
+
+        fail_unless((obj = pa_json_parse(bad_parse[i])) == NULL);
+        if (obj)
+            pa_json_object_free(obj);
     }
 }
 END_TEST



More information about the pulseaudio-commits mailing list