mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 06:32:10 +01:00
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
This commit is contained in:
parent
afdb2abb13
commit
bf1e63c2aa
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user