Commit 0755ff97 authored by Philip Withnall's avatar Philip Withnall

gchecksum: Drop preconditions for checksum_type being valid

Instead, return `NULL` if the checksum type is unsupported. This may
come in useful if we have to withdraw support for a particular checksum
type in future, due to it being broken.

These semantics were already in place for the return value of
`g_checksum_new()` — see commit 877cc60f and bug
comment https://bugzilla.gnome.org/show_bug.cgi?id=501853#c6.
Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
parent 3fef0494
......@@ -1790,7 +1790,6 @@ g_compute_checksum_for_data (GChecksumType checksum_type,
GChecksum *checksum;
gchar *retval;
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
g_return_val_if_fail (length == 0 || data != NULL, NULL);
checksum = g_checksum_new (checksum_type);
......@@ -1825,7 +1824,6 @@ g_compute_checksum_for_string (GChecksumType checksum_type,
const gchar *str,
gssize length)
{
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
g_return_val_if_fail (length == 0 || str != NULL, NULL);
if (length < 0)
......@@ -1859,7 +1857,6 @@ g_compute_checksum_for_bytes (GChecksumType checksum_type,
gconstpointer byte_data;
gsize length;
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
g_return_val_if_fail (data != NULL, NULL);
byte_data = g_bytes_get_data (data, &length);
......
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