diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-04-28 16:36:14 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-04-28 16:36:14 +0000 |
commit | 7a0b255ba127009e7a1b1e00be6cd51387aee1fa (patch) | |
tree | 900536b90825d543a0295efef9104096077c099c /hcid | |
parent | 5786b2c0581496e883a27bd297ed58d81d842c85 (diff) |
Some coding style cleanups
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus-adapter.c | 26 | ||||
-rw-r--r-- | hcid/dbus.c | 14 |
2 files changed, 19 insertions, 21 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index 1a57bf59..d096f565 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -459,7 +459,7 @@ static DBusHandlerResult handle_dev_is_connected_req(DBusConnection *conn, DBusM if (dbus_error_is_set(&err)) { error("Can't extract message arguments:%s", err.message); - dbus_error_free(&err); + dbus_error_free(&err); return error_invalid_arguments(conn, msg); } @@ -490,7 +490,6 @@ static DBusHandlerResult handle_dev_list_connections_req(DBusConnection *conn, D struct hci_dbus_data *dbus_data = data; struct slist *l = dbus_data->active_conn; - reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; @@ -505,7 +504,7 @@ static DBusHandlerResult handle_dev_list_connections_req(DBusConnection *conn, D struct active_conn_info *dev = l->data; baswap(&tmp, &dev->bdaddr); peer_addr = batostr(&tmp); - + dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &peer_addr); bt_free(peer_addr); @@ -788,7 +787,7 @@ static DBusHandlerResult handle_dev_set_name_req(DBusConnection *conn, DBusMessa char *str_ptr; int ecode; - dbus_error_init(&err); + dbus_error_init(&err); dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &str_ptr, DBUS_TYPE_INVALID); @@ -1456,7 +1455,6 @@ static DBusHandlerResult handle_dev_disconnect_remote_device_req(DBusConnection int dd; struct active_conn_info *dev; - dbus_error_init(&err); dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &peer_addr, @@ -1517,7 +1515,7 @@ static DBusHandlerResult handle_dev_create_bonding_req(DBusConnection *conn, DBu dbus_error_init(&err); dbus_message_get_args(msg, &err, - DBUS_TYPE_STRING, &peer_addr, + DBUS_TYPE_STRING, &peer_addr, DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { @@ -1632,8 +1630,8 @@ static DBusHandlerResult handle_dev_cancel_bonding_req(DBusConnection *conn, DBu dbus_error_init(&err); dbus_message_get_args(msg, &err, - DBUS_TYPE_STRING, &peer_addr, - DBUS_TYPE_INVALID); + DBUS_TYPE_STRING, &peer_addr, + DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { error("Can't extract message arguments:%s", err.message); @@ -1717,6 +1715,7 @@ static DBusHandlerResult handle_dev_cancel_bonding_req(DBusConnection *conn, DBu } hci_close_dev(dd); + return DBUS_HANDLER_RESULT_HANDLED; } @@ -2026,7 +2025,7 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D /* is there discover pending? */ if (dbus_data->discover_state != STATE_DISCOVER && - dbus_data->discover_state != STATE_RESOLVING_NAMES) + dbus_data->discover_state != STATE_RESOLVING_NAMES) return error_not_authorized(conn, msg); /* FIXME: find a better error name */ /* only the discover requestor can cancel the inquiry process */ @@ -2061,8 +2060,7 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D } if (hci_send_req(dd, &rq, 100) < 0) { - error("Sending command failed: %s (%d)", - strerror(errno), errno); + error("Sending command failed: %s (%d)", strerror(errno), errno); hci_close_dev(dd); return error_failed(conn, msg, errno); } @@ -2129,7 +2127,6 @@ struct slist *service_classes_str(uint32_t class) return l; } - static struct service_data dev_services[] = { { "GetAddress", handle_dev_get_address_req }, { "GetVersion", handle_dev_get_version_req }, @@ -2199,13 +2196,12 @@ DBusHandlerResult msg_func_device(DBusConnection *conn, DBusMessage *msg, void * return handler(conn, msg, data); else return error_unknown_method(conn, msg); - } - else if (!strcmp(SECURITY_INTERFACE, iface)) + } else if (!strcmp(SECURITY_INTERFACE, iface)) return handle_security_method(conn, msg, data); else if (!strcmp(RFCOMM_INTERFACE, iface)) return handle_rfcomm_method(conn, msg, data); else if (!strcmp(SDP_INTERFACE, iface)) return handle_sdp_method(conn, msg, data); - else + else return error_unknown_method(conn, msg); } diff --git a/hcid/dbus.c b/hcid/dbus.c index a6a4adf4..13368b04 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -199,7 +199,6 @@ static int active_conn_remove(struct slist **list, uint16_t *handle) static DBusMessage *dbus_msg_new_authentication_return(DBusMessage *msg, uint8_t status) { - switch (status) { case 0x00: /* success */ return dbus_message_new_method_return(msg); @@ -496,6 +495,7 @@ gboolean hcid_dbus_register_device(uint16_t id) active_conn_append(&pdata->active_conn, &ci->bdaddr, ci->handle); ret = TRUE; + failed: if (!ret) dbus_connection_unregister_object_path(connection, path); @@ -1168,6 +1168,7 @@ bonding_failed: pdata->bonding = NULL; free(pdata->requestor_name); pdata->requestor_name = NULL; + done: hci_close_dev(dd); @@ -1340,8 +1341,7 @@ gboolean hcid_dbus_init(void) dbus_connection_set_exit_on_disconnect(connection, FALSE); - ret_val = dbus_bus_request_name(connection, BASE_INTERFACE, - 0, &err); + ret_val = dbus_bus_request_name(connection, BASE_INTERFACE, 0, &err); if (ret_val != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER ) { error("Service could not become the primary owner."); @@ -1439,6 +1439,7 @@ int discoverable_timeout_handler(void *data) dbus_data->timeout_id = 0; retval = -1; + failed: if (dd >= 0) close(dd); @@ -1452,8 +1453,8 @@ static int system_bus_reconnect(void *data) struct hci_dev_req *dr; int sk, i, ret_val = 0; - if (dbus_connection_get_is_connected(connection)) - return -1; + if (dbus_connection_get_is_connected(connection)) + return -1; if (hcid_dbus_init() == FALSE) return 0; @@ -1488,6 +1489,7 @@ static int system_bus_reconnect(void *data) hcid_dbus_register_device(dr->dev_id); ret_val = -1; + failed: if (sk >= 0) close(sk); @@ -1656,6 +1658,7 @@ void hcid_dbus_setscan_enable_complete(bdaddr_t *local) g_timeout_remove(pdata->timeout_id); pdata->timeout_id = 0; } + switch (rp.enable) { case SCAN_DISABLED: scan_mode = MODE_OFF; @@ -1701,7 +1704,6 @@ void hcid_dbus_setscan_enable_complete(bdaddr_t *local) dbus_connection_flush(connection); failed: - if (message) dbus_message_unref(message); |