[PATCH v4 15/41] bluetooth: Parse BlueZ 5 adapter properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2013-09-21 at 15:56 -0500, Jo?o Paulo Rechi Vita wrote:
> On Sat, Sep 21, 2013 at 7:51 AM, Tanu Kaskinen
> <tanu.kaskinen at linux.intel.com> wrote:
> > On Wed, 2013-09-18 at 16:17 -0500, jprvita at gmail.com wrote:
> >> +static int parse_adapter_properties(pa_bluetooth_adapter *a, DBusMessageIter *i, bool is_property_change) {
> >> +    DBusMessageIter element_i;
> >> +
> >> +    pa_assert(a);
> >> +
> >> +    dbus_message_iter_recurse(i, &element_i);
> >> +
> >> +    while (dbus_message_iter_get_arg_type(&element_i) == DBUS_TYPE_DICT_ENTRY) {
> >> +        DBusMessageIter dict_i, variant_i;
> >> +        const char *key;
> >> +
> >> +        dbus_message_iter_recurse(&element_i, &dict_i);
> >> +
> >> +        key = check_variant_property(&dict_i);
> >> +        if (key == NULL) {
> >> +            pa_log_error("Received invalid property for adapter %s", a->path);
> >> +            return -1;
> >> +        }
> >> +
> >> +        dbus_message_iter_recurse(&dict_i, &variant_i);
> >> +
> >> +        if (dbus_message_iter_get_arg_type(&variant_i) == DBUS_TYPE_STRING && pa_streq(key, "Address")) {
> >> +            char *value;
> >> +
> >> +            dbus_message_iter_get_basic(&variant_i, &value);
> >> +            a->address = pa_xstrdup(value);
> >> +        }
> >
> > Can the Address property change? If not, it should be checked if
> > is_property_change is true, and if it is, then complain loudly. If it
> > can change, then the old address should be freed before assigning the
> > new address.
> 
> The address property should not change, I'm adding those checks.

There should also be check that a->address is not already set (which it
can be, if the received properties contain duplicate Address entries).

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux