]> code.delx.au - pulseaudio/commitdiff
Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio
authorLennart Poettering <lennart@poettering.net>
Fri, 20 Feb 2009 02:21:46 +0000 (03:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 Feb 2009 02:21:46 +0000 (03:21 +0100)
32 files changed:
configure.ac
src/daemon/daemon-conf.c
src/daemon/main.c
src/modules/alsa/alsa-util.c
src/modules/bluetooth/module-bluetooth-device.c
src/modules/bluetooth/sbc.c
src/modules/bluetooth/sbc.h
src/modules/bluetooth/sbc_primitives.c
src/modules/bluetooth/sbc_primitives.h
src/modules/bluetooth/sbc_primitives_mmx.c
src/modules/bluetooth/sbc_primitives_neon.c
src/modules/dbus-util.c
src/modules/module-card-restore.c
src/modules/module-hal-detect.c
src/modules/module-stream-restore.c
src/modules/rtp/module-rtp-recv.c
src/modules/rtp/sdp.c
src/pulse/context.c
src/pulsecore/cli-command.c
src/pulsecore/core-util.c
src/pulsecore/hashmap.c
src/pulsecore/log.c
src/pulsecore/protocol-esound.c
src/pulsecore/protocol-native.c
src/tests/interpol-test.c
src/tests/ipacl-test.c
src/tests/sync-playback.c
src/tests/thread-mainloop-test.c
src/utils/pacat.c
src/utils/pactl.c
src/utils/padsp.c
src/utils/paplay.c

index ddf7a1cc7c044011b44ce6b3fe6d3e0765903ae6..11b091bb49f9924494af504726df423a6ac9362a 100644 (file)
@@ -1220,6 +1220,12 @@ AC_SUBST(PA_SYSTEM_STATE_PATH)
 #            Output               #
 ###################################
 
+AC_ARG_ENABLE([legacy-runtime-dir],
+        AS_HELP_STRING([--disable-legacy-runtime-dir], [Try to connect on legacy (< 0.9.12) socket paths.]))
+if test "x$enable_legacy_runtime_dir" != "xno" ; then
+        AC_DEFINE(ENABLE_LEGACY_RUNTIME_DIR, [1], [Legacy runtime dir])
+fi
+
 AC_ARG_ENABLE(
         [static-bins],
         AS_HELP_STRING([--enable-static-bins],[Statically link executables.]),
index 7d3b89f0160478de6e831933dac4f6b8afb5eee0..7dfef27fc7f9e301fa7edb6b7e5ae758f87b3acc 100644 (file)
@@ -639,7 +639,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     if (c->config_file)
         pa_strbuf_printf(s, _("### Read from configuration file: %s ###\n"), c->config_file);
 
-    pa_assert(c->log_level <= PA_LOG_LEVEL_MAX);
+    pa_assert(c->log_level < PA_LOG_LEVEL_MAX);
 
     pa_strbuf_printf(s, "daemonize = %s\n", pa_yes_no(c->daemonize));
     pa_strbuf_printf(s, "fail = %s\n", pa_yes_no(c->fail));
index d3e02fa0d9baa8c346a0317e29b407620850aea8..5f94ec66501b3e80ace50e9f9eca000b718ab6b9 100644 (file)
@@ -348,7 +348,6 @@ int main(int argc, char *argv[]) {
     pa_time_event *win32_timer;
     struct timeval win32_tv;
 #endif
-    char *lf = NULL;
     int autospawn_fd = -1;
     pa_bool_t autospawn_locked = FALSE;
 
@@ -1000,9 +999,6 @@ finish:
         pa_autospawn_lock_done(FALSE);
     }
 
-    if (lf)
-        pa_xfree(lf);
-
 #ifdef OS_IS_WIN32
     if (win32_timer)
         pa_mainloop_get_api(mainloop)->time_free(win32_timer);
index 8607e469af860370614e6122d50d7ebb249d00bd..d00a80f157412ab34a504c69da33e7e2e359b1b5 100644 (file)
@@ -1,7 +1,7 @@
 /***
   This file is part of PulseAudio.
 
-  Copyright 2004-2006 Lennart Poettering
+  Copyright 2004-2009 Lennart Poettering
   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
 
   PulseAudio is free software; you can redistribute it and/or modify
@@ -114,7 +114,7 @@ static void io_cb(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t
 static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) {
     struct pa_alsa_fdlist *fdl = userdata;
     unsigned num_fds, i;
-    int err;
+    int err, n;
     struct pollfd *temp;
 
     pa_assert(a);
@@ -123,7 +123,11 @@ static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) {
 
     a->defer_enable(fdl->defer, 0);
 
-    num_fds = (unsigned) snd_mixer_poll_descriptors_count(fdl->mixer);
+    if ((n = snd_mixer_poll_descriptors_count(fdl->mixer)) < 0) {
+        pa_log("snd_mixer_poll_descriptors_count() failed: %s", snd_strerror(n));
+        return;
+    }
+    num_fds = (unsigned) n;
 
     if (num_fds != fdl->num_fds) {
         if (fdl->fds)
@@ -1405,7 +1409,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
 
     snd_pcm_class_t class;
     snd_pcm_subclass_t subclass;
-    const char *n, *id, *sdn, *cn;
+    const char *n, *id, *sdn, *cn = NULL;
     int card;
 
     pa_assert(p);
index 27f9e7c27dc184697113556e05508c69eda3f403..ac8344f0450d4bd37b957a2d517bb2a6aae11ebe 100644 (file)
@@ -906,6 +906,11 @@ static int a2dp_process_render(struct userdata *u) {
                              (void*) p, u->write_memchunk.length,
                              d, left,
                              &written);
+
+        PA_ONCE_BEGIN {
+            pa_log_debug("Using SBC encoder implementation: %s", pa_strnull(sbc_get_implementation_info(&a2dp->sbc)));
+        } PA_ONCE_END;
+
         pa_memblock_release(u->write_memchunk.memblock);
 
         if (encoded <= 0) {
@@ -1351,9 +1356,6 @@ static int add_sink(struct userdata *u) {
 
         u->sink->userdata = u;
         u->sink->parent.process_msg = sink_process_msg;
-
-        pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
-        pa_sink_set_rtpoll(u->sink, u->rtpoll);
     }
 
 /*     u->sink->get_volume = sink_get_volume_cb; */
@@ -1398,9 +1400,6 @@ static int add_source(struct userdata *u) {
 
         u->source->userdata = u;
         u->source->parent.process_msg = source_process_msg;
-
-        pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
-        pa_source_set_rtpoll(u->source, u->rtpoll);
     }
 
 /*     u->source->get_volume = source_get_volume_cb; */
@@ -1525,9 +1524,9 @@ static void stop_thread(struct userdata *u) {
         u->source = NULL;
     }
 
-    pa_thread_mq_done(&u->thread_mq);
-
     if (u->rtpoll) {
+        pa_thread_mq_done(&u->thread_mq);
+
         pa_rtpoll_free(u->rtpoll);
         u->rtpoll = NULL;
     }
@@ -1561,11 +1560,17 @@ static int start_thread(struct userdata *u) {
         return -1;
     }
 
-    if (u->sink)
+    if (u->sink) {
+        pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
+        pa_sink_set_rtpoll(u->sink, u->rtpoll);
         pa_sink_put(u->sink);
+    }
 
-    if (u->source)
+    if (u->source) {
+        pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
+        pa_source_set_rtpoll(u->source, u->rtpoll);
         pa_source_put(u->source);
+    }
 
     return 0;
 }
index 29258d053e45b0bb2f4a271b19572d384a7db30f..a33ed571daf374ada51bb31ba170895462576a13 100644 (file)
@@ -985,7 +985,7 @@ int sbc_decode(sbc_t *sbc, void *input, int input_len, void *output,
        char *ptr;
        int i, ch, framelen, samples;
 
-       if (!sbc && !input)
+       if (!sbc || !input)
                return -EIO;
 
        priv = sbc->priv;
@@ -1053,7 +1053,7 @@ int sbc_encode(sbc_t *sbc, void *input, int input_len, void *output,
                        const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE],
                        int nsamples, int nchannels);
 
-       if (!sbc && !input)
+       if (!sbc || !input)
                return -EIO;
 
        priv = sbc->priv;
@@ -1221,6 +1221,20 @@ uint16_t sbc_get_codesize(sbc_t *sbc)
        return subbands * blocks * channels * 2;
 }
 
+const char *sbc_get_implementation_info(sbc_t *sbc)
+{
+       struct sbc_priv *priv;
+
+       if (!sbc)
+               return NULL;
+
+       priv = sbc->priv;
+       if (!priv)
+               return NULL;
+
+       return priv->enc_state.implementation_info;
+}
+
 int sbc_reinit(sbc_t *sbc, unsigned long flags)
 {
        struct sbc_priv *priv;
index b0a14888fb8692a7202a20ff57a0d8be5ca9177e..f9d506bc77e2c4e50dad15672d32f1c540b7e0e8 100644 (file)
@@ -89,6 +89,7 @@ int sbc_encode(sbc_t *sbc, void *input, int input_len, void *output,
 int sbc_get_frame_length(sbc_t *sbc);
 int sbc_get_frame_duration(sbc_t *sbc);
 uint16_t sbc_get_codesize(sbc_t *sbc);
+const char *sbc_get_implementation_info(sbc_t *sbc);
 void sbc_finish(sbc_t *sbc);
 
 #ifdef __cplusplus
index 303f3feea06a72af140e8482312673a24744bc11..6b0be3f5b38714eec907448a6cff34e5e328702f 100644 (file)
@@ -456,6 +456,7 @@ void sbc_init_primitives(struct sbc_encoder_state *state)
 
        /* Default implementation for scale factors calculation */
        state->sbc_calc_scalefactors = sbc_calc_scalefactors;
+       state->implementation_info = "Generic C";
 
        /* X86/AMD64 optimizations */
 #ifdef SBC_BUILD_WITH_MMX_SUPPORT
index 2708c829f0853efe417dd6256b76465fa7abe41c..3d01c115400eee647a6b72c1b8ee82485f84434a 100644 (file)
@@ -62,6 +62,7 @@ struct sbc_encoder_state {
        void (*sbc_calc_scalefactors)(int32_t sb_sample_f[16][2][8],
                        uint32_t scale_factor[2][8],
                        int blocks, int channels, int subbands);
+       const char *implementation_info;
 };
 
 /*
index 1870a9baf27f834c617c15a6da3df14461c0e6c5..08e9ca286cddb61dbcf95b572de9c9c87e230d93 100644 (file)
@@ -313,6 +313,7 @@ void sbc_init_primitives_mmx(struct sbc_encoder_state *state)
        if (check_mmx_support()) {
                state->sbc_analyze_4b_4s = sbc_analyze_4b_4s_mmx;
                state->sbc_analyze_4b_8s = sbc_analyze_4b_8s_mmx;
+               state->implementation_info = "MMX";
        }
 }
 
index d9c12f9e3f04428410aae7d41e640042e15dc369..f1bc7b488fa24f4801c9db299f3a32d12196440c 100644 (file)
@@ -240,6 +240,7 @@ void sbc_init_primitives_neon(struct sbc_encoder_state *state)
 {
        state->sbc_analyze_4b_4s = sbc_analyze_4b_4s_neon;
        state->sbc_analyze_4b_8s = sbc_analyze_4b_8s_neon;
+       state->implementation_info = "NEON";
 }
 
 #endif
index f6a986a572d72504b1f4b777486d50cc09238fad..4218bca5662e98c502ad6365d6747fed28ab249a 100644 (file)
@@ -403,8 +403,7 @@ void pa_dbus_pending_free(pa_dbus_pending *p) {
     pa_assert(p);
 
     if (p->pending) {
-        dbus_pending_call_cancel(p->pending);
-        dbus_pending_call_unref(p->pending);
+        dbus_pending_call_cancel(p->pending); /* p->pending is freed by cancel() */
     }
 
     if (p->message)
index 909c0957ed7ceefcca86bb37782bd1f69e2611ca..c7696058b05194eb8ccf99b78451e945ad5b771e 100644 (file)
@@ -191,7 +191,7 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new
 
     pa_assert(new_data);
 
-    if ((e = read_entry(u, new_data->name)) && e->profile) {
+    if ((e = read_entry(u, new_data->name)) && e->profile[0]) {
 
         if (!new_data->active_profile) {
             pa_card_new_data_set_profile(new_data, e->profile);
index e603738101bf6e298fa534e936d886ce37153aa2..ce04f3670668cb3a017fa99e75d18a9f2c5dce28 100644 (file)
@@ -370,6 +370,7 @@ static struct device* hal_device_add(struct userdata *u, const char *udi) {
     d->originating_udi = NULL;
     d->module = PA_INVALID_INDEX;
     d->sink_name = d->source_name = d->card_name = NULL;
+    r = -1;
 
 #ifdef HAVE_ALSA
     if (pa_streq(u->capability, CAPABILITY_ALSA))
index 434dc7a06293679ae546f4ef10bd9d2ec0b252cf..d935caf6dc43a7824fd31c00f6830e82387272c6 100644 (file)
@@ -532,6 +532,7 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
             pa_xfree(n);
             continue;
         }
+       pa_xfree(n);
 
         if (u->restore_volume) {
             pa_cvolume v;
@@ -581,6 +582,7 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
             pa_xfree(n);
             continue;
         }
+       pa_xfree(n);
 
         if (u->restore_device &&
             e->device_valid &&
index 063ba7254ad8f1a34562e6d7b5ea1792e5f63d99..0d86459e99600dd42050c28d169059c6d1bc2e0d 100644 (file)
@@ -562,7 +562,7 @@ static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
     } else {
 
         if (!(s = pa_hashmap_get(u->by_origin, info.origin))) {
-            if (!(s = session_new(u, &info)))
+            if (!session_new(u, &info))
                 pa_sdp_info_destroy(&info);
 
         } else {
index 643361f23d69e09cfd092a4d510196cb2a35e448..7c5474304ade74247ec3752ea4e761c2bae6fce1 100644 (file)
@@ -44,7 +44,7 @@
 char *pa_sdp_build(int af, const void *src, const void *dst, const char *name, uint16_t port, uint8_t payload, const pa_sample_spec *ss) {
     uint32_t ntp;
     char buf_src[64], buf_dst[64], un[64];
-    const char *u, *f, *a;
+    const char *u, *f;
 
     pa_assert(src);
     pa_assert(dst);
@@ -62,8 +62,8 @@ char *pa_sdp_build(int af, const void *src, const void *dst, const char *name, u
 
     ntp = (uint32_t) time(NULL) + 2208988800U;
 
-    pa_assert_se(a = inet_ntop(af, src, buf_src, sizeof(buf_src)));
-    pa_assert_se(a = inet_ntop(af, dst, buf_dst, sizeof(buf_dst)));
+    pa_assert_se(inet_ntop(af, src, buf_src, sizeof(buf_src)));
+    pa_assert_se(inet_ntop(af, dst, buf_dst, sizeof(buf_dst)));
 
     return pa_sprintf_malloc(
             PA_SDP_HEADER
index d8d0a51da40bd9872b8cd861e66c58c71ba3b293..9309c6b71ae514508ad5394fb2ba11cd7f9c9d37 100644 (file)
@@ -554,6 +554,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) {
     pa_context_unref(c);
 }
 
+#if ENABLE_LEGACY_RUNTIME_DIR
 static char *get_old_legacy_runtime_dir(void) {
     char *p, u[128];
     struct stat st;
@@ -597,10 +598,12 @@ static char *get_very_old_legacy_runtime_dir(void) {
 
     return p;
 }
-
+#endif
 
 static pa_strlist *prepend_per_user(pa_strlist *l) {
     char *ufn;
+
+#if ENABLE_LEGACY_RUNTIME_DIR
     static char *legacy_dir;
 
     /* The very old per-user instance path (< 0.9.11). This is supported only to ease upgrades */
@@ -618,6 +621,7 @@ static pa_strlist *prepend_per_user(pa_strlist *l) {
         pa_xfree(p);
         pa_xfree(legacy_dir);
     }
+#endif
 
     /* The per-user instance */
     if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) {
index 1df0bd63b9e3d0a68a6ded74e9ba613f1804f313..5e45c1aa041fce3afc5a3bbc5a748e1defdcef07 100644 (file)
@@ -401,7 +401,6 @@ static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
 }
 
 static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
-    pa_module *m;
     const char *name;
 
     pa_core_assert_ref(c);
@@ -414,7 +413,7 @@ static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
         return -1;
     }
 
-    if (!(m = pa_module_load(c, name,  pa_tokenizer_get(t, 2)))) {
+    if (!pa_module_load(c, name,  pa_tokenizer_get(t, 2))) {
         pa_strbuf_puts(buf, "Module load failed.\n");
         return -1;
     }
index 61f9a656bad5c12334dcf15ee56cb868e548186a..a184bebd544dbd254a65006dfcb5540cd0e83e3a 100644 (file)
@@ -1411,6 +1411,7 @@ static int make_random_dir_and_link(mode_t m, const char *k) {
         return -1;
     }
 
+    pa_xfree(p);
     return 0;
 }
 
@@ -1443,6 +1444,7 @@ char *pa_get_runtime_dir(void) {
 
     if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1) < 0)  {
         pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno));
+        pa_xfree(d);
         goto fail;
     }
 
@@ -2459,7 +2461,7 @@ char *pa_machine_id(void) {
 
         pa_strip_nl(ln);
 
-        if (ln[0])
+        if (r && ln[0])
             return pa_xstrdup(ln);
     }
 
index 3c6f41ec974e3b5b0825f7420cfb2ada0806bd67..57607b69e251c65772e31dc52287dc7682157b0d 100644 (file)
@@ -138,7 +138,7 @@ int pa_hashmap_put(pa_hashmap *h, const void *key, void *value) {
 
     hash = h->hash_func(key) % NBUCKETS;
 
-    if ((e = hash_scan(h, hash, key)))
+    if (hash_scan(h, hash, key))
         return -1;
 
     if (!(e = pa_flist_pop(PA_STATIC_FLIST_GET(entries))))
index 1ae4383967500b614a14b8276a15e8b8d2abbab9..89b75da3046971bec1a1cafd26790c1e2f2f61f5 100644 (file)
@@ -351,6 +351,7 @@ void pa_log_levelv_meta(
     }
 
     errno = saved_errno;
+    pa_xfree(bt);
 }
 
 void pa_log_level_meta(
index e1643cbbf6d4296692b252a0d860593aaaa75b3d..840f4581118cd259b977f08fd191e615d960b157 100644 (file)
@@ -924,7 +924,7 @@ static int do_read(connection *c) {
 
             c->request = PA_MAYBE_INT32_SWAP(c->swap_byte_order, c->request);
 
-            if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) {
+            if (c->request < ESD_PROTO_CONNECT || c->request >= ESD_PROTO_MAX) {
                 pa_log("recieved invalid request.");
                 return -1;
             }
index 79b9b069eb06a592df32a7d3efa2c011b651d534..a963f78ad0e944e462dfc9d9842c6afc15347a98 100644 (file)
@@ -2560,7 +2560,10 @@ static void command_create_upload_stream(pa_pdispatch *pd, uint32_t command, uin
         if (!(name = pa_proplist_gets(p, PA_PROP_EVENT_ID)))
             name = pa_proplist_gets(p, PA_PROP_MEDIA_NAME);
 
-    CHECK_VALIDITY(c->pstream, name && pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
+    if (!name || !pa_namereg_is_valid_name(name)) {
+        pa_proplist_free(p);
+        CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_INVALID);
+    }
 
     s = upload_stream_new(c, &ss, &map, name, length, p);
     pa_proplist_free(p);
@@ -3011,7 +3014,7 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
         source_fill_tagstruct(c, reply, source);
     else if (client)
         client_fill_tagstruct(c, reply, client);
-    else if (client)
+    else if (card)
         card_fill_tagstruct(c, reply, card);
     else if (module)
         module_fill_tagstruct(c, reply, module);
@@ -3590,24 +3593,30 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t
         }
     }
 
-    CHECK_VALIDITY(c->pstream, mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE, tag, PA_ERR_INVALID);
+    if (!(mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE)) {
+        pa_proplist_free(p);
+        CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_INVALID);
+    }
 
     if (command == PA_COMMAND_UPDATE_PLAYBACK_STREAM_PROPLIST) {
         playback_stream *s;
 
         s = pa_idxset_get_by_index(c->output_streams, idx);
-        CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
-        CHECK_VALIDITY(c->pstream, playback_stream_isinstance(s), tag, PA_ERR_NOENTITY);
-
+        if (!s || !playback_stream_isinstance(s)) {
+            pa_proplist_free(p);
+            CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_NOENTITY);
+        }
         pa_sink_input_update_proplist(s->sink_input, mode, p);
 
     } else if (command == PA_COMMAND_UPDATE_RECORD_STREAM_PROPLIST) {
         record_stream *s;
 
-        s = pa_idxset_get_by_index(c->record_streams, idx);
-        CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
-
+        if (!(s = pa_idxset_get_by_index(c->record_streams, idx))) {
+            pa_proplist_free(p);
+            CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_NOENTITY);
+        }
         pa_source_output_update_proplist(s->source_output, mode, p);
+
     } else {
         pa_assert(command == PA_COMMAND_UPDATE_CLIENT_PROPLIST);
 
@@ -3615,6 +3624,7 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t
     }
 
     pa_pstream_send_simple_ack(c->pstream, tag);
+    pa_proplist_free(p);
 }
 
 static void command_remove_proplist(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -4070,7 +4080,7 @@ static void command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag,
     CHECK_VALIDITY(c->pstream, m->load_once || idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID);
 
     cb = (pa_native_protocol_ext_cb_t) (unsigned long) pa_hashmap_get(c->protocol->extensions, m);
-    CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOEXTENSION);
+    CHECK_VALIDITY(c->pstream, cb, tag, PA_ERR_NOEXTENSION);
 
     if (cb(c->protocol, m, c, tag, t) < 0)
         protocol_error(c);
index 20d2c230dbad729857112237b70e499f42b25214..d7da660c8f48386b2718df955f588fa71e5059d4 100644 (file)
@@ -126,7 +126,8 @@ int main(int argc, char *argv[]) {
 
     pa_gettimeofday(&start);
 
-    pa_threaded_mainloop_start(m);
+    r = pa_threaded_mainloop_start(m);
+    assert(r >= 0);
 
     for (k = 0; k < 5000; k++) {
         pa_bool_t success = FALSE, changed = FALSE;
index 7b7564a435f57f3038fd2f34632f2ce1fb995089..f89665cd2bf02046b1ea9c3046f9ce89cf9e4685 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include "../pulsecore/winsock.h"
+#include "../pulsecore/macro.h"
 
 #include <pulsecore/ipacl.h>
 
@@ -96,7 +97,7 @@ int main(int argc, char *argv[]) {
     memset(&sa6, 0, sizeof(sa6));
     sa6.sin6_family = AF_INET6;
     sa6.sin6_port = htons(22);
-    inet_pton(AF_INET6, "::1", &sa6.sin6_addr);
+    pa_assert_se(inet_pton(AF_INET6, "::1", &sa6.sin6_addr) == 1);
 
     r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
     assert(r >= 0);
index 42c479a12cb8a4dccaaf49a012e519c7b59764e5..f2a15601be0c7f92cf7a5c84a3de0dbd0e0dff42 100644 (file)
@@ -174,11 +174,16 @@ int main(int argc, char *argv[]) {
 
     pa_context_set_state_callback(context, context_state_callback, NULL);
 
-    pa_context_connect(context, NULL, 0, NULL);
+    /* Connect the context */
+    if (pa_context_connect(context, NULL, 0, NULL) < 0) {
+        fprintf(stderr, "pa_context_connect() failed.\n");
+        goto quit;
+    }
 
     if (pa_mainloop_run(m, &ret) < 0)
         fprintf(stderr, "pa_mainloop_run() failed.\n");
 
+quit:
     pa_context_unref(context);
 
     for (i = 0; i < NSTREAMS; i++)
index 263cd57d48f14bee048b935016035743212d7974..3bcf4f16fa31924e54b410067e308e3293951a9e 100644 (file)
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
     pa_assert_se(m = pa_threaded_mainloop_new());
     pa_assert_se(a = pa_threaded_mainloop_get_api(m));
 
-    pa_threaded_mainloop_start(m);
+    pa_assert_se(pa_threaded_mainloop_start(m) >= 0);
 
     pa_threaded_mainloop_lock(m);
 
index 10015ce44697f4a1e8672e1585069869e2f8a97a..2224da9a26544756be1e18252635a8690aaef585 100644 (file)
@@ -336,7 +336,6 @@ static void context_drain_complete(pa_context*c, void *userdata) {
 
 /* Stream draining complete */
 static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
-    pa_operation *o;
 
     if (!success) {
         fprintf(stderr, _("Failed to drain stream: %s\n"), pa_strerror(pa_context_errno(context)));
@@ -350,7 +349,7 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
     pa_stream_unref(stream);
     stream = NULL;
 
-    if (!(o = pa_context_drain(context, context_drain_complete, NULL)))
+    if (!pa_context_drain(context, context_drain_complete, NULL))
         pa_context_disconnect(context);
     else {
         if (verbose)
index 154e7f9c25f4e7a160e731645a8a4a378a174aeb..d3da90e636467a2e919ae780ed928195aa1bfaab 100644 (file)
@@ -649,6 +649,7 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
         pa_xfree(d);
         fprintf(stderr, _("Premature end of file\n"));
         quit(1);
+        return;
     }
 
     pa_stream_write(s, d, length, pa_xfree, 0, PA_SEEK_RELATIVE);
@@ -1029,7 +1030,10 @@ int main(int argc, char *argv[]) {
     }
 
     pa_context_set_state_callback(context, context_state_callback, NULL);
-    pa_context_connect(context, server, 0, NULL);
+    if (pa_context_connect(context, server, 0, NULL) < 0) {
+        fprintf(stderr, _("pa_context_connect() failed: %s"), pa_strerror(pa_context_errno(context)));
+        goto quit;
+    }
 
     if (pa_mainloop_run(m, &ret) < 0) {
         fprintf(stderr, _("pa_mainloop_run() failed.\n"));
index 046bae4505628fc4e42c29b779f0f4bf026f2fb4..76e86c8d1f7b4f5cad1f4a215d91812b8a225788 100644 (file)
@@ -1202,7 +1202,7 @@ fail:
 static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, void *userdata) {
     fd_info *i = userdata;
 
-    if (!si && eol < 0) {
+    if (!si || eol < 0) {
         i->operation_success = 0;
         pa_threaded_mainloop_signal(i->mainloop, 0);
         return;
@@ -1224,7 +1224,7 @@ static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, v
 static void source_info_cb(pa_context *context, const pa_source_info *si, int eol, void *userdata) {
     fd_info *i = userdata;
 
-    if (!si && eol < 0) {
+    if (!si || eol < 0) {
         i->operation_success = 0;
         pa_threaded_mainloop_signal(i->mainloop, 0);
         return;
index df2edf6227f1724f76560c9849229fc9aceee20a..dec80e5cd4062ecb771c86601d3c36b732d20f74 100644 (file)
@@ -400,7 +400,10 @@ int main(int argc, char *argv[]) {
     pa_context_set_state_callback(context, context_state_callback, NULL);
 
     /* Connect the context */
-    pa_context_connect(context, server, 0, NULL);
+    if (pa_context_connect(context, server, 0, NULL) < 0) {
+        fprintf(stderr, _("pa_context_connect() failed: %s"), pa_strerror(pa_context_errno(context)));
+        goto quit;
+    }
 
     /* Run the main loop */
     if (pa_mainloop_run(m, &ret) < 0) {