[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test7-48-g7cc100d

Lennart Poettering gitmailer-noreply at 0pointer.de
Tue Sep 8 14:58:14 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  b2606cf641f01f688dcb05abcfef3ba003e74efb (commit)

- Log -----------------------------------------------------------------
7cc100d padsp: properly return return values (llvm-clang-analyzer)
b51f5e5 pacat: don't convert stream name twice (llvm-clang-analyzer)
49bc6bc stripnul: initialize 'found' bool properly (llvm-clang-analyzer)
31d1d90 protocol-native: log explicitly when someone asks us to quit
31ae7de core-util: properly fill in exception array for pa_reset_sigs() (llvm-clang-analyzer)
1516b7c conf-parser: properly initialize variable we free() later (llvm-clang-analyzer)
3c9a09b cli-command: don't necessarily ovveride failure code of files (llvm-clang-analyzer)
5fd751f cli-command: modernizations
05506d7 utf8: minor simplification
f3be47f rtsp: document that rtsp_exec() needs fixing (llvm-clang-analyzer)
157ec79 hal: check properly for failure of libhal_find_device_by_capability() (llvm-clang-analyzer)
1380f18 blueooth: actually honour 'room' variable (llvm-clang-analyzer)
382eced alsa-sink: init after_avail earlier (llvm-clang-analyzer)
f504675 llvm-clang-analyzer: drop a few unnecessary assignments and other trivial fixes
-----------------------------------------------------------------------

Summary of changes:
 src/modules/alsa/alsa-mixer.c                   |    2 +-
 src/modules/alsa/alsa-sink.c                    |    5 +--
 src/modules/alsa/alsa-source.c                  |    3 +-
 src/modules/alsa/alsa-util.c                    |    2 +-
 src/modules/bluetooth/module-bluetooth-device.c |    9 ++++--
 src/modules/hal-util.c                          |    2 +-
 src/modules/module-hal-detect.c                 |    4 +--
 src/modules/module-tunnel.c                     |   15 ++++------
 src/modules/raop/base64.c                       |    1 -
 src/modules/rtp/rtsp_client.c                   |    2 +
 src/modules/x11/module-x11-publish.c            |    2 +-
 src/pulse/utf8.c                                |    9 +-----
 src/pulse/volume.c                              |    8 +++---
 src/pulsecore/cli-command.c                     |   34 +++++++++++------------
 src/pulsecore/conf-parser.c                     |    2 +-
 src/pulsecore/core-util.c                       |   15 ++++------
 src/pulsecore/flist.c                           |   22 ++++++++++++---
 src/pulsecore/memtrap.c                         |    4 +-
 src/pulsecore/pid.c                             |    4 +--
 src/pulsecore/protocol-esound.c                 |    4 +--
 src/pulsecore/protocol-native.c                 |    5 ++-
 src/pulsecore/protocol-simple.c                 |    2 +-
 src/pulsecore/sink-input.c                      |    3 --
 src/pulsecore/socket-client.c                   |    4 +--
 src/tests/stripnul.c                            |    2 +-
 src/utils/pacat.c                               |    6 +---
 src/utils/padsp.c                               |    6 ++--
 27 files changed, 84 insertions(+), 93 deletions(-)

-----------------------------------------------------------------------

commit f5046759cdd72daf5ba3b31c9dfc7b8d5be6bc9b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:46:23 2009 +0200

    llvm-clang-analyzer: drop a few unnecessary assignments and other trivial fixes

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 61c92cd..9eb7b46 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2889,7 +2889,7 @@ static void profile_set_add_auto_pair(
     else
         name = pa_sprintf_malloc("input:%s", n->name);
 
-    if ((p = pa_hashmap_get(ps->profiles, name))) {
+    if (pa_hashmap_get(ps->profiles, name)) {
         pa_xfree(name);
         return;
     }
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 195bdf6..63a3e90 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1638,7 +1638,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     const char *dev_id = NULL;
     pa_sample_spec ss, requested_ss;
     pa_channel_map map;
-    uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
+    uint32_t nfrags, frag_size, tsched_size, tsched_watermark;
     snd_pcm_uframes_t period_frames, tsched_frames;
     size_t frame_size;
     pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
@@ -1673,7 +1673,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         goto fail;
     }
 
-    hwbuf_size = frag_size * nfrags;
     period_frames = frag_size/frame_size;
     tsched_frames = tsched_size/frame_size;
 
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index f42d354..64f8980 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1483,7 +1483,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     const char *dev_id = NULL;
     pa_sample_spec ss, requested_ss;
     pa_channel_map map;
-    uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
+    uint32_t nfrags, frag_size, tsched_size, tsched_watermark;
     snd_pcm_uframes_t period_frames, tsched_frames;
     size_t frame_size;
     pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
@@ -1518,7 +1518,6 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         goto fail;
     }
 
-    hwbuf_size = frag_size * nfrags;
     period_frames = frag_size/frame_size;
     tsched_frames = tsched_size/frame_size;
 
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index a47a895..4d75c63 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -900,7 +900,7 @@ void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name) {
     snd_ctl_card_info_alloca(&info);
 
     if ((err = snd_ctl_open(&ctl, name, 0)) < 0) {
-        pa_log_warn("Error opening low-level control device '%s'", name);
+        pa_log_warn("Error opening low-level control device '%s': %s", name, snd_strerror(err));
         return;
     }
 
diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c
index 6034d0e..1851913 100644
--- a/src/modules/module-hal-detect.c
+++ b/src/modules/module-hal-detect.c
@@ -435,9 +435,7 @@ static int hal_device_add_all(struct userdata *u) {
         int i;
 
         for (i = 0; i < n; i++) {
-            struct device *d;
-
-            if ((d = hal_device_add(u, udis[i]))) {
+            if (hal_device_add(u, udis[i])) {
                 count++;
                 pa_log_debug("Loaded device %s", udis[i]);
             } else
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 5ccb81d..af4b8b2 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -332,7 +332,7 @@ static void command_moved(pa_pdispatch *pd,  uint32_t command,  uint32_t tag, pa
 
 static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
     struct userdata *u = userdata;
-    uint32_t channel, maxlength, tlength, fragsize, prebuf, minreq;
+    uint32_t channel, maxlength, tlength = 0, fragsize, prebuf, minreq;
     pa_usec_t usec;
 
     pa_assert(pd);
@@ -1097,7 +1097,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag
     uint32_t idx, owner_module, client, sink;
     pa_usec_t buffer_usec, sink_usec;
     const char *name, *driver, *resample_method;
-    pa_bool_t mute;
+    pa_bool_t mute = FALSE;
     pa_sample_spec sample_spec;
     pa_channel_map channel_map;
     pa_cvolume volume;
@@ -1345,12 +1345,11 @@ static void command_subscribe_event(pa_pdispatch *pd,  uint32_t command,  uint32
 /* Called from main context */
 static void start_subscribe(struct userdata *u) {
     pa_tagstruct *t;
-    uint32_t tag;
     pa_assert(u);
 
     t = pa_tagstruct_new(NULL, 0);
     pa_tagstruct_putu32(t, PA_COMMAND_SUBSCRIBE);
-    pa_tagstruct_putu32(t, tag = u->ctag++);
+    pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, PA_SUBSCRIPTION_MASK_SERVER|
 #ifdef TUNNEL_SINK
                         PA_SUBSCRIPTION_MASK_SINK_INPUT|PA_SUBSCRIPTION_MASK_SINK
@@ -1526,7 +1525,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
 
     reply = pa_tagstruct_new(NULL, 0);
     pa_tagstruct_putu32(reply, PA_COMMAND_SET_CLIENT_NAME);
-    pa_tagstruct_putu32(reply, tag = u->ctag++);
+    pa_tagstruct_putu32(reply, u->ctag++);
 
     if (u->version >= 13) {
         pa_proplist *pl;
@@ -1753,7 +1752,6 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
 static void sink_set_volume(pa_sink *sink) {
     struct userdata *u;
     pa_tagstruct *t;
-    uint32_t tag;
 
     pa_assert(sink);
     u = sink->userdata;
@@ -1761,7 +1759,7 @@ static void sink_set_volume(pa_sink *sink) {
 
     t = pa_tagstruct_new(NULL, 0);
     pa_tagstruct_putu32(t, PA_COMMAND_SET_SINK_INPUT_VOLUME);
-    pa_tagstruct_putu32(t, tag = u->ctag++);
+    pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->device_index);
     pa_tagstruct_put_cvolume(t, &sink->real_volume);
     pa_pstream_send_tagstruct(u->pstream, t);
@@ -1771,7 +1769,6 @@ static void sink_set_volume(pa_sink *sink) {
 static void sink_set_mute(pa_sink *sink) {
     struct userdata *u;
     pa_tagstruct *t;
-    uint32_t tag;
 
     pa_assert(sink);
     u = sink->userdata;
@@ -1782,7 +1779,7 @@ static void sink_set_mute(pa_sink *sink) {
 
     t = pa_tagstruct_new(NULL, 0);
     pa_tagstruct_putu32(t, PA_COMMAND_SET_SINK_INPUT_MUTE);
-    pa_tagstruct_putu32(t, tag = u->ctag++);
+    pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->device_index);
     pa_tagstruct_put_boolean(t, !!sink->muted);
     pa_pstream_send_tagstruct(u->pstream, t);
diff --git a/src/modules/raop/base64.c b/src/modules/raop/base64.c
index e1cbed0..5b06103 100644
--- a/src/modules/raop/base64.c
+++ b/src/modules/raop/base64.c
@@ -57,7 +57,6 @@ int pa_base64_encode(const void *data, int size, char **str)
 
     p = s = pa_xnew(char, size * 4 / 3 + 4);
     q = (const unsigned char *) data;
-    i = 0;
     for (i = 0; i < size;) {
         c = q[i++];
         c *= 256;
diff --git a/src/modules/x11/module-x11-publish.c b/src/modules/x11/module-x11-publish.c
index 2c7fdc1..7ee1b6d 100644
--- a/src/modules/x11/module-x11-publish.c
+++ b/src/modules/x11/module-x11-publish.c
@@ -90,7 +90,7 @@ static void publish_servers(struct userdata *u, pa_strlist *l) {
 
         l = pa_strlist_reverse(l);
         s = pa_strlist_tostring(l);
-        l = pa_strlist_reverse(l);
+        pa_strlist_reverse(l);
 
         pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SERVER", s);
         pa_xfree(s);
diff --git a/src/pulse/utf8.c b/src/pulse/utf8.c
index 6b58bde..9dddf4a 100644
--- a/src/pulse/utf8.c
+++ b/src/pulse/utf8.c
@@ -120,10 +120,8 @@ static char* utf8_validate(const char *str, char *output) {
                 size = 4;
                 min = (1 << 16);
                 val = (uint32_t) (*p & 0x07);
-            } else {
-                size = 1;
+            } else
                 goto error;
-            }
 
             p++;
             if (!is_continuation_char(*p))
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 47bccad..2d2bba2 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -155,7 +155,7 @@ pa_volume_t pa_cvolume_min(const pa_cvolume *a) {
 
 pa_volume_t pa_cvolume_max_mask(const pa_cvolume *a, const pa_channel_map *cm, pa_channel_position_mask_t mask) {
     pa_volume_t m = PA_VOLUME_MUTED;
-    unsigned c, n;
+    unsigned c;
 
     pa_assert(a);
 
@@ -164,7 +164,7 @@ pa_volume_t pa_cvolume_max_mask(const pa_cvolume *a, const pa_channel_map *cm, p
 
     pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(a, cm), PA_VOLUME_MUTED);
 
-    for (c = n = 0; c < a->channels; c++) {
+    for (c = 0; c < a->channels; c++) {
 
         if (!(PA_CHANNEL_POSITION_MASK(cm->map[c]) & mask))
             continue;
@@ -178,7 +178,7 @@ pa_volume_t pa_cvolume_max_mask(const pa_cvolume *a, const pa_channel_map *cm, p
 
 pa_volume_t pa_cvolume_min_mask(const pa_cvolume *a, const pa_channel_map *cm, pa_channel_position_mask_t mask) {
     pa_volume_t m = PA_VOLUME_MAX;
-    unsigned c, n;
+    unsigned c;
 
     pa_assert(a);
 
@@ -187,7 +187,7 @@ pa_volume_t pa_cvolume_min_mask(const pa_cvolume *a, const pa_channel_map *cm, p
 
     pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(a, cm), PA_VOLUME_MUTED);
 
-    for (c = n = 0; c < a->channels; c++) {
+    for (c = 0; c < a->channels; c++) {
 
         if (!(PA_CHANNEL_POSITION_MASK(cm->map[c]) & mask))
             continue;
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 1daa46e..d64c738 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -591,13 +591,13 @@ static int set_scheduler(int rtprio) {
     sp.sched_priority = rtprio;
 
 #ifdef SCHED_RESET_ON_FORK
-    if ((r = pthread_setschedparam(pthread_self(), SCHED_RR|SCHED_RESET_ON_FORK, &sp)) == 0) {
+    if (pthread_setschedparam(pthread_self(), SCHED_RR|SCHED_RESET_ON_FORK, &sp) == 0) {
         pa_log_debug("SCHED_RR|SCHED_RESET_ON_FORK worked.");
         return 0;
     }
 #endif
 
-    if ((r = pthread_setschedparam(pthread_self(), SCHED_RR, &sp)) == 0) {
+    if (pthread_setschedparam(pthread_self(), SCHED_RR, &sp) == 0) {
         pa_log_debug("SCHED_RR worked.");
         return 0;
     }
@@ -786,7 +786,6 @@ int pa_match(const char *expr, const char *v) {
 /* Try to parse a boolean string value.*/
 int pa_parse_boolean(const char *v) {
     const char *expr;
-    int r;
     pa_assert(v);
 
     /* First we check language independant */
@@ -798,12 +797,12 @@ int pa_parse_boolean(const char *v) {
     /* And then we check language dependant */
     if ((expr = nl_langinfo(YESEXPR)))
         if (expr[0])
-            if ((r = pa_match(expr, v)) > 0)
+            if (pa_match(expr, v) > 0)
                 return 1;
 
     if ((expr = nl_langinfo(NOEXPR)))
         if (expr[0])
-            if ((r = pa_match(expr, v)) > 0)
+            if (pa_match(expr, v) > 0)
                 return 0;
 
     errno = EINVAL;
@@ -1195,7 +1194,7 @@ char* pa_strip_nl(char *s) {
 
 /* Create a temporary lock file and lock it. */
 int pa_lock_lockfile(const char *fn) {
-    int fd = -1;
+    int fd;
     pa_assert(fn);
 
     for (;;) {
@@ -1238,8 +1237,6 @@ int pa_lock_lockfile(const char *fn) {
             fd = -1;
             goto fail;
         }
-
-        fd = -1;
     }
 
     return fd;
diff --git a/src/pulsecore/flist.c b/src/pulsecore/flist.c
index 6fb944f..7e5ee24 100644
--- a/src/pulsecore/flist.c
+++ b/src/pulsecore/flist.c
@@ -130,15 +130,22 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
 }
 
 int pa_flist_push(pa_flist*l, void *p) {
-    unsigned idx, n, len;
+    unsigned idx, n;
     pa_atomic_ptr_t*cells;
+#ifdef PROFILE
+    unsigned len;
+#endif
 
     pa_assert(l);
     pa_assert(p);
 
     cells = PA_FLIST_CELLS(l);
 
-    n = len = l->size + N_EXTRA_SCAN - (unsigned) pa_atomic_load(&l->length);
+    n = l->size + N_EXTRA_SCAN - (unsigned) pa_atomic_load(&l->length);
+
+#ifdef PROFILE
+    len = n;
+#endif
 
     _Y;
     idx = reduce(l, (unsigned) pa_atomic_load(&l->write_idx));
@@ -171,14 +178,21 @@ int pa_flist_push(pa_flist*l, void *p) {
 }
 
 void* pa_flist_pop(pa_flist*l) {
-    unsigned idx, len, n;
+    unsigned idx, n;
     pa_atomic_ptr_t *cells;
+#ifdef PROFILE
+    unsigned len;
+#endif
 
     pa_assert(l);
 
     cells = PA_FLIST_CELLS(l);
 
-    n = len = (unsigned) pa_atomic_load(&l->length) + N_EXTRA_SCAN;
+    n = (unsigned) pa_atomic_load(&l->length) + N_EXTRA_SCAN;
+
+#ifdef PROFILE
+    len = n;
+#endif
 
     _Y;
     idx = reduce(l, (unsigned) pa_atomic_load(&l->read_idx));
diff --git a/src/pulsecore/memtrap.c b/src/pulsecore/memtrap.c
index c647e50..373872c 100644
--- a/src/pulsecore/memtrap.c
+++ b/src/pulsecore/memtrap.c
@@ -200,13 +200,13 @@ pa_memtrap *pa_memtrap_update(pa_memtrap *m, const void *start, size_t size) {
         goto unlock;
 
     memtrap_unlink(m, j);
-    j = pa_aupdate_write_swap(aupdate);
+    pa_aupdate_write_swap(aupdate);
 
     m->start = (void*) start;
     m->size = size;
     pa_atomic_store(&m->bad, 0);
 
-    j = pa_aupdate_write_swap(aupdate);
+    pa_assert_se(pa_aupdate_write_swap(aupdate) == j);
     memtrap_link(m, j);
 
 unlock:
diff --git a/src/pulsecore/pid.c b/src/pulsecore/pid.c
index 0087846..996946c 100644
--- a/src/pulsecore/pid.c
+++ b/src/pulsecore/pid.c
@@ -81,7 +81,7 @@ static pid_t read_pid(const char *fn, int fd) {
 }
 
 static int open_pid_file(const char *fn, int mode) {
-    int fd = -1;
+    int fd;
 
     pa_assert(fn);
 
@@ -123,8 +123,6 @@ static int open_pid_file(const char *fn, int mode) {
             fd = -1;
             goto fail;
         }
-
-        fd = -1;
     }
 
     return fd;
diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c
index 480af6d..2326eb3 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.c
@@ -771,7 +771,6 @@ static int esd_proto_stream_pan(connection *c, esd_proto_t request, const void *
 
     memcpy(&rvolume, data, sizeof(uint32_t));
     rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
-    data = (const char*)data + sizeof(uint32_t);
 
     if ((conn = pa_idxset_get_by_index(c->protocol->connections, idx)) && conn->sink_input) {
         pa_cvolume volume;
@@ -809,7 +808,6 @@ static int esd_proto_sample_pan(connection *c, esd_proto_t request, const void *
 
     memcpy(&rvolume, data, sizeof(uint32_t));
     rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
-    data = (const char*)data + sizeof(uint32_t);
 
     volume.values[0] = (lvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
     volume.values[1] = (rvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
@@ -1123,7 +1121,7 @@ static int do_read(connection *c) {
         ssize_t r;
         size_t l;
         void *p;
-        size_t space;
+        size_t space = 0;
 
         pa_assert(c->input_memblockq);
 
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index d961dba..0215c23 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -628,7 +628,6 @@ static record_stream* record_stream_new(
 
     record_stream *s;
     pa_source_output *source_output = NULL;
-    size_t base;
     pa_source_output_new_data data;
 
     pa_assert(c);
@@ -682,7 +681,7 @@ static record_stream* record_stream_new(
             0,
             s->buffer_attr.maxlength,
             0,
-            base = pa_frame_size(&source_output->sample_spec),
+            pa_frame_size(&source_output->sample_spec),
             1,
             0,
             0,
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index d66db4b..a9f7389 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -154,7 +154,7 @@ static int do_read(connection *c) {
     ssize_t r;
     size_t l;
     void *p;
-    size_t space;
+    size_t space = 0;
 
     connection_assert_ref(c);
 
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index adda2af..5f79ab1 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1152,7 +1152,6 @@ pa_bool_t pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest) {
 /* Called from main context */
 int pa_sink_input_start_move(pa_sink_input *i) {
     pa_source_output *o, *p = NULL;
-    pa_sink *origin;
     int r;
 
     pa_sink_input_assert_ref(i);
@@ -1166,8 +1165,6 @@ int pa_sink_input_start_move(pa_sink_input *i) {
     if ((r = pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_START], i)) < 0)
         return r;
 
-    origin = i->sink;
-
     /* Kill directly connected outputs */
     while ((o = pa_idxset_first(i->direct_outputs, NULL))) {
         pa_assert(o != p);
diff --git a/src/pulsecore/socket-client.c b/src/pulsecore/socket-client.c
index 2453515..c9cfdbe 100644
--- a/src/pulsecore/socket-client.c
+++ b/src/pulsecore/socket-client.c
@@ -202,8 +202,6 @@ static void connect_io_cb(pa_mainloop_api*m, pa_io_event *e, int fd, pa_io_event
 }
 
 static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t len) {
-    int r;
-
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(sa);
@@ -211,7 +209,7 @@ static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t
 
     pa_make_fd_nonblock(c->fd);
 
-    if ((r = connect(c->fd, sa, len)) < 0) {
+    if (connect(c->fd, sa, len) < 0) {
 #ifdef OS_IS_WIN32
         if (WSAGetLastError() != EWOULDBLOCK) {
             pa_log_debug("connect(): %d", WSAGetLastError());
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 0a369bc..d6c04db 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -406,7 +406,6 @@ static void context_state_callback(pa_context *c, void *userdata) {
             break;
 
         case PA_CONTEXT_READY: {
-            int r;
             pa_buffer_attr buffer_attr;
 
             pa_assert(c);
@@ -443,13 +442,13 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
             if (mode == PLAYBACK) {
                 pa_cvolume cv;
-                if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL)) < 0) {
+                if (pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL) < 0) {
                     pa_log(_("pa_stream_connect_playback() failed: %s"), pa_strerror(pa_context_errno(c)));
                     goto fail;
                 }
 
             } else {
-                if ((r = pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags)) < 0) {
+                if (pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags) < 0) {
                     pa_log(_("pa_stream_connect_record() failed: %s"), pa_strerror(pa_context_errno(c)));
                     goto fail;
                 }

commit 382eced35de93cba8098610f3990c16ae35b6ea0
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:47:23 2009 +0200

    alsa-sink: init after_avail earlier (llvm-clang-analyzer)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 63a3e90..883b32a 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -656,6 +656,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
         snd_pcm_sframes_t n;
         size_t n_bytes;
         int r;
+        pa_bool_t after_avail = TRUE;
 
         if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
 
@@ -710,7 +711,6 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
         for (;;) {
             snd_pcm_sframes_t frames;
             void *p;
-            pa_bool_t after_avail = TRUE;
 
 /*         pa_log_debug("%lu frames to write", (unsigned long) frames); */
 

commit 1380f18e52db48f61fd8582c59e52281728f22b7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:48:12 2009 +0200

    blueooth: actually honour 'room' variable (llvm-clang-analyzer)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index b8a8804..4592fca 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -221,9 +221,7 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *msg, size_t r
     pa_assert(u);
     pa_assert(u->service_fd >= 0);
     pa_assert(msg);
-
-    if (room <= 0)
-        room = BT_SUGGESTED_BUFFER_SIZE;
+    pa_assert(room >= sizeof(*msg));
 
     pa_log_debug("Trying to receive message from audio service...");
 
@@ -236,6 +234,11 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *msg, size_t r
         return -1;
     }
 
+    if (msg->length > room) {
+        pa_log_error("Not enough room.");
+        return -1;
+    }
+
     /* Secondly, read the payload */
     if (msg->length > sizeof(*msg)) {
 

commit 157ec797dd53e1fb3d14f44c991064b0a2dee8e2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:48:47 2009 +0200

    hal: check properly for failure of libhal_find_device_by_capability() (llvm-clang-analyzer)

diff --git a/src/modules/hal-util.c b/src/modules/hal-util.c
index e2a2d8d..2d59f51 100644
--- a/src/modules/hal-util.c
+++ b/src/modules/hal-util.c
@@ -65,7 +65,7 @@ int pa_hal_get_info(pa_core *core, pa_proplist *p, int card) {
         goto finish;
     }
 
-    if (!(udis = libhal_find_device_by_capability(hal, "sound", &n, &error)) < 0) {
+    if (!(udis = libhal_find_device_by_capability(hal, "sound", &n, &error))) {
         pa_log_error("Couldn't find devices: %s: %s", error.name, error.message);
         goto finish;
     }

commit f3be47f1e03b5970281527d95c7ee26de2fc6dde
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:49:10 2009 +0200

    rtsp: document that rtsp_exec() needs fixing (llvm-clang-analyzer)

diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index ba657f7..915c107 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -456,6 +456,8 @@ static int rtsp_exec(pa_rtsp_client* c, const char* cmd,
     l = pa_iochannel_write(c->io, hdrs, strlen(hdrs));
     pa_xfree(hdrs);
 
+    /* FIXME: this is broken, not necessarily all bytes are written */
+
     return 0;
 }
 

commit 05506d7dc228f83d3ad0fccc831c493aec7f62be
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:49:42 2009 +0200

    utf8: minor simplification

diff --git a/src/pulse/utf8.c b/src/pulse/utf8.c
index 9dddf4a..fe7bcd2 100644
--- a/src/pulse/utf8.c
+++ b/src/pulse/utf8.c
@@ -148,12 +148,9 @@ ONE_REMAINING:
 
             if (o) {
                 memcpy(o, last, (size_t) size);
-                o += size - 1;
+                o += size;
             }
 
-            if (o)
-                o++;
-
             continue;
 
 error:

commit 5fd751fc2ee44db50c26adc6d1881508c1ab04f5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:50:14 2009 +0200

    cli-command: modernizations

diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 143db3b..3941cc8 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1549,7 +1549,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
     pa_sink *sink;
     pa_source *source;
     pa_card *card;
-    int nl;
+    pa_bool_t nl;
     uint32_t idx;
     char txt[256];
     time_t now;
@@ -1567,7 +1567,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
     pa_strbuf_printf(buf, "### Configuration dump generated at %s\n", ctime(&now));
 #endif
 
-    for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) {
+    PA_IDXSET_FOREACH(m, c->modules, idx) {
 
         pa_strbuf_printf(buf, "load-module %s", m->name);
 
@@ -1577,13 +1577,12 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
         pa_strbuf_puts(buf, "\n");
     }
 
-    nl = 0;
-
-    for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
+    nl = FALSE;
+    PA_IDXSET_FOREACH(sink, c->sinks, idx) {
 
         if (!nl) {
             pa_strbuf_puts(buf, "\n");
-            nl = 1;
+            nl = TRUE;
         }
 
         pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, FALSE)));
@@ -1591,11 +1590,12 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
         pa_strbuf_printf(buf, "suspend-sink %s %s\n", sink->name, pa_yes_no(pa_sink_get_state(sink) == PA_SINK_SUSPENDED));
     }
 
-    for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
+    nl = FALSE;
+    PA_IDXSET_FOREACH(source, c->sources, idx) {
 
         if (!nl) {
             pa_strbuf_puts(buf, "\n");
-            nl = 1;
+            nl = TRUE;
         }
 
         pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, FALSE)));
@@ -1603,32 +1603,32 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
         pa_strbuf_printf(buf, "suspend-source %s %s\n", source->name, pa_yes_no(pa_source_get_state(source) == PA_SOURCE_SUSPENDED));
     }
 
-    for (card = pa_idxset_first(c->cards, &idx); card; card = pa_idxset_next(c->cards, &idx)) {
+    nl = FALSE;
+    PA_IDXSET_FOREACH(card, c->cards, idx) {
 
         if (!nl) {
             pa_strbuf_puts(buf, "\n");
-            nl = 1;
+            nl = TRUE;
         }
 
         if (card->active_profile)
             pa_strbuf_printf(buf, "set-card-profile %s %s\n", card->name, card->active_profile->name);
     }
 
-    nl = 0;
-
+    nl = FALSE;
     if ((sink = pa_namereg_get_default_sink(c))) {
         if (!nl) {
             pa_strbuf_puts(buf, "\n");
-            nl = 1;
+            nl = TRUE;
         }
+
         pa_strbuf_printf(buf, "set-default-sink %s\n", sink->name);
     }
 
     if ((source = pa_namereg_get_default_source(c))) {
-        if (!nl) {
+        if (!nl)
             pa_strbuf_puts(buf, "\n");
-            nl = 1;
-        }
+
         pa_strbuf_printf(buf, "set-default-source %s\n", source->name);
     }
 

commit 3c9a09bc45608eb333e67bd44c3b69049f4d4ed7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:51:00 2009 +0200

    cli-command: don't necessarily ovveride failure code of files (llvm-clang-analyzer)

diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 3941cc8..b57919a 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1813,8 +1813,6 @@ int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, pa_b
 
     ret = pa_cli_command_execute_file_stream(c, f, buf, fail);
 
-    ret = 0;
-
 fail:
     if (f)
         fclose(f);

commit 1516b7c047464e406ec983f10dcd3b854c4f3331
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:51:39 2009 +0200

    conf-parser: properly initialize variable we free() later (llvm-clang-analyzer)

diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
index b4ab23c..dd4a99e 100644
--- a/src/pulsecore/conf-parser.c
+++ b/src/pulsecore/conf-parser.c
@@ -113,7 +113,7 @@ static int parse_line(const char *filename, unsigned line, char **section, const
         return 0;
 
     if (pa_startswith(b, ".include ")) {
-        char *path, *fn;
+        char *path = NULL, *fn;
         int r;
 
         fn = strip(b+9);

commit 31ae7deefa72288b0c250b3ddc68c39e8eb840eb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:52:58 2009 +0200

    core-util: properly fill in exception array for pa_reset_sigs() (llvm-clang-analyzer)

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index d64c738..7a9f458 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2404,7 +2404,7 @@ int pa_reset_sigs(int except, ...) {
         p[i++] = except;
 
         while ((sig = va_arg(ap, int)) >= 0)
-            sig = p[i++];
+            p[i++] = sig;
     }
     p[i] = -1;
 

commit 31d1d9088e18b9d59a259230e0e49e6a5908586a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:53:28 2009 +0200

    protocol-native: log explicitly when someone asks us to quit

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 0215c23..17aee4b 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2273,6 +2273,8 @@ static void command_exit(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta
     ret = pa_core_exit(c->protocol->core, FALSE, 0);
     CHECK_VALIDITY(c->pstream, ret >= 0, tag, PA_ERR_ACCESS);
 
+    pa_log_debug("Client %s asks us to terminate.", pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY)));
+
     pa_pstream_send_simple_ack(c->pstream, tag); /* nonsense */
 }
 

commit 49bc6bcf084d143d490c83e0021c447dbf0a6be9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:53:56 2009 +0200

    stripnul: initialize 'found' bool properly (llvm-clang-analyzer)

diff --git a/src/tests/stripnul.c b/src/tests/stripnul.c
index 1d8c493..d677ad2 100644
--- a/src/tests/stripnul.c
+++ b/src/tests/stripnul.c
@@ -31,7 +31,7 @@
 int main(int argc, char *argv[]) {
     FILE *i, *o;
     size_t granularity;
-    pa_bool_t found;
+    pa_bool_t found = FALSE;
     uint8_t *zero;
 
     pa_assert_se(argc >= 2);

commit b51f5e58cc4ebbb5b4343c031ed9e37c352f81a6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:54:31 2009 +0200

    pacat: don't convert stream name twice (llvm-clang-analyzer)

diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index d6c04db..781bfa3 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -768,7 +768,6 @@ int main(int argc, char *argv[]) {
 
             case ARG_STREAM_NAME: {
                 char *t;
-                t = pa_locale_to_utf8(optarg);
 
                 if (!(t = pa_locale_to_utf8(optarg)) ||
                     pa_proplist_sets(proplist, PA_PROP_MEDIA_NAME, t) < 0) {

commit 7cc100d9e1d7093da44c8c83cbf61bb8c6000d9a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 8 23:54:53 2009 +0200

    padsp: properly return return values (llvm-clang-analyzer)

diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index 882522c..41bfd74 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -1821,7 +1821,7 @@ fail:
 
     pa_threaded_mainloop_unlock(i->mainloop);
 
-    return 0;
+    return r;
 }
 
 static int dsp_trigger(fd_info *i) {
@@ -1864,7 +1864,7 @@ fail:
 
     pa_threaded_mainloop_unlock(i->mainloop);
 
-    return 0;
+    return r;
 }
 
 static int dsp_cork(fd_info *i, pa_stream *s, int b) {
@@ -1902,7 +1902,7 @@ fail:
 
     pa_threaded_mainloop_unlock(i->mainloop);
 
-    return 0;
+    return r;
 }
 
 static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno) {

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list