[libgnome-keyring] Access GArray members using g_array_index()



commit 866e75657106c1b3a4776b49b75e27300c22653b
Author: Arun Raghavan <ford_prefect gentoo org>
Date:   Wed Sep 8 11:56:02 2010 +0530

    Access GArray members using g_array_index()
    
    This handles type-casting internally to avoid alignment warnings on
    platforms that need to deal with these issues.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=628875

 library/gnome-keyring.c |   43 ++++++++++++++++++++++---------------------
 1 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/library/gnome-keyring.c b/library/gnome-keyring.c
index 7dab32c..e1f327c 100644
--- a/library/gnome-keyring.c
+++ b/library/gnome-keyring.c
@@ -3976,27 +3976,28 @@ find_network_password_filter (GnomeKeyringResult res, GList *found_list, gpointe
 
 		attributes = (GnomeKeyringAttribute *) found->attributes->data;
 		for (i = 0; i < found->attributes->len; i++) {
-			if (strcmp (attributes[i].name, "user") == 0 &&
-			    attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
-				data->user = g_strdup (attributes[i].value.string);
-			} else if (strcmp (attributes[i].name, "domain") == 0 &&
-				   attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
-				data->domain = g_strdup (attributes[i].value.string);
-			} else if (strcmp (attributes[i].name, "server") == 0 &&
-				   attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
-				data->server = g_strdup (attributes[i].value.string);
-			} else if (strcmp (attributes[i].name, "object") == 0 &&
-				   attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
-				data->object = g_strdup (attributes[i].value.string);
-			} else if (strcmp (attributes[i].name, "protocol") == 0 &&
-				   attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
-				data->protocol = g_strdup (attributes[i].value.string);
-			} else if (strcmp (attributes[i].name, "authtype") == 0 &&
-				   attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
-				data->authtype = g_strdup (attributes[i].value.string);
-			} else if (strcmp (attributes[i].name, "port") == 0 &&
-				   attributes[i].type == GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32) {
-				data->port = attributes[i].value.integer;
+			GnomeKeyringAttribute *attribute = &(g_array_index (found->attributes, GnomeKeyringAttribute, i));
+			if (strcmp (attribute->name, "user") == 0 &&
+			    attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
+				data->user = g_strdup (attribute->value.string);
+			} else if (strcmp (attribute->name, "domain") == 0 &&
+				   attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
+				data->domain = g_strdup (attribute->value.string);
+			} else if (strcmp (attribute->name, "server") == 0 &&
+				   attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
+				data->server = g_strdup (attribute->value.string);
+			} else if (strcmp (attribute->name, "object") == 0 &&
+				   attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
+				data->object = g_strdup (attribute->value.string);
+			} else if (strcmp (attribute->name, "protocol") == 0 &&
+				   attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
+				data->protocol = g_strdup (attribute->value.string);
+			} else if (strcmp (attribute->name, "authtype") == 0 &&
+				   attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) {
+				data->authtype = g_strdup (attribute->value.string);
+			} else if (strcmp (attribute->name, "port") == 0 &&
+				   attribute->type == GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32) {
+				data->port = attribute->value.integer;
 			}
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]