mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-09 18:54:04 +02:00
Return NULL if the checksum_type is unknown
svn path=/trunk/; revision=6175
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
|
2007-12-20 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gchecksum.[hc] (g_checksum_new): Return NULL when
|
||||||
|
the checksum_type is unknown. (#501853)
|
||||||
|
|
||||||
2007-12-20 Christian Persch <chpe@gnome.org>
|
2007-12-20 Christian Persch <chpe@gnome.org>
|
||||||
|
|
||||||
* glib/gchecksum.c: (g_checksum_new): Use g_slice_new0, to fix
|
* glib/gchecksum.c (g_checksum_new): Use g_slice_new0, to fix
|
||||||
"conditional jump or move depends on uninitialised value(s)" error
|
"conditional jump or move depends on uninitialised value(s)" error
|
||||||
from valgrind. Bug #504527.
|
from valgrind. Bug #504527.
|
||||||
|
|
||||||
|
@@ -1052,9 +1052,9 @@ sha256_sum_digest (Sha256sum *sha256,
|
|||||||
* g_checksum_type_get_length:
|
* g_checksum_type_get_length:
|
||||||
* @checksum_type: a #GChecksumType
|
* @checksum_type: a #GChecksumType
|
||||||
*
|
*
|
||||||
* Gets the length in bytes of digests of type @type
|
* Gets the length in bytes of digests of type @checksum_type
|
||||||
*
|
*
|
||||||
* Return value: the checksum length, or -1 if @type is
|
* Return value: the checksum length, or -1 if @checksum_type is
|
||||||
* not supported.
|
* not supported.
|
||||||
*
|
*
|
||||||
* Since: 2.16
|
* Since: 2.16
|
||||||
@@ -1087,8 +1087,9 @@ g_checksum_type_get_length (GChecksumType checksum_type)
|
|||||||
* g_checksum_new:
|
* g_checksum_new:
|
||||||
* @checksum_type: the desired type of checksum
|
* @checksum_type: the desired type of checksum
|
||||||
*
|
*
|
||||||
* Creates a new #GChecksum, using the checksum algorithm @type. A
|
* Creates a new #GChecksum, using the checksum algorithm @checksum_type.
|
||||||
* #GChecksum can be used to compute the checksum, or digest, of an
|
* If the @checksum_type is not known, %NULL is returned.
|
||||||
|
* A #GChecksum can be used to compute the checksum, or digest, of an
|
||||||
* arbitrary binary blob, using different hashing algorithms.
|
* arbitrary binary blob, using different hashing algorithms.
|
||||||
*
|
*
|
||||||
* A #GChecksum works by feeding a binary blob through g_checksum_update()
|
* A #GChecksum works by feeding a binary blob through g_checksum_update()
|
||||||
@@ -1100,8 +1101,8 @@ g_checksum_type_get_length (GChecksumType checksum_type)
|
|||||||
* will be closed and it won't be possible to call g_checksum_update()
|
* will be closed and it won't be possible to call g_checksum_update()
|
||||||
* on it anymore.
|
* on it anymore.
|
||||||
*
|
*
|
||||||
* Return value: the newly created #GChecksum. Use g_checksum_free() to
|
* Return value: the newly created #GChecksum, or %NULL.
|
||||||
* free the memory allocated by it.
|
* Use g_checksum_free() to free the memory allocated by it.
|
||||||
*
|
*
|
||||||
* Since: 2.16
|
* Since: 2.16
|
||||||
*/
|
*/
|
||||||
@@ -1110,7 +1111,8 @@ g_checksum_new (GChecksumType checksum_type)
|
|||||||
{
|
{
|
||||||
GChecksum *checksum;
|
GChecksum *checksum;
|
||||||
|
|
||||||
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
|
if (! IS_VALID_TYPE (checksum_type))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
checksum = g_slice_new0 (GChecksum);
|
checksum = g_slice_new0 (GChecksum);
|
||||||
checksum->type = checksum_type;
|
checksum->type = checksum_type;
|
||||||
|
@@ -34,8 +34,8 @@ G_BEGIN_DECLS
|
|||||||
* The hashing algorithm to be used by #GChecksum when performing the
|
* The hashing algorithm to be used by #GChecksum when performing the
|
||||||
* digest of some data.
|
* digest of some data.
|
||||||
*
|
*
|
||||||
* The #GChecksumType enumeration can be extended at later date to include
|
* Note that the #GChecksumType enumeration may be extended at a later
|
||||||
* new hashing algorithm types.
|
* date to include new hashing algorithm types.
|
||||||
*
|
*
|
||||||
* Since: 2.16
|
* Since: 2.16
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user