[glib] Revert "gtlscertificate: Add certificate-bytes and private-key-bytes props"



commit 7518f7a674723ded4cbb32d780c594c5d515af70
Author: Stef Walter <stefw gnome org>
Date:   Tue Aug 21 13:26:27 2012 +0200

    Revert "gtlscertificate: Add certificate-bytes and private-key-bytes props"
    
     * In order to add contstruct properties to an abstract base
       calls, and retain ABI stability, the base class must add a
       default implementation of those properties.
     * We cannot add a default implementation of certificate-bytes
       or private-key-bytes since certificate and private-key properties
       are writable on construct-only.
    
    This reverts commit 541c985869fe9f2c0a858c0a91b4eb60f99d19f0.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682081

 gio/gdummytlsbackend.c      |    4 ---
 gio/gtlscertificate.c       |   59 ++++++++-----------------------------------
 gio/tests/gtesttlsbackend.c |    6 ----
 3 files changed, 11 insertions(+), 58 deletions(-)
---
diff --git a/gio/gdummytlsbackend.c b/gio/gdummytlsbackend.c
index 1abab7e..5a2463b 100644
--- a/gio/gdummytlsbackend.c
+++ b/gio/gdummytlsbackend.c
@@ -105,10 +105,8 @@ enum
   PROP_CERTIFICATE_0,
 
   PROP_CERT_CERTIFICATE,
-  PROP_CERT_CERTIFICATE_BYTES,
   PROP_CERT_CERTIFICATE_PEM,
   PROP_CERT_PRIVATE_KEY,
-  PROP_CERT_PRIVATE_KEY_BYTES,
   PROP_CERT_PRIVATE_KEY_PEM,
   PROP_CERT_ISSUER
 };
@@ -150,10 +148,8 @@ g_dummy_tls_certificate_class_init (GDummyTlsCertificateClass *certificate_class
   gobject_class->set_property = g_dummy_tls_certificate_set_property;
 
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
-  g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_BYTES, "certificate-bytes");
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
   g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");
-  g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_BYTES, "private-key-bytes");
   g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_PEM, "private-key-pem");
   g_object_class_override_property (gobject_class, PROP_CERT_ISSUER, "issuer");
 }
diff --git a/gio/gtlscertificate.c b/gio/gtlscertificate.c
index cc5d2ee..ea5f1df 100644
--- a/gio/gtlscertificate.c
+++ b/gio/gtlscertificate.c
@@ -58,10 +58,8 @@ enum
   PROP_0,
 
   PROP_CERTIFICATE,
-  PROP_CERTIFICATE_BYTES,
   PROP_CERTIFICATE_PEM,
   PROP_PRIVATE_KEY,
-  PROP_PRIVATE_KEY_BYTES,
   PROP_PRIVATE_KEY_PEM,
   PROP_ISSUER
 };
@@ -101,9 +99,8 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
    * GTlsCertificate:certificate:
    *
    * The DER (binary) encoded representation of the certificate.
-   * This property and the #GTlsCertificate:certificate-bytes contain
-   * the same data. The #GTlsCertificate:certificate-pem property
-   * represents the same data, just in different forms.
+   * This property and the #GTlsCertificate:certificate-pem property
+   * represent the same data, just in different forms.
    *
    * Since: 2.28
    */
@@ -116,29 +113,11 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
 						       G_PARAM_CONSTRUCT_ONLY |
 						       G_PARAM_STATIC_STRINGS));
   /**
-   * GTlsCertificate:certificate-bytes:
-   *
-   * The DER (binary) encoded representation of the certificate as
-   * a #GBytes. The #GTlsCertificate:certificate property contains
-   * the same data. The #GTlsCertificate:certificate-pem property
-   * contains the same data as this property in a different form.
-   *
-   * Since: 2.34
-   */
-  g_object_class_install_property (gobject_class, PROP_CERTIFICATE_BYTES,
-                                   g_param_spec_boxed ("certificate-bytes",
-                                                       P_("Certificate Bytes"),
-                                                       P_("The DER representation of the certificate"),
-                                                       G_TYPE_BYTES,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT_ONLY |
-                                                       G_PARAM_STATIC_STRINGS));
-  /**
    * GTlsCertificate:certificate-pem:
    *
    * The PEM (ASCII) encoded representation of the certificate.
-   * The #GTlsCertificate:certificate and #GTlsCertificate:certificate-bytes
-   * properties represent the same data, just in a different form.
+   * This property and the #GTlsCertificate:certificate
+   * property represent the same data, just in different forms.
    *
    * Since: 2.28
    */
