2012-10-17 15:14:28

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] gdbus: Remove connection from pending_property functions

The reply to a DBus.Properties.Set() method call should go through the
same D-Bus connection. Thus remove the DBusConnection parameter from the
following functions:

- g_dbus_pending_property_success()
- g_dbus_pending_property_error_valist()
- g_dbus_pending_property_error()
---
gdbus/gdbus.h | 13 +++++--------
gdbus/object.c | 24 ++++++++++++------------
2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 8251947..ba49621 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -246,14 +246,11 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
void g_dbus_remove_all_watches(DBusConnection *connection);

-void g_dbus_pending_property_success(DBusConnection *connection,
- GDBusPendingPropertySet id);
-void g_dbus_pending_property_error_valist(DBusConnection *connection,
- GDBusPendingReply id, const char *name,
- const char *format, va_list args);
-void g_dbus_pending_property_error(DBusConnection *connection,
- GDBusPendingReply id, const char *name,
- const char *format, ...);
+void g_dbus_pending_property_success(GDBusPendingPropertySet id);
+void g_dbus_pending_property_error_valist(GDBusPendingReply id,
+ const char *name, const char *format, va_list args);
+void g_dbus_pending_property_error(GDBusPendingReply id, const char *name,
+ const char *format, ...);
void g_dbus_emit_property_changed(DBusConnection *connection,
const char *path, const char *interface,
const char *name);
diff --git a/gdbus/object.c b/gdbus/object.c
index 4147361..ec98c2c 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -71,6 +71,7 @@ struct security_data {
};

struct property_data {
+ DBusConnection *conn;
GDBusPendingPropertySet id;
DBusMessage *message;
};
@@ -445,8 +446,7 @@ static struct property_data *remove_pending_property_data(
return propdata;
}

