[gnome-keyring/gck-work] [gck] GckAttribute with const value pointer.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/gck-work] [gck] GckAttribute with const value pointer.
- Date: Tue, 28 Sep 2010 01:12:34 +0000 (UTC)
commit 12357120c2ff79446af8cce21b37a2fb8f688394
Author: Stef Walter <stef memberwebs com>
Date: Tue Sep 28 01:10:48 2010 +0000
[gck] GckAttribute with const value pointer.
We want to reinforce the fact that attributes are not modifiable once
they're setup.
daemon/dbus/gkd-secret-objects.c | 5 +++--
gck/gck-attributes.c | 6 +++---
gck/gck.h | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/daemon/dbus/gkd-secret-objects.c b/daemon/dbus/gkd-secret-objects.c
index 48e56ba..a39e3e4 100644
--- a/daemon/dbus/gkd-secret-objects.c
+++ b/daemon/dbus/gkd-secret-objects.c
@@ -189,6 +189,7 @@ object_property_get (GckObject *object, DBusMessage *message,
GError *error = NULL;
DBusMessage *reply;
GckAttribute attr;
+ gpointer value;
gsize length;
if (!gkd_secret_property_get_type (prop_name, &attr.type))
@@ -196,7 +197,7 @@ object_property_get (GckObject *object, DBusMessage *message,
"Object does not have the '%s' property", prop_name);
/* Retrieve the actual attribute */
- attr.value = gck_object_get_data (object, attr.type, NULL, &length, &error);
+ attr.value = value = gck_object_get_data (object, attr.type, NULL, &length, &error);
if (error != NULL) {
reply = dbus_message_new_error_printf (message, DBUS_ERROR_FAILED,
"Couldn't retrieve '%s' property: %s",
@@ -210,7 +211,7 @@ object_property_get (GckObject *object, DBusMessage *message,
reply = dbus_message_new_method_return (message);
dbus_message_iter_init_append (reply, &iter);
gkd_secret_property_append_variant (&iter, &attr);
- g_free (attr.value);
+ g_free (value);
return reply;
}
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index 0c33fc1..96cb7fb 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -62,7 +62,7 @@ attribute_init (GckAttribute *attr, gulong attr_type,
if (value) {
attr->value = (allocator) (NULL, length ? length : 1);
g_assert (attr->value);
- memcpy (attr->value, value, length);
+ memcpy ((gpointer)attr->value, value, length);
}
}
@@ -565,7 +565,7 @@ attribute_init_copy (GckAttribute *dest, const GckAttribute *src, GckAllocator a
if (src->value) {
dest->value = (allocator) (NULL, src->length ? src->length : 1);
g_assert (dest->value);
- memcpy (dest->value, src->value, src->length);
+ memcpy ((gpointer)dest->value, src->value, src->length);
}
}
@@ -594,7 +594,7 @@ attribute_clear (GckAttribute *attr, GckAllocator allocator)
g_assert (attr);
g_assert (allocator);
if (attr->value)
- (allocator) (attr->value, 0);
+ (allocator) ((gpointer)attr->value, 0);
attr->value = NULL;
attr->length = 0;
}
diff --git a/gck/gck.h b/gck/gck.h
index d34ce08..00a975d 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -59,7 +59,7 @@ typedef struct GckMechanism {
typedef struct GckAttribute {
gulong type;
- gpointer value;
+ gconstpointer value;
gulong length;
} GckAttribute;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]