[glib] Make GChecksum more fully introspectable



commit bf1e63c2aaa0ff3dad75a006576ba8b5daac6559
Author: Colin Walters <walters verbum org>
Date:   Mon Dec 10 10:50:30 2012 -0500

    Make GChecksum more fully introspectable
    
    In 2.34, g_compute_checksum_for_bytes() was added, but this patch
    allows binding users to use the incremental update API; this is
    significantly more efficient than reading entire files into memory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689982

 glib/gchecksum.c     |    8 ++++----
 gobject/gboxed.c     |    1 +
 gobject/glib-types.h |   11 +++++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/glib/gchecksum.c b/glib/gchecksum.c
index cf0ea9b..f5e9ba8 100644
--- a/glib/gchecksum.c
+++ b/glib/gchecksum.c
@@ -1424,7 +1424,7 @@ g_checksum_type_get_length (GChecksumType checksum_type)
  * will be closed and it won't be possible to call g_checksum_update()
  * on it anymore.
  *
- * Return value: the newly created #GChecksum, or %NULL.
+ * Return value: (transfer full): the newly created #GChecksum, or %NULL.
  *   Use g_checksum_free() to free the memory allocated by it.
  *
  * Since: 2.16
@@ -1531,7 +1531,7 @@ g_checksum_free (GChecksum *checksum)
 /**
  * g_checksum_update:
  * @checksum: a #GChecksum
- * @data: buffer used to compute the checksum
+ * @data: (array length=length) (element-type guint8): buffer used to compute the checksum
  * @length: size of the buffer, or -1 if it is a null-terminated string.
  *
  * Feeds @data into an existing #GChecksum. The checksum must still be
@@ -1635,7 +1635,7 @@ g_checksum_get_string (GChecksum *checksum)
 }
 
 /**
- * g_checksum_get_digest:
+ * g_checksum_get_digest: (skip)
  * @checksum: a #GChecksum
  * @buffer: output buffer
  * @digest_len: an inout parameter. The caller initializes it to the size of @buffer.
@@ -1713,7 +1713,7 @@ g_checksum_get_digest (GChecksum  *checksum,
 /**
  * g_compute_checksum_for_data:
  * @checksum_type: a #GChecksumType
- * @data: binary blob to compute the digest of
+ * @data: (array length=length) (element-type guint8): binary blob to compute the digest of
  * @length: length of @data
  *
  * Computes the checksum for a binary @data of @length. This is a
diff --git a/gobject/gboxed.c b/gobject/gboxed.c
index 6e66229..65e6bb4 100644
--- a/gobject/gboxed.c
+++ b/gobject/gboxed.c
@@ -162,6 +162,7 @@ G_DEFINE_BOXED_TYPE (GSource, g_source, g_source_ref, g_source_unref)
 G_DEFINE_BOXED_TYPE (GPollFD, g_pollfd, pollfd_copy, g_free)
 
 G_DEFINE_BOXED_TYPE (GThread, g_thread, g_thread_ref, g_thread_unref)
+G_DEFINE_BOXED_TYPE (GChecksum, g_checksum, g_checksum_copy, g_checksum_free)
 
 /* This one can't use G_DEFINE_BOXED_TYPE (GStrv, g_strv, g_strdupv, g_strfreev) */
 GType
diff --git a/gobject/glib-types.h b/gobject/glib-types.h
index f30139b..cc819e1 100644
--- a/gobject/glib-types.h
+++ b/gobject/glib-types.h
@@ -254,6 +254,15 @@ typedef gsize GType;
  */
 #define G_TYPE_THREAD (g_thread_get_type ())
 
+/**
+ * G_TYPE_CHECKSUM:
+ *
+ * The #GType for a boxed type holding a #GChecksum.
+ *
+ * Since: 2.36
+ */
+#define G_TYPE_CHECKSUM (g_checksum_get_type ())
+
 GType   g_date_get_type            (void) G_GNUC_CONST;
 GType   g_strv_get_type            (void) G_GNUC_CONST;
 GType   g_gstring_get_type         (void) G_GNUC_CONST;
@@ -283,6 +292,8 @@ GLIB_AVAILABLE_IN_2_36
 GType   g_pollfd_get_type          (void) G_GNUC_CONST;
 GLIB_AVAILABLE_IN_2_36
 GType   g_thread_get_type          (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_36
+GType   g_checksum_get_type        (void) G_GNUC_CONST;
 
 GLIB_DEPRECATED_FOR('G_TYPE_VARIANT')
 GType   g_variant_get_gtype        (void) G_GNUC_CONST;



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