[gnome-keyring: 7/8] Gck: GckAttribute value field is a byte array
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring: 7/8] Gck: GckAttribute value field is a byte array
- Date: Thu, 29 Sep 2011 08:19:33 +0000 (UTC)
commit f300deeab290f6fabc8ea409cf0b9d57ce683eca
Author: Stef Walter <stefw collabora co uk>
Date: Thu Sep 29 10:06:41 2011 +0200
Gck: GckAttribute value field is a byte array
gck/gck-attributes.c | 2 +-
gck/gck-dump.c | 4 ++--
gck/gck.h | 14 +++++++++-----
3 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index 777d816..2d28bae 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -43,7 +43,7 @@
/**
* GckAttribute:
* @type: The attribute type, such as CKA_LABEL.
- * @value: The value of the attribute. May be NULL.
+ * @value: (array length=length): The value of the attribute. May be NULL.
* @length: The length of the attribute. May be G_MAXULONG if the attribute is invalid.
*
* This structure represents a PKCS11 CK_ATTRIBUTE.
diff --git a/gck/gck-dump.c b/gck/gck-dump.c
index f2f6b12..9003ce8 100644
--- a/gck/gck-dump.c
+++ b/gck/gck-dump.c
@@ -174,7 +174,7 @@ dump_attribute_value (GckAttribute *attr)
case CKA_G_SCHEMA:
case CKA_X_PURPOSE:
case CKA_X_PEER:
- if (g_utf8_validate (attr->value, attr->length, NULL)) {
+ if (g_utf8_validate ((const gchar *)attr->value, attr->length, NULL)) {
int length = MIN (32, attr->length);
g_printerr ("%.*s%s", length, (gchar*)attr->value,
length < attr->length ? "..." : "");
@@ -187,7 +187,7 @@ dump_attribute_value (GckAttribute *attr)
case CKA_G_CREATED:
case CKA_G_MODIFIED:
if (attr->length == sizeof (CK_DATE)) {
- const CK_DATE* date = attr->value;
+ const CK_DATE* date = (const CK_DATE *)attr->value;
g_printerr ("%.4s-%.2s-%.2s", date->year, date->month, date->day);
return;
}
diff --git a/gck/gck.h b/gck/gck.h
index 6eae4e7..78db7ff 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -72,17 +72,21 @@ gchar* gck_string_from_chars (const guchar *data,
typedef gpointer (*GckAllocator) (gpointer data, gsize length);
-typedef struct GckMechanism {
+typedef struct _GckMechanism GckMechanism;
+
+struct _GckMechanism {
gulong type;
gconstpointer parameter;
gulong n_parameter;
-} GckMechanism;
+};
-typedef struct GckAttribute {
+typedef struct _GckAttribute GckAttribute;
+
+struct _GckAttribute {
gulong type;
- gconstpointer value;
+ guchar *value;
gulong length;
-} GckAttribute;
+};
#define GCK_INVALID G_MAXULONG
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]