Allow base64 encoding/decoding of empty strings.
gint state = 0, outlen;
gint save = 0;
gint state = 0, outlen;
gint save = 0;
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (len > 0, NULL);
+ g_return_val_if_fail (data != NULL || len == 0, NULL);
/* 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 */
/* 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 */
input_length = strlen (text);
input_length = strlen (text);
- g_return_val_if_fail (input_length > 1, NULL);
-
/* We can use a smaller limit here, since we know the saved state is 0,
+1 used to avoid calling g_malloc0(0), and hence retruning NULL */
ret = g_malloc0 ((input_length / 4) * 3 + 1);
/* We can use a smaller limit here, since we know the saved state is 0,
+1 used to avoid calling g_malloc0(0), and hence retruning NULL */
ret = g_malloc0 ((input_length / 4) * 3 + 1);