From 0755ff97be198e0e255141f99776320fa6c1e893 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sat, 12 Dec 2020 18:28:45 +0000 Subject: [PATCH] gchecksum: Drop preconditions for checksum_type being valid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- glib/gchecksum.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/glib/gchecksum.c b/glib/gchecksum.c index f5ef9a443..29b479bc6 100644 --- a/glib/gchecksum.c +++ b/glib/gchecksum.c @@ -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);