@@ -174,23 +153,6 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
 						       G_PARAM_CONSTRUCT_ONLY |
 						       G_PARAM_STATIC_STRINGS));
   /**
-   * GTlsCertificate:private-key-bytes:
-   *
-   * The DER (binary) encoded representation of the certificate's
-   * private key. This property and the #GtlsCertificate:private-key
-   * property contain the same data.
-   *
-   * Since: 2.34
-   */
-  g_object_class_install_property (gobject_class, PROP_PRIVATE_KEY_BYTES,
-                                   g_param_spec_boxed ("private-key-bytes",
-                                                       P_("Private key bytes"),
-                                                       P_("The DER representation of the certificate's private key"),
-                                                       G_TYPE_BYTES,
-                                                       G_PARAM_WRITABLE |
-                                                       G_PARAM_CONSTRUCT_ONLY |
-                                                       G_PARAM_STATIC_STRINGS));
-  /**
    * GTlsCertificate:private-key-pem:
    *
    * The PEM (ASCII) encoded representation of the certificate's
@@ -617,19 +579,20 @@ gboolean
 g_tls_certificate_is_same (GTlsCertificate     *cert_one,
                            GTlsCertificate     *cert_two)
 {
-  GBytes *b1, *b2;
+  GByteArray *b1, *b2;
   gboolean equal;
 
   g_return_val_if_fail (G_IS_TLS_CERTIFICATE (cert_one), FALSE);
   g_return_val_if_fail (G_IS_TLS_CERTIFICATE (cert_two), FALSE);
 
-  g_object_get (cert_one, "certificate-bytes", &b1, NULL);
-  g_object_get (cert_two, "certificate-bytes", &b2, NULL);
+  g_object_get (cert_one, "certificate", &b1, NULL);
+  g_object_get (cert_two, "certificate", &b2, NULL);
 
-  equal = g_bytes_equal (b1, b2);
+  equal = (b1->len == b2->len &&
+           memcmp (b1->data, b2->data, b1->len) == 0);
 
-  g_bytes_unref (b1);
-  g_bytes_unref (b2);
+  g_byte_array_unref (b1);
+  g_byte_array_unref (b2);
 
   return equal;
 }
diff --git a/gio/tests/gtesttlsbackend.c b/gio/tests/gtesttlsbackend.c
index e39f3c5..d951bdf 100644
--- a/gio/tests/gtesttlsbackend.c
+++ b/gio/tests/gtesttlsbackend.c
@@ -81,10 +81,8 @@ enum
   PROP_CERTIFICATE_0,
 
   PROP_CERT_CERTIFICATE,
-  PROP_CERT_CERTIFICATE_BYTES,
   PROP_CERT_CERTIFICATE_PEM,
   PROP_CERT_PRIVATE_KEY,
-  PROP_CERT_PRIVATE_KEY_BYTES,
   PROP_CERT_PRIVATE_KEY_PEM,
   PROP_CERT_ISSUER
 };
@@ -135,9 +133,7 @@ g_test_tls_certificate_set_property (GObject      *object,
       cert->key_pem = g_value_dup_string (value);
       break;
     case PROP_CERT_CERTIFICATE:
-    case PROP_CERT_CERTIFICATE_BYTES:
     case PROP_CERT_PRIVATE_KEY:
-    case PROP_CERT_PRIVATE_KEY_BYTES:
     case PROP_CERT_ISSUER:
       /* ignore */
       break;
@@ -166,10 +162,8 @@ g_test_tls_certificate_class_init (GTestTlsCertificateClass *certificate_class)
   gobject_class->finalize = g_test_tls_certificate_finalize;
 
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
-  g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_BYTES, "certificate-bytes");
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
   g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");
-  g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_BYTES, "private-key-bytes");
   g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_PEM, "private-key-pem");
   g_object_class_override_property (gobject_class, PROP_CERT_ISSUER, "issuer");
 }



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