+2008-01-20 Murray Cumming <murrayc@murrayc.com>
+
+ * glib/gchecksum.c: (g_checksum_update): Accept -1 for the data
+ length if the data is a null-terminated string. Bug #510855.
+
2008-01-21 Alexander Larsson <alexl@redhat.com>
* configure.in:
* g_checksum_update:
* @checksum: a #GChecksum
* @data: buffer used to compute the checksum
- * @length: size of the buffer
+ * @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
* open, that is g_checksum_get_string() or g_checksum_get_digest() must
g_return_if_fail (checksum != NULL);
g_return_if_fail (data != NULL);
+ if (length < 0)
+ length = strlen (data);
+
if (checksum->digest_str)
{
g_warning ("The checksum `%s' has been closed and cannot be updated "
* g_compute_checksum_for_string:
* @checksum_type: a #GChecksumType
* @str: the string to compute the checksum of
- * @length: the length of the string, or -1
+ * @length: the length of the string, or -1 if the string is null-terminated.
*
* Computes the checksum of a string.
*