[Pkg-telepathy-commits] [telepathy-mission-control-6] 213/280: McdAccountManagerDefault: get/set/commit on a missing account is an error
Simon McVittie
smcv at debian.org
Thu Mar 27 20:07:25 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.
commit 9e890f2ee20791dc87093bb72b1a6a5148d28766
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Fri Nov 15 15:24:16 2013 +0000
McdAccountManagerDefault: get/set/commit on a missing account is an error
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
---
src/mcd-account-manager-default.c | 41 ++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index 9becfd3..49f0407 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -181,15 +181,14 @@ set_parameter (McpAccountStorage *self,
McdAccountManagerDefault *amd = MCD_ACCOUNT_MANAGER_DEFAULT (self);
McdDefaultStoredAccount *sa;
+ sa = lookup_stored_account (amd, account);
+ g_return_val_if_fail (sa != NULL, MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
+ g_return_val_if_fail (!sa->absent, MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
+
if (val == NULL)
{
gboolean changed = FALSE;
- sa = lookup_stored_account (amd, account);
-
- if (sa == NULL)
- return MCP_ACCOUNT_STORAGE_SET_RESULT_UNCHANGED;
-
changed = g_hash_table_remove (sa->parameters, parameter);
/* deliberately not ||= - if we removed it from parameters, we
* still want to remove it from untyped_parameters if it was there */
@@ -202,7 +201,6 @@ set_parameter (McpAccountStorage *self,
{
GVariant *old;
- sa = ensure_stored_account (amd, account);
old = g_hash_table_lookup (sa->parameters, parameter);
if (old == NULL)
@@ -246,13 +244,12 @@ set_attribute (McpAccountStorage *self,
McdAccountManagerDefault *amd = MCD_ACCOUNT_MANAGER_DEFAULT (self);
McdDefaultStoredAccount *sa;
+ sa = lookup_stored_account (amd, account);
+ g_return_val_if_fail (sa != NULL, MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
+ g_return_val_if_fail (!sa->absent, MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
+
if (val == NULL)
{
- sa = lookup_stored_account (amd, account);
-
- if (sa == NULL)
- return MCP_ACCOUNT_STORAGE_SET_RESULT_UNCHANGED;
-
if (!g_hash_table_remove (sa->attributes, attribute))
return MCP_ACCOUNT_STORAGE_SET_RESULT_UNCHANGED;
}
@@ -260,7 +257,6 @@ set_attribute (McpAccountStorage *self,
{
GVariant *old;
- sa = ensure_stored_account (amd, account);
old = g_hash_table_lookup (sa->attributes, attribute);
if (old != NULL && g_variant_equal (old, val))
@@ -288,8 +284,8 @@ get_attribute (McpAccountStorage *self,
if (flags != NULL)
*flags = 0;
- if (sa == NULL || sa->absent)
- return FALSE;
+ g_return_val_if_fail (sa != NULL, NULL);
+ g_return_val_if_fail (!sa->absent, NULL);
/* ignore @type, we store every attribute with its type anyway; MC will
* coerce values to an appropriate type if needed */
@@ -312,8 +308,8 @@ get_parameter (McpAccountStorage *self,
if (flags != NULL)
*flags = 0;
- if (sa == NULL || sa->absent)
- return FALSE;
+ g_return_val_if_fail (sa != NULL, NULL);
+ g_return_val_if_fail (!sa->absent, NULL);
variant = g_hash_table_lookup (sa->parameters, parameter);
@@ -457,6 +453,9 @@ am_default_commit_one (McdAccountManagerDefault *self,
gboolean ret;
GError *error = NULL;
+ g_return_val_if_fail (sa != NULL, FALSE);
+ g_return_val_if_fail (!sa->absent, FALSE);
+
if (!sa->dirty)
return TRUE;
@@ -539,6 +538,16 @@ _commit (const McpAccountStorage *self,
* give us a chance to commit to the keyring too */
}
+ if (account != NULL)
+ {
+ McdDefaultStoredAccount *sa = lookup_stored_account (amd, account);
+
+ g_return_val_if_fail (sa != NULL, FALSE);
+ g_return_val_if_fail (!sa->absent, FALSE);
+
+ return am_default_commit_one (amd, account, sa);
+ }
+
g_hash_table_iter_init (&outer, amd->accounts);
while (g_hash_table_iter_next (&outer, &account_p, &sa_p))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-6.git
More information about the Pkg-telepathy-commits
mailing list