-void g_dbus_pending_property_success(DBusConnection *connection,
- GDBusPendingPropertySet id)
+void g_dbus_pending_property_success(GDBusPendingPropertySet id)
{
struct property_data *propdata;

@@ -454,14 +454,15 @@ void g_dbus_pending_property_success(DBusConnection *connection,
if (propdata == NULL)
return;

- g_dbus_send_reply(connection, propdata->message, DBUS_TYPE_INVALID);
+ g_dbus_send_reply(propdata->conn, propdata->message,
+ DBUS_TYPE_INVALID);
dbus_message_unref(propdata->message);
g_free(propdata);
}

-void g_dbus_pending_property_error_valist(DBusConnection *connection,
- GDBusPendingReply id, const char *name,
- const char *format, va_list args)
+void g_dbus_pending_property_error_valist(GDBusPendingReply id,
+ const char *name, const char *format,
+ va_list args)
{
struct property_data *propdata;
DBusMessage *reply;
@@ -473,7 +474,7 @@ void g_dbus_pending_property_error_valist(DBusConnection *connection,
reply = g_dbus_create_error_valist(propdata->message, name, format,
args);
if (reply != NULL) {
- dbus_connection_send(connection, reply, NULL);
+ dbus_connection_send(propdata->conn, reply, NULL);
dbus_message_unref(reply);
}

@@ -481,16 +482,14 @@ void g_dbus_pending_property_error_valist(DBusConnection *connection,
g_free(propdata);
}

-void g_dbus_pending_property_error(DBusConnection *connection,
- GDBusPendingReply id, const char *name,
- const char *format, ...)
+void g_dbus_pending_property_error(GDBusPendingReply id, const char *name,
+ const char *format, ...)
{
va_list args;

va_start(args, format);

- g_dbus_pending_property_error_valist(connection, id, name, format,
- args);
+ g_dbus_pending_property_error_valist(id, name, format, args);

va_end(args);
}
@@ -891,6 +890,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
propdata = g_new(struct property_data, 1);
propdata->id = next_pending_property++;
propdata->message = dbus_message_ref(message);
+ propdata->conn = connection;
pending_property_set = g_slist_prepend(pending_property_set, propdata);

property->set(property, &sub, propdata->id, iface->user_data);
--
1.7.12.3



2012-10-19 07:34:38

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] gdbus: Remove connection from pending_property functions

Hi Lucas,

On Wed, Oct 17, 2012, Lucas De Marchi wrote:
> The reply to a DBus.Properties.Set() method call should go through the
> same D-Bus connection. Thus remove the DBusConnection parameter from the
> following functions:
>
> - g_dbus_pending_property_success()
> - g_dbus_pending_property_error_valist()
> - g_dbus_pending_property_error()
> ---
> gdbus/gdbus.h | 13 +++++--------
> gdbus/object.c | 24 ++++++++++++------------
> 2 files changed, 17 insertions(+), 20 deletions(-)

Both patches have been applied. Thanks.

Johan

2012-10-17 18:33:49

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH BlueZ 2/2] core: Update gdbus function calls

On Wed, Oct 17, 2012 at 1:25 PM, Anderson Lizardo
<[email protected]> wrote:
> Hi again,
>
> On Wed, Oct 17, 2012 at 1:20 PM, Anderson Lizardo
> <[email protected]> wrote:
>> Hi Lucas,
>>
>> On Wed, Oct 17, 2012 at 12:14 PM, Lucas De Marchi
>> <[email protected]> wrote:
>>> @@ -827,24 +824,21 @@ static void set_name(struct btd_adapter *adapter, const char *name,
>>> int ret;
>>>
>>> if (adapter->allow_name_changes == FALSE)
>>> - return g_dbus_pending_property_error(btd_get_dbus_connection(),
>>> - id, ERROR_INTERFACE ".Failed",
>>> + return g_dbus_pending_property_error(id,
>>> + ERROR_INTERFACE ".Failed",
>>> strerror(EPERM));
>>>
>>> ret = adapter_set_name(adapter, name);
>>> - if (ret >= 0) {
>>> - g_dbus_pending_property_success(btd_get_dbus_connection(), id);
>>> - return;
>>> - }
>>> + if (ret >= 0)
>>> + return g_dbus_pending_property_success(id);
>>
>> Out of curiosity, is this style of returning "void" (instead of just
>> "return;") common in gdbus?
>
> Just realized that this is BlueZ specific code. Anyway, just found it
> odd (but answering my question, seems to be common).

It may be common because I used it a lot in the first conversions :-).
I don't know about other places using it. In gdbus-related code it's
very convenient because the function usually returns void as well, so
we can shortcut it with the g_dbus_pending_property_* calls.


Lucas De Marchi

2012-10-17 16:25:28

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ 2/2] core: Update gdbus function calls

Hi again,

On Wed, Oct 17, 2012 at 1:20 PM, Anderson Lizardo
<[email protected]> wrote:
> Hi Lucas,
>
> On Wed, Oct 17, 2012 at 12:14 PM, Lucas De Marchi
> <[email protected]> wrote:
>> @@ -827,24 +824,21 @@ static void set_name(struct btd_adapter *adapter, const char *name,
>> int ret;
>>
>> if (adapter->allow_name_changes == FALSE)
>> - return g_dbus_pending_property_error(btd_get_dbus_connection(),
>> - id, ERROR_INTERFACE ".Failed",
>> + return g_dbus_pending_property_error(id,
>> + ERROR_INTERFACE ".Failed",
>> strerror(EPERM));
>>
>> ret = adapter_set_name(adapter, name);
>> - if (ret >= 0) {
>> - g_dbus_pending_property_success(btd_get_dbus_connection(), id);
>> - return;
>> - }
>> + if (ret >= 0)
>> + return g_dbus_pending_property_success(id);
>
> Out of curiosity, is this style of returning "void" (instead of just
> "return;") common in gdbus?

Just realized that this is BlueZ specific code. Anyway, just found it
odd (but answering my question, seems to be common).

Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2012-10-17 16:20:29

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ 2/2] core: Update gdbus function calls

Hi Lucas,

On Wed, Oct 17, 2012 at 12:14 PM, Lucas De Marchi
<[email protected]> wrote:
> @@ -827,24 +824,21 @@ static void set_name(struct btd_adapter *adapter, const char *name,
> int ret;
>
> if (adapter->allow_name_changes == FALSE)
> - return g_dbus_pending_property_error(btd_get_dbus_connection(),
> - id, ERROR_INTERFACE ".Failed",
> + return g_dbus_pending_property_error(id,
> + ERROR_INTERFACE ".Failed",
> strerror(EPERM));
>
> ret = adapter_set_name(adapter, name);
> - if (ret >= 0) {
> - g_dbus_pending_property_success(btd_get_dbus_connection(), id);
> - return;
> - }
> + if (ret >= 0)
> + return g_dbus_pending_property_success(id);

Out of curiosity, is this style of returning "void" (instead of just
"return;") common in gdbus?

Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2012-10-17 15:14:29

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] core: Update gdbus function calls

Done by the following semantic patch, with manual tweaks afterwards due
to changes in 80-chars line breaks:

// <smpl>
@r1 @
expression E1;
@@
g_dbus_pending_property_success(
- E1,
...)

@r2 @
expression E1;
@@
g_dbus_pending_property_error(
- E1,
...)

@r3 @
expression E1;
@@
g_dbus_pending_property_error_valist(
- E1,
...)
// </smpl>
---
src/adapter.c | 91 +++++++++++++++++++++++++++--------------------------------
src/device.c | 72 ++++++++++++++++++----------------------------
2 files changed, 69 insertions(+), 94 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 7c2aec0..e5d4cf7 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -346,7 +346,6 @@ static void set_session_pending_mode(struct btd_adapter *adapter,
static void set_discoverable(struct btd_adapter *adapter,
gboolean discoverable, GDBusPendingPropertySet id)
{
- DBusConnection *conn = btd_get_dbus_connection();
uint8_t mode;
int err;

@@ -354,12 +353,12 @@ static void set_discoverable(struct btd_adapter *adapter,

if (mode == adapter->mode) {
adapter->global_mode = mode;
- return g_dbus_pending_property_success(conn, id);
+ return g_dbus_pending_property_success(id);
}

err = set_mode(adapter, mode);
if (err < 0)
- return g_dbus_pending_property_error(conn, id,
+ return g_dbus_pending_property_error(id,
ERROR_INTERFACE ".Failed",
strerror(-err));

@@ -371,7 +370,6 @@ static void set_discoverable(struct btd_adapter *adapter,
static void set_powered(struct btd_adapter *adapter, gboolean powered,
GDBusPendingPropertySet id)
{
- DBusConnection *conn = btd_get_dbus_connection();
uint8_t mode;
int err;

@@ -385,12 +383,12 @@ static void set_powered(struct btd_adapter *adapter, gboolean powered,

if (mode == adapter->mode) {
adapter->global_mode = mode;
- return g_dbus_pending_property_success(conn, id);
+ return g_dbus_pending_property_success(id);
}

err = set_mode(adapter, mode);
if (err < 0)
- return g_dbus_pending_property_error(conn, id,
+ return g_dbus_pending_property_error(id,
ERROR_INTERFACE ".Failed",
strerror(-err));

@@ -402,11 +400,10 @@ static void set_powered(struct btd_adapter *adapter, gboolean powered,
static void set_pairable(struct btd_adapter *adapter, gboolean pairable,
bool reply, GDBusPendingPropertySet id)
{
- DBusConnection *conn = btd_get_dbus_connection();
int err;

if (adapter->scan_mode == SCAN_DISABLED)
- return g_dbus_pending_property_error(conn, id,
+ return g_dbus_pending_property_error(id,
ERROR_INTERFACE ".NotReady",
"Resource Not Ready");

@@ -419,7 +416,7 @@ static void set_pairable(struct btd_adapter *adapter, gboolean pairable,
err = set_mode(adapter, MODE_DISCOVERABLE);
if (err < 0) {
if (reply)
- g_dbus_pending_property_error(conn, id,
+ g_dbus_pending_property_error(id,
ERROR_INTERFACE ".Failed",
strerror(-err));
return;
@@ -430,7 +427,7 @@ store:

done:
if (reply)
- g_dbus_pending_property_success(conn, id);
+ g_dbus_pending_property_success(id);
}

static gboolean pairable_timeout_handler(void *data)
@@ -716,7 +713,7 @@ static void set_discoverable_timeout(struct btd_adapter *adapter,
DBusConnection *conn = btd_get_dbus_connection();

if (adapter->discov_timeout == timeout && timeout == 0)
- return g_dbus_pending_property_success(conn, id);
+ return g_dbus_pending_property_success(id);

if (adapter->scan_mode & SCAN_INQUIRY)
mgmt_set_discoverable(adapter->dev_id, TRUE, timeout);
@@ -727,7 +724,7 @@ static void set_discoverable_timeout(struct btd_adapter *adapter,

g_dbus_emit_property_changed(conn, adapter->path, ADAPTER_INTERFACE,
"DiscoverableTimeout");
- g_dbus_pending_property_success(conn, id);
+ g_dbus_pending_property_success(id);
}

static void set_pairable_timeout(struct btd_adapter *adapter,
@@ -736,7 +733,7 @@ static void set_pairable_timeout(struct btd_adapter *adapter,
DBusConnection *conn = btd_get_dbus_connection();

if (adapter->pairable_timeout == timeout && timeout == 0)
- return g_dbus_pending_property_success(conn, id);
+ return g_dbus_pending_property_success(id);

if (adapter->pairable)
adapter_set_pairable_timeout(adapter, timeout);
@@ -747,7 +744,7 @@ static void set_pairable_timeout(struct btd_adapter *adapter,

g_dbus_emit_property_changed(conn, adapter->path, ADAPTER_INTERFACE,
"PairableTimeout");
- g_dbus_pending_property_success(conn, id);
+ g_dbus_pending_property_success(id);
}

void btd_adapter_class_changed(struct btd_adapter *adapter, uint8_t *new_class)
@@ -827,24 +824,21 @@ static void set_name(struct btd_adapter *adapter, const char *name,
int ret;

if (adapter->allow_name_changes == FALSE)
- return g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".Failed",
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".Failed",
strerror(EPERM));

ret = adapter_set_name(adapter, name);
- if (ret >= 0) {
- g_dbus_pending_property_success(btd_get_dbus_connection(), id);
- return;
- }
+ if (ret >= 0)
+ return g_dbus_pending_property_success(id);

if (ret == -EINVAL)
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
+ g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");
else
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".Failed",
- strerror(-ret));
+ g_dbus_pending_property_error(id, ERROR_INTERFACE ".Failed",
+ strerror(-ret));
}

struct btd_device *adapter_find_device(struct btd_adapter *adapter,
@@ -1173,12 +1167,10 @@ static void adapter_property_set_name(const GDBusPropertyTable *property,
{
const char *name;

- if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_STRING) {
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
- return;
- }
+ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_STRING)
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &name);

@@ -1217,9 +1209,9 @@ static void adapter_property_set_powered(
dbus_bool_t powered;

if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
- return g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &powered);

@@ -1247,9 +1239,9 @@ static void adapter_property_set_discoverable(
dbus_bool_t discoverable;

if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
- return g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &discoverable);

@@ -1274,9 +1266,9 @@ static void adapter_property_set_pairable(const GDBusPropertyTable *property,
dbus_bool_t pairable;

if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
- return g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &pairable);

@@ -1303,9 +1295,9 @@ static void adapter_property_set_discoverable_timeout(
uint32_t timeout;

if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_UINT32)
- return g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &timeout);
set_discoverable_timeout(data, timeout, id);
@@ -1330,9 +1322,9 @@ static void adapter_property_set_pairable_timeout(
uint32_t timeout;

if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_UINT32)
- return g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &timeout);
set_pairable_timeout(data, timeout, id);
@@ -2361,13 +2353,12 @@ static void set_mode_complete(struct btd_adapter *adapter)

if (pending->type == SESSION_TYPE_MODE_GLOBAL) {
if (err < 0)
- g_dbus_pending_property_error(conn, pending->prop_id,
+ g_dbus_pending_property_error(pending->prop_id,
ERROR_INTERFACE ".Failed",
strerror(-err));
else {
adapter->global_mode = adapter->mode;
- g_dbus_pending_property_success(conn,
- pending->prop_id);
+ g_dbus_pending_property_success(pending->prop_id);
}
} else if (pending->msg != NULL) {
DBusMessage *msg = pending->msg;
diff --git a/src/device.c b/src/device.c
index bb0f890..bc7f8dd 100644
--- a/src/device.c
+++ b/src/device.c
@@ -394,10 +394,8 @@ static void set_alias(GDBusPendingPropertySet id, const char *alias,

/* No change */
if ((device->alias == NULL && g_str_equal(alias, "")) ||
- g_strcmp0(device->alias, alias) == 0) {
- g_dbus_pending_property_success(btd_get_dbus_connection(), id);
- return;
- }
+ g_strcmp0(device->alias, alias) == 0)
+ return g_dbus_pending_property_success(id);

ba2str(adapter_get_address(adapter), srcaddr);
ba2str(&device->bdaddr, dstaddr);
@@ -405,11 +403,9 @@ static void set_alias(GDBusPendingPropertySet id, const char *alias,
/* Remove alias if empty string */
err = write_device_alias(srcaddr, dstaddr, device->bdaddr_type,
g_str_equal(alias, "") ? NULL : alias);
- if (err < 0) {
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".Failed", strerror(-err));
- return;
- }
+ if (err < 0)
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".Failed", strerror(-err));

g_free(device->alias);
device->alias = g_str_equal(alias, "") ? NULL : g_strdup(alias);
@@ -417,7 +413,7 @@ static void set_alias(GDBusPendingPropertySet id, const char *alias,
g_dbus_emit_property_changed(btd_get_dbus_connection(),
device->path, DEVICE_INTERFACE, "Alias");

- g_dbus_pending_property_success(btd_get_dbus_connection(), id);
+ g_dbus_pending_property_success(id);
}

static void dev_property_set_alias(const GDBusPropertyTable *property,
@@ -426,12 +422,10 @@ static void dev_property_set_alias(const GDBusPropertyTable *property,
{
const char *alias;

- if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_STRING) {
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
- return;
- }
+ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_STRING)
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &alias);

@@ -686,27 +680,23 @@ static void set_trust(GDBusPendingPropertySet id, gboolean value, void *data)
char srcaddr[18], dstaddr[18];
int err;

- if (device->trusted == value) {
- g_dbus_pending_property_success(btd_get_dbus_connection(), id);
- return;
- }
+ if (device->trusted == value)
+ return g_dbus_pending_property_success(id);

ba2str(adapter_get_address(adapter), srcaddr);
ba2str(&device->bdaddr, dstaddr);

err = write_trust(srcaddr, dstaddr, device->bdaddr_type, value);
- if (err < 0) {
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".Failed", strerror(-err));
- return;
- }
+ if (err < 0)
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".Failed", strerror(-err));

device->trusted = value;

g_dbus_emit_property_changed(btd_get_dbus_connection(),
device->path, DEVICE_INTERFACE, "Trusted");

- g_dbus_pending_property_success(btd_get_dbus_connection(), id);
+ g_dbus_pending_property_success(id);
}

static void dev_property_set_trusted(const GDBusPropertyTable *property,
@@ -715,12 +705,10 @@ static void dev_property_set_trusted(const GDBusPropertyTable *property,
{
dbus_bool_t b;

- if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN) {
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
- return;
- }
+ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &b);

@@ -750,17 +738,15 @@ static void set_blocked(GDBusPendingPropertySet id, gboolean value, void *data)

switch (-err) {
case 0:
- g_dbus_pending_property_success(btd_get_dbus_connection(), id);
+ g_dbus_pending_property_success(id);
break;
case EINVAL:
- g_dbus_pending_property_error(btd_get_dbus_connection(), id,
- ERROR_INTERFACE ".Failed",
+ g_dbus_pending_property_error(id, ERROR_INTERFACE ".Failed",
"Kernel lacks blacklist support");
break;
default:
- g_dbus_pending_property_error(btd_get_dbus_connection(), id,
- ERROR_INTERFACE ".Failed",
- strerror(-err));
+ g_dbus_pending_property_error(id, ERROR_INTERFACE ".Failed",
+ strerror(-err));
break;
}
}
@@ -772,12 +758,10 @@ static void dev_property_set_blocked(const GDBusPropertyTable *property,
{
dbus_bool_t b;

- if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN) {
- g_dbus_pending_property_error(btd_get_dbus_connection(),
- id, ERROR_INTERFACE ".InvalidArguments",
- "Invalid arguments in method call");
- return;
- }
+ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
+ return g_dbus_pending_property_error(id,
+ ERROR_INTERFACE ".InvalidArguments",
+ "Invalid arguments in method call");

dbus_message_iter_get_basic(value, &b);

--
1.7.12.3