[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.19-600-gf564c7d

Colin Guthrie gitmailer-noreply at 0pointer.de
Sun Oct 31 13:45:23 PDT 2010


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  44e4709871178ea956c2e49686dd258131e459a2 (commit)

- Log -----------------------------------------------------------------
f564c7d core: make use of dbus_message_iter_append_fixed_array
e8a7d19 bluetooth: make use of dbus-util helper functions
-----------------------------------------------------------------------

Summary of changes:
 src/modules/bluetooth/bluetooth-util.c |   72 +++-----------------------------
 src/pulsecore/dbus-util.c              |    7 +---
 2 files changed, 7 insertions(+), 72 deletions(-)

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

commit e8a7d1932fb0b2acb080fdd7972caa7f8cb43c3d
Author: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
Date:   Wed Oct 20 13:50:40 2010 +0300

    bluetooth: make use of dbus-util helper functions

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index bce2766..5354520 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -598,67 +598,6 @@ finish:
     pa_dbus_pending_free(p);
 }
 
-static void append_variant(DBusMessageIter *iter, int type, const void *val)
-{
-    DBusMessageIter value;
-    char sig[2] = { type, '\0' };
-
-    dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, sig, &value);
-
-    dbus_message_iter_append_basic(&value, type, val);
-
-    dbus_message_iter_close_container(iter, &value);
-}
-
-static void append_array_variant(DBusMessageIter *iter, int type, const void *val, int n_elements)
-{
-    DBusMessageIter variant, array;
-    char type_sig[2] = { type, '\0' };
-    char array_sig[3] = { DBUS_TYPE_ARRAY, type, '\0' };
-
-    dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, array_sig, &variant);
-
-    dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY, type_sig, &array);
-
-    dbus_message_iter_append_fixed_array(&array, type, val, n_elements);
-
-    dbus_message_iter_close_container(&variant, &array);
-
-    dbus_message_iter_close_container(iter, &variant);
-}
-
-static void dict_append_entry(DBusMessageIter *dict, const char *key, int type, void *val)
-{
-    DBusMessageIter entry;
-
-    if (type == DBUS_TYPE_STRING) {
-        const char *str = *((const char **) val);
-        if (str == NULL)
-            return;
-    }
-
-    dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
-
-    dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
-
-    append_variant(&entry, type, val);
-
-    dbus_message_iter_close_container(dict, &entry);
-}
-
-static void dict_append_array(DBusMessageIter *dict, const char *key, int type, void *val, int n_elements)
-{
-    DBusMessageIter entry;
-
-    dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
-
-    dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
-
-    append_array_variant(&entry, type, val, n_elements);
-
-    dbus_message_iter_close_container(dict, &entry);
-}
-
 static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid)
 {
     DBusMessage *m;
@@ -677,13 +616,14 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const
                                     DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
                                     &d);
 
-    dict_append_entry(&d, "UUID", DBUS_TYPE_STRING, &uuid);
+    pa_dbus_append_basic_variant_dict_entry(&d, "UUID", DBUS_TYPE_STRING, &uuid);
 
-    dict_append_entry(&d, "Codec", DBUS_TYPE_BYTE, &codec);
+    pa_dbus_append_basic_variant_dict_entry(&d, "Codec", DBUS_TYPE_BYTE, &codec);
 
     if (pa_streq(uuid, HFP_AG_UUID)) {
-        uint8_t *caps = NULL;
-        dict_append_array(&d, "Capabilities", DBUS_TYPE_BYTE, &caps, 0);
+        uint8_t capability = 0;
+        uint8_t *caps = &capability;
+        pa_dbus_append_basic_array_variant_dict_entry(&d, "Capabilities", DBUS_TYPE_BYTE, &caps, 1);
     } else {
         sbc_capabilities_raw_t capabilities;
         uint8_t *caps = (uint8_t *) &capabilities;
@@ -699,7 +639,7 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const
         capabilities.min_bitpool = MIN_BITPOOL;
         capabilities.max_bitpool = MAX_BITPOOL;
 
-        dict_append_array(&d, "Capabilities", DBUS_TYPE_BYTE, &caps, sizeof(capabilities));
+        pa_dbus_append_basic_array_variant_dict_entry(&d, "Capabilities", DBUS_TYPE_BYTE, &caps, sizeof(capabilities));
     }
 
     dbus_message_iter_close_container(&i, &d);

commit f564c7d76371380980faa10ee3c756c3130c60bf
Author: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
Date:   Wed Oct 20 14:04:38 2010 +0300

    core: make use of dbus_message_iter_append_fixed_array
    
    dbus_message_iter_append_fixed_array does appends a block of fixed-length
    values to an array.

diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index 09ab071..8b20305 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -595,19 +595,14 @@ void pa_dbus_send_proplist_variant_reply(DBusConnection *c, DBusMessage *in_repl
 
 void pa_dbus_append_basic_array(DBusMessageIter *iter, int item_type, const void *array, unsigned n) {
     DBusMessageIter array_iter;
-    unsigned i;
-    unsigned item_size;
 
     pa_assert(iter);
     pa_assert(dbus_type_is_basic(item_type));
     pa_assert(array || n == 0);
 
-    item_size = basic_type_size(item_type);
-
     pa_assert_se(dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, signature_from_basic_type(item_type), &array_iter));
 
-    for (i = 0; i < n; ++i)
-        pa_assert_se(dbus_message_iter_append_basic(&array_iter, item_type, &((uint8_t*) array)[i * item_size]));
+    pa_assert_se(dbus_message_iter_append_fixed_array(&array_iter, item_type, array, n));
 
     pa_assert_se(dbus_message_iter_close_container(iter, &array_iter));
 };

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list