/pidgin/main: b7ecc46eaff8: Merged in CMaiku/pidgin (pull reques...

Gary Kramlich <[email protected]> Tue, 06 Sep 2016 11:19:21 -0400
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: b7ecc46eaff88bf36deea65984d7fca48393778a
Author:	 Gary Kramlich <[email protected]>
Date:	 2016-09-01 23:08 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/b7ecc46eaff8

Description:

Merged in CMaiku/pidgin (pull request #112)

Fix some GI annotation warnings

diffstat:

 libpurple/Makefile.am            |   2 +-
 libpurple/purple-gio.h           |   6 +++---
 libpurple/tls-certificate-info.c |  35 +++++++++++++++++++++++++++++++++++
 libpurple/tls-certificate-info.h |  12 +++++++++++-
 libpurple/tls-certificate.h      |  11 +++++++----
 5 files changed, 57 insertions(+), 9 deletions(-)

diffs (172 lines):

diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -503,7 +503,7 @@ introspection_sources = \
 	$(addprefix media/, $(purple_mediaheaders))
 
 Purple-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir: $(builddir)/libpurple.la
-Purple_3_0_gir_INCLUDES = GObject-2.0
+Purple_3_0_gir_INCLUDES = Gio-2.0 GObject-2.0
 if PLUGINS
 Purple_3_0_gir_INCLUDES += GPlugin-0.0
 endif
diff --git a/libpurple/purple-gio.h b/libpurple/purple-gio.h
--- a/libpurple/purple-gio.h
+++ b/libpurple/purple-gio.h
@@ -44,8 +44,8 @@ G_BEGIN_DECLS
 /**
  * purple_gio_graceful_close:
  * @stream: A #GIOStream to close
- * @input: (optional): A #GInputStream which wraps @stream's input stream
- * @output: (optional): A #GOutputStream which wraps @stream's output stream
+ * @input: (nullable): A #GInputStream which wraps @stream's input stream
+ * @output: (nullable): A #GOutputStream which wraps @stream's output stream
  *
  * Closes @input, @output, @stream. If there are pending operations, it
  * asynchronously waits for the operations to finish before closing the
@@ -64,7 +64,7 @@ purple_gio_graceful_close(GIOStream *str
  * A helper function to simplify creating a #GSocketClient. It's intended
  * to be used in protocol plugins.
  *
- * Returns: A new #GSocketClient with the appropriate
+ * Returns: (transfer full): A new #GSocketClient with the appropriate
  * GProxyResolver, based on the #PurpleAccount settings and
  * TLS Certificate handling, or NULL if an error occurred.
  */
diff --git a/libpurple/tls-certificate-info.c b/libpurple/tls-certificate-info.c
--- a/libpurple/tls-certificate-info.c
+++ b/libpurple/tls-certificate-info.c
@@ -222,6 +222,19 @@ typedef struct {
 	gchar *value;
 } DerOIDValue;
 
+static DerOIDValue *
+der_oid_value_copy(DerOIDValue *data)
+{
+	DerOIDValue *ret;
+
+	g_return_val_if_fail(data != NULL, NULL);
+
+	ret = g_new0(DerOIDValue, 1);
+	ret->oid = g_strdup(data->oid);
+	ret->value = g_strdup(data->value);
+	return ret;
+}
+
 static void
 der_oid_value_free(DerOIDValue *data)
 {
@@ -603,6 +616,24 @@ purple_tls_certificate_get_info(GTlsCert
 	return info;
 }
 
+static PurpleTlsCertificateInfo *
+purple_tls_certificate_info_copy(PurpleTlsCertificateInfo *info)
+{
+	PurpleTlsCertificateInfo *ret;
+
+	g_return_val_if_fail(info != NULL, NULL);
+
+	ret = g_new0(PurpleTlsCertificateInfo, 1);
+	ret->issuer = g_slist_copy_deep(info->issuer,
+			(GCopyFunc)der_oid_value_copy, NULL);
+	ret->notBefore = g_date_time_ref(info->notBefore);
+	ret->notAfter = g_date_time_ref(info->notAfter);
+	ret->subject = g_slist_copy_deep(info->subject,
+			(GCopyFunc)der_oid_value_copy, NULL);
+
+	return ret;
+}
+
 void
 purple_tls_certificate_info_free(PurpleTlsCertificateInfo *info)
 {
@@ -618,6 +649,10 @@ purple_tls_certificate_info_free(PurpleT
 	g_free(info);
 }
 
+G_DEFINE_BOXED_TYPE(PurpleTlsCertificateInfo, purple_tls_certificate_info,
+		purple_tls_certificate_info_copy,
+		purple_tls_certificate_info_free);
+
 /* Looks up the relative distinguished name (RDN) from an ObjectID */
 static const gchar *
 lookup_rdn_name_by_oid(const gchar *oid)
diff --git a/libpurple/tls-certificate-info.h b/libpurple/tls-certificate-info.h
--- a/libpurple/tls-certificate-info.h
+++ b/libpurple/tls-certificate-info.h
@@ -46,6 +46,16 @@
  */
 typedef struct _PurpleTlsCertificateInfo PurpleTlsCertificateInfo;
 
+#define PURPLE_TYPE_TLS_CERTIFICATE_INFO \
+		(purple_tls_certificate_info_get_type())
+
+/**
+ * purple_tls_certificate_info_get_type:
+ *
+ * Returns: The #GType for the #PurpleTlsCertificateInfo boxed structure.
+ */
+GType purple_tls_certificate_info_get_type(void);
+
 /**
  * purple_tls_certificate_get_info:
  * @certificate: Certificate from which to parse the info
@@ -95,7 +105,7 @@ purple_tls_certificate_info_get_subject_
  *
  * Returns the SHA1 fingerprint of the cert
  *
- * Returns: The SHA1 fingerprint of the cert
+ * Returns: (transfer full): The SHA1 fingerprint of the cert
  */
 GByteArray *
 purple_tls_certificate_get_fingerprint_sha1(GTlsCertificate *certificate);
diff --git a/libpurple/tls-certificate.h b/libpurple/tls-certificate.h
--- a/libpurple/tls-certificate.h
+++ b/libpurple/tls-certificate.h
@@ -45,7 +45,7 @@
  * purple_tls_certificate_trust() and friends. These IDs can then be passed
  * to purple_certificate_path() or used directly, if desired.
  *
- * Returns: (element-type utf8): The #GList of IDs described above
+ * Returns: (transfer full) (element-type utf8): #GList of IDs described above
  *          Free with purple_certificate_free_ids()
  */
 GList *
@@ -53,7 +53,8 @@ purple_tls_certificate_list_ids(void);
 
 /**
  * purple_tls_certificate_free_ids:
- * @ids: List of ids retrieved from purple_certificate_list_ids()
+ * @ids: (transfer full) (element-type utf8): List of ids retrieved from
+ *       purple_certificate_list_ids()
  *
  * Frees the list of IDs returned from purple_certificate_list_ids().
  */
@@ -66,6 +67,8 @@ purple_tls_certificate_free_ids(GList *i
  * @error: A GError location to store the error occurring, or NULL to ignore
  *
  * Loads the certificate referenced by ID into a #GTlsCertificate object.
+ *
+ * Returns: (transfer full): #GTlsCertificate loaded from ID
  */
 GTlsCertificate *
 purple_tls_certificate_new_from_id(const gchar *id, GError **error);
@@ -106,7 +109,7 @@ purple_tls_certificate_distrust(const gc
  * Connects the Purple TLS certificate subsystem to @conn so it will accept
  * certificates trusted by purple_tls_certificate_trust() and friends.
  *
- * Returns: (transfer: none) (type GObject.Object): @conn, similar to
+ * Returns: (transfer none) (type GObject.Object): @conn, similar to
  *          g_object_connect()
  */
 gpointer
@@ -120,7 +123,7 @@ purple_tls_certificate_attach_to_tls_con
  * connections it creates will accept certificates trusted by
  * purple_tls_certificate_trust() and friends.
  *
- * Returns: (transfer: none) (type GObject.Object): @client, similar to
+ * Returns: (transfer none) (type GObject.Object): @client, similar to
  *          g_object_connect()
  */
 gpointer

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits