gnome-bluetooth r580 - trunk/common
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-bluetooth r580 - trunk/common
- Date: Wed, 8 Apr 2009 16:13:54 +0000 (UTC)
Author: hadess
Date: Wed Apr 8 16:13:54 2009
New Revision: 580
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=580&view=rev
Log:
Add guards for the public functions
Modified:
trunk/common/bluetooth-client.c
Modified: trunk/common/bluetooth-client.c
==============================================================================
--- trunk/common/bluetooth-client.c (original)
+++ trunk/common/bluetooth-client.c Wed Apr 8 16:13:54 2009
@@ -296,8 +296,9 @@
return found;
}
-static gboolean get_iter_from_path(GtkTreeStore *store,
- GtkTreeIter *iter, const char *path)
+static gboolean
+get_iter_from_path (GtkTreeStore *store,
+ GtkTreeIter *iter, const char *path)
{
return iter_search(store, iter, NULL, compare_path, (gpointer) path);
}
@@ -1050,27 +1051,33 @@
return bluetooth_client;
}
-GtkTreeModel *bluetooth_client_get_model(BluetoothClient *client)
+GtkTreeModel *bluetooth_client_get_model (BluetoothClient *client)
{
- BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+ BluetoothClientPrivate *priv;
GtkTreeModel *model;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), NULL);
+
DBG("client %p", client);
+ priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
model = g_object_ref(priv->store);
return model;
}
-GtkTreeModel *bluetooth_client_get_filter_model(BluetoothClient *client,
- GtkTreeModelFilterVisibleFunc func,
- gpointer data, GDestroyNotify destroy)
+GtkTreeModel *bluetooth_client_get_filter_model (BluetoothClient *client,
+ GtkTreeModelFilterVisibleFunc func,
+ gpointer data, GDestroyNotify destroy)
{
- BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+ BluetoothClientPrivate *priv;
GtkTreeModel *model;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), NULL);
+
DBG("client %p", client);
+ priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
model = gtk_tree_model_filter_new(GTK_TREE_MODEL(priv->store), NULL);
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model),
@@ -1098,25 +1105,28 @@
return active;
}
-GtkTreeModel *bluetooth_client_get_adapter_model(BluetoothClient *client)
+GtkTreeModel *bluetooth_client_get_adapter_model (BluetoothClient *client)
{
DBG("client %p", client);
- return bluetooth_client_get_filter_model(client, adapter_filter,
- NULL, NULL);
+ return bluetooth_client_get_filter_model (client, adapter_filter,
+ NULL, NULL);
}
-GtkTreeModel *bluetooth_client_get_device_model(BluetoothClient *client,
- DBusGProxy *adapter)
+GtkTreeModel *bluetooth_client_get_device_model (BluetoothClient *client,
+ DBusGProxy *adapter)
{
- BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+ BluetoothClientPrivate *priv;
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
gboolean cont, found = FALSE;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), NULL);
+
DBG("client %p", client);
+ priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store),
&iter);
@@ -1161,6 +1171,8 @@
{
GtkTreeModel *model;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), NULL);
+
DBG("client %p", client);
model = bluetooth_client_get_device_model(client, adapter);
@@ -1177,6 +1189,8 @@
GtkTreeIter iter;
gboolean cont;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), NULL);
+
DBG("client %p", client);
cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store),
@@ -1206,6 +1220,8 @@
{
DBusGProxy *adapter;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+
DBG("client %p", client);
adapter = bluetooth_client_get_default_adapter(client);
@@ -1223,6 +1239,8 @@
{
DBusGProxy *adapter;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+
DBG("client %p", client);
adapter = bluetooth_client_get_default_adapter(client);
@@ -1270,6 +1288,9 @@
DBusGProxy *adapter;
DBusGProxyCall *call;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (address != NULL, FALSE);
+
DBG("client %p", client);
adapter = bluetooth_client_get_default_adapter(client);
@@ -1306,6 +1327,9 @@
DBusGProxy *proxy;
GValue value = { 0 };
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (device != NULL, FALSE);
+
DBG("client %p", client);
proxy = dbus_g_proxy_new_from_proxy(priv->manager,
@@ -1365,6 +1389,9 @@
const char *iface_name;
guint i;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (device != NULL, FALSE);
+
DBG("client %p", client);
if (get_iter_from_path (priv->store, &iter, device) == FALSE)
@@ -1465,8 +1492,6 @@
{
int a, b;
- g_message ("comparing %s and %s", servicea, serviceb);
-
a = service_to_index (servicea);
b = service_to_index (serviceb);
@@ -1485,10 +1510,12 @@
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
ConnectData *conndata;
DBusGProxy *proxy;
- DBusGProxyCall *call;
GHashTable *table;
GtkTreeIter iter;
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (device != NULL, FALSE);
+
DBG("client %p", client);
if (get_iter_from_path (priv->store, &iter, device) == FALSE)
@@ -1507,9 +1534,9 @@
conndata->data = data;
if (table == NULL) {
- call = dbus_g_proxy_begin_call(proxy, "Disconnect",
- disconnect_callback, conndata, NULL,
- G_TYPE_INVALID);
+ dbus_g_proxy_begin_call(proxy, "Disconnect",
+ disconnect_callback, conndata, NULL,
+ G_TYPE_INVALID);
} else {
DBusGProxy *service;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]