[gnome-keyring/dbus-api] [gck] Add gck_attribute_set_empty() function.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-keyring/dbus-api] [gck] Add gck_attribute_set_empty() function.
- Date: Tue, 18 Aug 2009 03:47:08 +0000 (UTC)
commit 8bfec80d353e333e492025ed1c0fbf3e438784b5
Author: Stef Walter <stef memberwebs com>
Date: Tue Aug 18 03:39:04 2009 +0000
[gck] Add gck_attribute_set_empty() function.
pkcs11/gck/gck-attributes.c | 6 ++++++
pkcs11/gck/gck-attributes.h | 2 ++
pkcs11/gck/tests/unit-test-attributes.c | 13 +++++++++++++
3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/pkcs11/gck/gck-attributes.c b/pkcs11/gck/gck-attributes.c
index 047050f..3ce8925 100644
--- a/pkcs11/gck/gck-attributes.c
+++ b/pkcs11/gck/gck-attributes.c
@@ -132,6 +132,12 @@ gck_attribute_get_string (CK_ATTRIBUTE_PTR attr, gchar **value)
}
CK_RV
+gck_attribute_set_empty (CK_ATTRIBUTE_PTR attr)
+{
+ return gck_attribute_set_data (attr, "", 0);
+}
+
+CK_RV
gck_attribute_set_bool (CK_ATTRIBUTE_PTR attr, CK_BBOOL value)
{
return gck_attribute_set_data (attr, &value, sizeof (CK_BBOOL));
diff --git a/pkcs11/gck/gck-attributes.h b/pkcs11/gck/gck-attributes.h
index b4509a1..3ae7cd9 100644
--- a/pkcs11/gck/gck-attributes.h
+++ b/pkcs11/gck/gck-attributes.h
@@ -37,6 +37,8 @@ CK_RV gck_attribute_get_time (CK_ATTRI
CK_RV gck_attribute_get_string (CK_ATTRIBUTE_PTR attr,
gchar **value);
+CK_RV gck_attribute_set_empty (CK_ATTRIBUTE_PTR attr);
+
CK_RV gck_attribute_set_bool (CK_ATTRIBUTE_PTR attr,
CK_BBOOL value);
diff --git a/pkcs11/gck/tests/unit-test-attributes.c b/pkcs11/gck/tests/unit-test-attributes.c
index e0290b6..05643b6 100644
--- a/pkcs11/gck/tests/unit-test-attributes.c
+++ b/pkcs11/gck/tests/unit-test-attributes.c
@@ -94,6 +94,19 @@ DEFINE_TEST(attribute_set_data_length)
g_assert (attr.ulValueLen == 6);
}
+DEFINE_TEST(attribute_set_empty)
+{
+ CK_ATTRIBUTE attr;
+ gchar buf[30];
+ CK_RV rv;
+
+ attr.ulValueLen = 30;
+ attr.pValue = buf;
+ rv = gck_attribute_set_empty (&attr);
+ g_assert (rv == CKR_OK);
+ g_assert (attr.ulValueLen == 0);
+}
+
DEFINE_TEST(attribute_get_bool)
{
CK_ATTRIBUTE attr;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]