Commit 877cc60f authored by Matthias Clasen's avatar Matthias Clasen

Return NULL if the checksum_type is unknown

svn path=/trunk/; revision=6175
parent fc23e6ff
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>
* 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
from valgrind. Bug #504527.
......
......@@ -1052,9 +1052,9 @@ sha256_sum_digest (Sha256sum *sha256,
* g_checksum_type_get_length:
* @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.
*
* Since: 2.16
......@@ -1087,8 +1087,9 @@ g_checksum_type_get_length (GChecksumType checksum_type)
* g_checksum_new:
* @checksum_type: the desired type of checksum
*
* Creates a new #GChecksum, using the checksum algorithm @type. A
* #GChecksum can be used to compute the checksum, or digest, of an
* Creates a new #GChecksum, using the checksum algorithm @checksum_type.
* 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.
*
* 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()
* on it anymore.
*
* Return value: the newly created #GChecksum. Use g_checksum_free() to
* free the memory allocated by it.
* Return value: the newly created #GChecksum, or %NULL.
* Use g_checksum_free() to free the memory allocated by it.
*
* Since: 2.16
*/
......@@ -1110,7 +1111,8 @@ g_checksum_new (GChecksumType checksum_type)
{
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->type = checksum_type;
......
......@@ -34,8 +34,8 @@ G_BEGIN_DECLS
* The hashing algorithm to be used by #GChecksum when performing the
* digest of some data.
*
* The #GChecksumType enumeration can be extended at later date to include
* new hashing algorithm types.
* Note that the #GChecksumType enumeration may be extended at a later
* date to include new hashing algorithm types.
*
* Since: 2.16
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment