[pulseaudio-commits] 7 commits - README src/daemon src/modules src/pulse src/pulsecore src/tests

Peter Meerwald pmeerw at kemper.freedesktop.org
Tue Oct 28 09:38:03 PDT 2014


 README                              |    3 ---
 src/daemon/main.c                   |   12 ++++++------
 src/modules/alsa/alsa-sink.c        |    4 ++--
 src/modules/alsa/alsa-source.c      |    2 +-
 src/modules/module-equalizer-sink.c |    2 +-
 src/modules/module-tunnel.c         |   12 ++++++------
 src/modules/rtp/module-rtp-send.c   |    2 +-
 src/pulse/context.c                 |    4 ++--
 src/pulse/mainloop.c                |    4 ++--
 src/pulsecore/iochannel.c           |    2 +-
 src/pulsecore/memblock.c            |    2 +-
 src/pulsecore/pid.c                 |    2 +-
 src/pulsecore/sink-input.c          |    2 +-
 src/pulsecore/sink.c                |    2 +-
 src/pulsecore/sink.h                |    2 +-
 src/pulsecore/source-output.c       |    2 +-
 src/pulsecore/source.c              |    2 +-
 src/tests/srbchannel-test.c         |   18 +++++++++---------
 18 files changed, 38 insertions(+), 41 deletions(-)

New commits:
commit 72e5671eceacda19bc490be19fd8afa505418ed4
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 11:35:29 2014 +0200

    tests: Be careful with data types to avoid cast
    
    use unsigned and size_t for counters and packet length, resp.
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/tests/srbchannel-test.c b/src/tests/srbchannel-test.c
index 7fd793f..bf7b0f0 100644
--- a/src/tests/srbchannel-test.c
+++ b/src/tests/srbchannel-test.c
@@ -32,23 +32,23 @@
 #include <pulsecore/iochannel.h>
 #include <pulsecore/memblock.h>
 
-static int packets_received;
-static int packets_checksum;
-static int packets_length;
+static unsigned packets_received;
+static unsigned packets_checksum;
+static size_t packets_length;
 
 static void packet_received(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
-    unsigned int i;
-    fail_unless(packets_length == (int) packet->length);
+    unsigned i;
+    fail_unless(packets_length == packet->length);
     packets_received++;
     for (i = 0; i < packet->length; i++)
         packets_checksum += packet->data[i];
 }
 
