mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
gbase64: Convert a precondition from g_error() to g_return_val_if_fail()
The caller needs to check this themselves in any case, so we might as well at least follow convention in defining the precondition. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
5c97cf666d
commit
86e099c134
@ -268,9 +268,7 @@ g_base64_encode (const guchar *data,
|
||||
|
||||
/* We can use a smaller limit here, since we know the saved state is 0,
|
||||
+1 is needed for trailing \0, also check for unlikely integer overflow */
|
||||
if (len >= ((G_MAXSIZE - 1) / 4 - 1) * 3)
|
||||
g_error("%s: input too large for Base64 encoding (%"G_GSIZE_FORMAT" chars)",
|
||||
G_STRLOC, len);
|
||||
g_return_val_if_fail (len < ((G_MAXSIZE - 1) / 4 - 1) * 3, NULL);
|
||||
|
||||
out = g_malloc ((len / 3 + 1) * 4 + 1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user