Apply tizen 3.0 based product patchsets
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-gap-agent.c
index 8ceb7fa..dccf480 100644 (file)
@@ -112,8 +112,6 @@ gboolean _gap_agent_register_osp_server(GapAgentPrivate *agent,
                return FALSE;
 
        server = g_malloc0(sizeof(bt_agent_osp_server_t));
-       retv_if(server == NULL, FALSE);
-
        server->type = type;
        if (type == BT_RFCOMM_SERVER) {
                server->uuid = g_strdup(uuid);
@@ -306,7 +304,7 @@ gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
                if (accept == GAP_AGENT_ACCEPT) {
                        g_dbus_method_invocation_return_value(priv->reply_context, NULL);
                } else if (accept == GAP_AGENT_ACCEPT_ALWAYS) {
-                       bluetooth_device_address_t addr = {{0,}};
+                       bluetooth_device_address_t addr = { { 0, } };
                        int result;
 
                        _bt_convert_addr_string_to_type(addr.addr,
@@ -331,7 +329,7 @@ gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
                                                "CanceledbyUser");
                                break;
                        case GAP_AGENT_REJECT: {
-                               bluetooth_device_address_t addr = {{0,}};
+                               bluetooth_device_address_t addr = { { 0, } };
                                int result;
 
                                _bt_convert_addr_string_to_type(addr.addr,
@@ -487,7 +485,7 @@ static gboolean __gap_agent_unregister(GapAgentPrivate *agent)
        }
 
        reply = g_dbus_proxy_call_sync(agent_manager, "UnregisterAgent",
-                       g_variant_new("o", priv->path),
+                       g_variant_new("(o)", priv->path),
                        G_DBUS_CALL_FLAGS_NONE, -1,
                        NULL, &error);
        g_object_unref(agent_manager);
@@ -617,7 +615,7 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                if (!agent->cb.passkey_func)
                        return;
 
-               conn = _bt_get_system_gconn();
+               conn = _bt_gdbus_get_system_gconn();
                if (conn == NULL)
                        return;
 
@@ -650,9 +648,8 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                        addr += 4;
                        g_strlcpy(agent->pairing_addr, addr, sizeof(agent->pairing_addr));
 
-                       while ((pos = strchr(agent->pairing_addr, '_')) != NULL) {
+                       while ((pos = strchr(agent->pairing_addr, '_')) != NULL)
                                *pos = ':';
-                       }
                }
 
                agent->cb.pincode_func(agent, device);
@@ -683,7 +680,7 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                if (!priv->cb.passkey_func)
                        return;
 
-               conn = _bt_get_system_gconn();
+               conn = _bt_gdbus_get_system_gconn();
                if (conn == NULL)
                        return;
 
@@ -716,9 +713,8 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                        addr += 4;
                        g_strlcpy(priv->pairing_addr, addr, sizeof(priv->pairing_addr));
 
-                       while ((pos = strchr(priv->pairing_addr, '_')) != NULL) {
+                       while ((pos = strchr(priv->pairing_addr, '_')) != NULL)
                                *pos = ':';
-                       }
                }
 
                priv->cb.passkey_func(priv, device);
@@ -755,7 +751,7 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                if (!priv->cb.display_func)
                        return;
 
-               conn = _bt_get_system_gconn();
+               conn = _bt_gdbus_get_system_gconn();
                if (conn == NULL)
                        return;
 
@@ -812,7 +808,7 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                if (!priv->cb.confirm_func)
                        return;
 
-               conn = _bt_get_system_gconn();
+               conn = _bt_gdbus_get_system_gconn();
                if (conn == NULL)
                        return;
 
@@ -845,9 +841,8 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                        addr += 4;
                        g_strlcpy(priv->pairing_addr, addr, sizeof(priv->pairing_addr));
 
-                       while ((pos = strchr(priv->pairing_addr, '_')) != NULL) {
+                       while ((pos = strchr(priv->pairing_addr, '_')) != NULL)
                                *pos = ':';
-                       }
                }
 
                priv->cb.confirm_func(priv, device, passkey);
@@ -880,7 +875,7 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                if (!priv->cb.authorize_func)
                        return;
 
-               conn = _bt_get_system_gconn();
+               conn = _bt_gdbus_get_system_gconn();
                if (conn == NULL)
                        return;
 
@@ -915,9 +910,8 @@ static void __bt_gap_agent_method(GDBusConnection *connection,
                        g_strlcpy(priv->authorize_addr, addr,
                                                        sizeof(priv->authorize_addr));
 
-                       while ((pos = strchr(priv->authorize_addr, '_')) != NULL) {
+                       while ((pos = strchr(priv->authorize_addr, '_')) != NULL)
                                *pos = ':';
-                       }
                }
 
                priv->cb.authorize_func(priv, device, uuid);
@@ -1120,8 +1114,8 @@ void _gap_agent_setup_dbus(GapAgentPrivate *agent, GAP_AGENT_FUNC_CB *func_cb,
                priv->busname = NULL;
        } else {
                priv->busname = g_strdup(g_dbus_proxy_get_name(proxy));
-               g_object_unref(proxy);
                BT_DBG("Busname: %s", priv->busname);
+               g_object_unref(proxy);
        }
 
 }
@@ -1183,9 +1177,8 @@ bt_agent_osp_server_t *_gap_agent_get_osp_server(GapAgentPrivate *agent, int typ
 
        osp_serv = __gap_agent_find_server(priv->osp_servers,
                        type, uuid);
-       if (!osp_serv) {
+       if (!osp_serv)
                return NULL;
-       }
 
        return osp_serv;
 }