-static void packet_test(int npackets, int plength, pa_mainloop *ml, pa_pstream *p1, pa_pstream *p2) {
+static void packet_test(unsigned npackets, size_t plength, pa_mainloop *ml, pa_pstream *p1, pa_pstream *p2) {
     pa_packet *packet = pa_packet_new(plength);
-    int i;
-    int psum = 0, totalsum = 0;
-    pa_log_info("Sending %d packets of length %d", npackets, plength);
+    unsigned i;
+    unsigned psum = 0, totalsum = 0;
+    pa_log_info("Sending %d packets of length %zd", npackets, plength);
     packets_received = 0;
     packets_checksum = 0;
     packets_length = plength;

commit 974fd3bcfd04f51ac0a640a0fae10f7df32b709e
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 11:28:39 2014 +0200

    tests: Make global variables static in srbchannel-test
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/tests/srbchannel-test.c b/src/tests/srbchannel-test.c
index 78a401b..7fd793f 100644
--- a/src/tests/srbchannel-test.c
+++ b/src/tests/srbchannel-test.c
@@ -32,9 +32,9 @@
 #include <pulsecore/iochannel.h>
 #include <pulsecore/memblock.h>
 
-int packets_received;
-int packets_checksum;
-int packets_length;
+static int packets_received;
+static int packets_checksum;
+static int packets_length;
 
 static void packet_received(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
     unsigned int i;

commit b7e763bab403f464d8d778aa671b61fc5c74887c
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 11:47:44 2014 +0200

    alsa-sink: Check for after-avail is redundant
    
    after-avail is always false at this point
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index c8654fb..01c3a66 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -648,7 +648,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bo
 
             if (PA_UNLIKELY((sframes = snd_pcm_mmap_commit(u->pcm_handle, offset, frames)) < 0)) {
 
-                if (!after_avail && (int) sframes == -EAGAIN)
+                if ((int) sframes == -EAGAIN)
                     break;
 
                 if ((r = try_recover(u, "snd_pcm_mmap_commit", (int) sframes)) == 0)

commit e798969fd524f4c9ef5a53748c782ffb8b402ec9
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 15:40:15 2014 +0200

    modules: Fix )== typos
    
    add a space between ) and ==
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 9e9b863..c8654fb 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -630,7 +630,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bo
 
             /* Check these are multiples of 8 bit */
             pa_assert((areas[0].first & 7) == 0);
-            pa_assert((areas[0].step & 7)== 0);
+            pa_assert((areas[0].step & 7) == 0);
 
             /* We assume a single interleaved memory buffer */
             pa_assert((areas[0].first >> 3) == 0);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 2da0513..aa47c3f 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -587,7 +587,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, boo
 
             /* Check these are multiples of 8 bit */
             pa_assert((areas[0].first & 7) == 0);
-            pa_assert((areas[0].step & 7)== 0);
+            pa_assert((areas[0].step & 7) == 0);
 
             /* We assume a single interleaved memory buffer */
             pa_assert((areas[0].first >> 3) == 0);
diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
index bcaaecd..811bbc2 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -1619,7 +1619,7 @@ void dbus_done(struct userdata *u) {
 
     pa_assert_se(sink_list=pa_shared_get(u->sink->core,SINKLIST));
     pa_idxset_remove_by_data(sink_list,u,&dummy);
-    if (pa_idxset_size(sink_list)==0) {
+    if (pa_idxset_size(sink_list) == 0) {
         pa_dbus_protocol_unregister_extension(u->dbus_protocol, EXTNAME);
         pa_dbus_protocol_remove_interface(u->dbus_protocol, MANAGER_PATH, manager_info.name);
         pa_shared_remove(u->sink->core, EQDB);

commit ab377291475905914002892cccfee44b44c48394
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 14:24:28 2014 +0200

    mainloop: Fix typo
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 5ef58ff..c7a5236 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -771,7 +771,7 @@ void pa_mainloop_wakeup(pa_mainloop *m) {
     pa_assert(m);
 
     if (pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type) < 0)
-        /* Not much options for recovering from the error. Let's at least log something. */
+        /* Not many options for recovering from the error. Let's at least log something. */
         pa_log("pa_write() failed while trying to wake up the mainloop: %s", pa_cstrerror(errno));
 }
 
@@ -837,7 +837,7 @@ int pa_mainloop_poll(pa_mainloop *m) {
 
     m->state = STATE_POLLING;
 
-    if (m->n_enabled_defer_events )
+    if (m->n_enabled_defer_events)
         m->poll_func_ret = 0;
     else {
         pa_assert(!m->rebuild_pollfds);

commit f390e6e9745ab85a24b8bf1e135fd09cb474c1c4
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 15:00:29 2014 +0200

    Cleanup !! for bool
    
    !!x makes no sense if x is bool (this is a leftover from the
    convertion pa_bool_t -> bool, d806b197)
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/daemon/main.c b/src/daemon/main.c
index 4fd245a..d2a8a8a 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -1009,11 +1009,11 @@ int main(int argc, char *argv[]) {
     c->scache_idle_time = conf->scache_idle_time;
     c->resample_method = conf->resample_method;
     c->realtime_priority = conf->realtime_priority;
-    c->realtime_scheduling = !!conf->realtime_scheduling;
-    c->disable_remixing = !!conf->disable_remixing;
-    c->disable_lfe_remixing = !!conf->disable_lfe_remixing;
-    c->deferred_volume = !!conf->deferred_volume;
-    c->running_as_daemon = !!conf->daemonize;
+    c->realtime_scheduling = conf->realtime_scheduling;
+    c->disable_remixing = conf->disable_remixing;
+    c->disable_lfe_remixing = conf->disable_lfe_remixing;
+    c->deferred_volume = conf->deferred_volume;
+    c->running_as_daemon = conf->daemonize;
     c->disallow_exit = conf->disallow_exit;
     c->flat_volumes = conf->flat_volumes;
 #ifdef HAVE_DBUS
@@ -1081,7 +1081,7 @@ int main(int argc, char *argv[]) {
 
     /* We completed the initial module loading, so let's disable it
      * from now on, if requested */
-    c->disallow_module_loading = !!conf->disallow_module_loading;
+    c->disallow_module_loading = conf->disallow_module_loading;
 
 #ifdef HAVE_DBUS
     if (!conf->system_instance) {
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 193d091..69547eb 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -304,9 +304,9 @@ static void command_suspended(pa_pdispatch *pd,  uint32_t command,  uint32_t tag
     pa_log_debug("Server reports device suspend.");
 
 #ifdef TUNNEL_SINK
-    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #else
-    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #endif
 
     request_latency(u);
@@ -337,9 +337,9 @@ static void command_moved(pa_pdispatch *pd,  uint32_t command,  uint32_t tag, pa
     pa_log_debug("Server reports a stream move.");
 
 #ifdef TUNNEL_SINK
-    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #else
-    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #endif
 
     request_latency(u);
@@ -457,7 +457,7 @@ static void stream_cork(struct userdata *u, bool cork) {
 #endif
     pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->channel);
-    pa_tagstruct_put_boolean(t, !!cork);
+    pa_tagstruct_put_boolean(t, cork);
     pa_pstream_send_tagstruct(u->pstream, t);
 
     request_latency(u);
@@ -1251,7 +1251,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag
 
     pa_assert(u->sink);
 
-    if ((u->version < 11 || !!mute == !!u->sink->muted) &&
+    if ((u->version < 11 || mute == u->sink->muted) &&
         pa_cvolume_equal(&volume, &u->sink->real_volume))
         return;
 
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 0cc595b..7347f78 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -398,7 +398,7 @@ int pa__init(pa_module*m) {
 #endif
     }
 
-    j = !!loop;
+    j = loop;
     if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &j, sizeof(j)) < 0 ||
         setsockopt(sap_fd, IPPROTO_IP, IP_MULTICAST_LOOP, &j, sizeof(j)) < 0) {
         pa_log("IP_MULTICAST_LOOP failed: %s", pa_cstrerror(errno));
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 8897de0..ec9f3ac 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -831,7 +831,7 @@ static int try_next_connection(pa_context *c) {
         if (!(c->client = pa_socket_client_new_string(c->mainloop, c->use_rtclock, u, PA_NATIVE_DEFAULT_PORT)))
             continue;
 
-        c->is_local = !!pa_socket_client_is_local(c->client);
+        c->is_local = pa_socket_client_is_local(c->client);
         pa_socket_client_set_callback(c->client, on_connection, c);
         break;
     }
@@ -1230,7 +1230,7 @@ int pa_context_is_local(pa_context *c) {
     PA_CHECK_VALIDITY_RETURN_ANY(c, !pa_detect_fork(), PA_ERR_FORKED, -1);
     PA_CHECK_VALIDITY_RETURN_ANY(c, PA_CONTEXT_IS_GOOD(c->state), PA_ERR_BADSTATE, -1);
 
-    return !!c->is_local;
+    return c->is_local;
 }
 
 pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index 2971c89..6b1fc7a 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -481,7 +481,7 @@ void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t _callback, voi
 void pa_iochannel_set_noclose(pa_iochannel*io, bool b) {
     pa_assert(io);
 
-    io->no_close = !!b;
+    io->no_close = b;
 }
 
 void pa_iochannel_socket_peer_to_string(pa_iochannel*io, char*s, size_t l) {
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index f57b106..f8b008f 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -910,7 +910,7 @@ int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id) {
 bool pa_mempool_is_shared(pa_mempool *p) {
     pa_assert(p);
 
-    return !!p->memory.shared;
+    return p->memory.shared;
 }
 
 /* For receiving blocks from other nodes */
diff --git a/src/pulsecore/pid.c b/src/pulsecore/pid.c
index e347884..c70b989 100644
--- a/src/pulsecore/pid.c
+++ b/src/pulsecore/pid.c
@@ -174,7 +174,7 @@ static int proc_name_ours(pid_t pid, const char *procname) {
         }
 /*#endif*/
 
-        return !!good;
+        return good;
     }
 #else
 
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index b9698b9..fa379ea 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -179,7 +179,7 @@ void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute) {
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save) {
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a8a865b..46b6eec 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -126,7 +126,7 @@ void pa_sink_new_data_set_muted(pa_sink_new_data *data, bool mute) {
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 void pa_sink_new_data_set_port(pa_sink_new_data *data, const char *port) {
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 9ff5360..d18e0be 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -356,7 +356,7 @@ typedef struct pa_sink_new_data {
     pa_channel_map channel_map;
     uint32_t alternate_sample_rate;
     pa_cvolume volume;
-    bool muted :1;
+    bool muted:1;
 
     bool sample_spec_is_set:1;
     bool channel_map_is_set:1;
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 0012be3..90e86fe 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -122,7 +122,7 @@ void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool m
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save) {
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 6d32666..77fa510 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -117,7 +117,7 @@ void pa_source_new_data_set_muted(pa_source_new_data *data, bool mute) {
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 void pa_source_new_data_set_port(pa_source_new_data *data, const char *port) {

commit 3fb349296ff28a7165d7bcc1a2f759ec26629bd5
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Oct 23 14:57:09 2014 +0200

    Remove link to CIA from README
    
    cia.navi.cx/stats/project/polypaudio does not exist anymore,
    see http://cia.vc/
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/README b/README
index 66c1847..470de40 100644
--- a/README
+++ b/README
@@ -21,9 +21,6 @@ TRAC/BUGZILLA TICKET CHANGES MAILING LIST:
 IRC:
 	#pulseaudio on irc.freenode.org
 
-CIA:
-	http://cia.navi.cx/stats/project/polypaudio
-
 FRESHMEAT:
 	http://freshmeat.net/projects/pulseaudio/
 



More information about the pulseaudio-commits mailing list