soc.2009.telepathy: fc1d5406: Added argument checks to telepathy_accou...

sttwister at gmail.com sttwister at gmail.com
Thu Oct 15 15:55:43 EDT 2009


-----------------------------------------------------------------
Revision: fc1d5406b89fd2cbb0ae5151939178000a7f3784
Ancestor: f368ff87730720eec2aa44624df4b89c361170ce
Author: sttwister at gmail.com
Date: 2009-10-14T17:37:39
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/fc1d5406b89fd2cbb0ae5151939178000a7f3784

Modified files:
        libpurple/protocols/telepathy/telepathy_account.c

ChangeLog: 

Added argument checks to telepathy_account.c

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy_account.c	52856ee83121fab95ae463073a4df1ce17612847
+++ libpurple/protocols/telepathy/telepathy_account.c	529444d41796336c7e8062c6c101a094d1c65d65
@@ -43,6 +43,8 @@ account_properties_changed (PrplTpAccoun
 	GHashTableIter iter;
 	gpointer key, val;
 
+	g_return_if_fail(account_data != NULL);
+
 	purple_debug_info("telepathy", "account_properties_changed!\n");
 
 	g_hash_table_iter_init (&iter, properties);
@@ -112,6 +114,9 @@ build_parameters_from_purple_account (Pu
 	
 	int i;
 
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(params != NULL);
+
 	/* Loop over all parameters */
 	for (i = 0; params[i].name != NULL; ++i)
 	{
@@ -195,6 +200,9 @@ save_account_parameters (PrplTpAccount *
 
 	GHashTable *params_hash;
 	GPtrArray *unset;
+
+	g_return_if_fail(account_data != NULL);
+	g_return_if_fail(params != NULL);
 	
 	build_parameters_from_purple_account(account, params, &params_hash, &unset);
 
@@ -216,6 +224,8 @@ set_account_parameters (PurpleAccount *a
 	GHashTableIter iter;
 	gpointer key, value;
 
+	g_return_if_fail(account != NULL);
+
 	purple_debug_info("telepathy", "Setting parameters for %s\n",
 			purple_account_get_username(account));
 
@@ -279,6 +289,8 @@ get_account_properties_cb (TpProxy *prox
 
 	PurpleAccount *account;
 
+	g_return_if_fail(account_data != NULL);
+
 	if (error != NULL)
 	{
 		purple_debug_error("telepathy", "Error getting properties for account: %s\n",
@@ -406,6 +418,8 @@ purple_account_destroying_cb (PurpleAcco
 {
 	PrplTpAccount *account_data;
 
+	g_return_if_fail(user_data != NULL);
+
 	/* Save the changes to AccountManager and destroy the alocated struct */
 	purple_account_modified_cb(account, user_data);
 	
@@ -430,6 +444,8 @@ account_removed_cb (TpAccount *proxy,
 {
 	PrplTpAccount *account_data = user_data;
 
+	g_return_if_fail(user_data != NULL);
+
 	purple_debug_info("telepathy", "Account %s removed!\n",
 			purple_account_get_username(account_data->account));	
 
@@ -446,6 +462,8 @@ account_get_all_cb (TpProxy *proxy,
 {
 	PrplTpAccount *account_data = user_data;
 
+	g_return_if_fail(user_data != NULL);
+
 	if (error != NULL)
 	{
 		purple_debug_error("telepathy", "GetAll error: %s\n", error->message);
@@ -470,6 +488,8 @@ account_property_changed_cb (TpAccount *
 	GHashTableIter iter;
 	gpointer key, value;
 
+	g_return_if_fail(user_data != NULL);
+
 	purple_debug_info("telepathy", "Properties changed for account %s\n",
 		purple_account_get_username(account_data->account));
 
@@ -497,6 +517,8 @@ create_account_cb (TpAccountManager *pro
 	TpDBusDaemon *daemon;
 	GError *err = NULL;
 
+	g_return_if_fail(user_data != NULL);
+
 	if (error != NULL)
 	{
 		purple_debug_error("telepathy", "CreateAccount error: %s\n",
@@ -566,15 +588,18 @@ purple_account_added_cb (PurpleAccount *
 purple_account_added_cb (PurpleAccount *account,
                          gpointer user_data)
 {
-	gchar *protocol_id = g_strndup(purple_account_get_protocol_id(account),
-			strlen(TELEPATHY_ID));
-
 	PurplePlugin *plugin;
 	PrplTpData *data;
 	GHashTable *params_hash;
 	GPtrArray *unset;
 	PrplTpAccount *account_data;
+	gchar *protocol_id;
 
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(user_data != NULL);
+
+	protocol_id = g_strndup(purple_account_get_protocol_id(account),
+			strlen(TELEPATHY_ID));
 	if (g_strcmp0(protocol_id, TELEPATHY_ID) != 0)
 	{
 		/* This is not a Telepathy account, we don't care about it */
@@ -653,6 +678,8 @@ purple_account_removed_cb (PurpleAccount
 
 	gint account_data_int = purple_account_get_int(account, "tp_account_data", 0);
 
+	g_return_if_fail(user_data != NULL);
+
 	if (account_data_int == 0)
 	{
 		return;
@@ -689,6 +716,8 @@ get_valid_accounts_cb (TpProxy *proxy,
 	TpDBusDaemon *daemon;
 	PurplePlugin *plugin = user_data;
 
+	g_return_if_fail(user_data != NULL);
+
 	if (error != NULL)
 	{
 		purple_debug_error("telepathy", "Error geting valid accounts: %s\n",


More information about the Commits mailing list