[gcr: 2/4] Use attribute_get_ulong instead of pointer aliasing



commit b5b9ba30a5bf2699ff7fe574c3a1e8b79e1586ae
Author: Gregor Riepl <onitake gmail com>
Date:   Tue Nov 26 22:43:47 2019 +0100

    Use attribute_get_ulong instead of pointer aliasing

 gck/gck-attributes.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index d0b9401..bb57ffe 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -2814,13 +2814,13 @@ _gck_format_attributes (GString *output,
                if (attr->length == GCK_INVALID) {
                        g_string_append_printf (output, " (-1) INVALID");
                } else if (_gck_attribute_is_ulong_of_type (attr, CKA_CLASS)) {
-                       _gck_format_class (output, *((CK_OBJECT_CLASS_PTR)attr->value));
+                       _gck_format_class (output, (CK_OBJECT_CLASS) gck_attribute_get_ulong(attr));
                } else if (_gck_attribute_is_ulong_of_type (attr, CKA_X_ASSERTION_TYPE)) {
-                       _gck_format_assertion_type (output, *((CK_X_ASSERTION_TYPE *)attr->value));
+                       _gck_format_assertion_type (output, (CK_X_ASSERTION_TYPE) 
gck_attribute_get_ulong(attr));
                } else if (_gck_attribute_is_ulong_of_type (attr, CKA_CERTIFICATE_TYPE)) {
-                       _gck_format_certificate_type (output, *((CK_CERTIFICATE_TYPE *)attr->value));
+                       _gck_format_certificate_type (output, (CK_CERTIFICATE_TYPE) 
gck_attribute_get_ulong(attr));
                } else if (_gck_attribute_is_ulong_of_type (attr, CKA_KEY_TYPE)) {
-                       _gck_format_key_type (output, *((CK_KEY_TYPE *)attr->value));
+                       _gck_format_key_type (output, (CK_KEY_TYPE) gck_attribute_get_ulong(attr));
                } else if (_gck_attribute_is_sensitive (attr)) {
                        g_string_append_printf (output, " (%lu) NOT-PRINTED", attr->length);
                } else {


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