aboutsummaryrefslogtreecommitdiffstats
path: root/src/base64.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-29 17:12:02 -0400
committerDavid Robillard <d@drobilla.net>2021-05-31 11:37:53 -0400
commit9aa0c922b503f9b1f7f22add0afe19638bba7e9b (patch)
tree73e639bee2fd1cb9d06a1bd5770803ecf6ca5e7e /src/base64.c
parent624accde94a105213dc3562606c638d9620e7a72 (diff)
downloadserd-9aa0c922b503f9b1f7f22add0afe19638bba7e9b.tar.gz
serd-9aa0c922b503f9b1f7f22add0afe19638bba7e9b.tar.bz2
serd-9aa0c922b503f9b1f7f22add0afe19638bba7e9b.zip
Make most function parameters const
More const never hurts in general, but in particular this allows the compiler to make better nullability deductions, which reduces the amount of manual nullability casting required.
Diffstat (limited to 'src/base64.c')
-rw-r--r--src/base64.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/base64.c b/src/base64.c
index 4a9b4dac..8569577b 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -49,7 +49,7 @@ static const char b64_unmap[] =
/** Encode 3 raw bytes to 4 base64 characters. */
static void
-encode_chunk(uint8_t out[4], const uint8_t in[3], size_t n_in)
+encode_chunk(uint8_t out[4], const uint8_t in[3], const size_t n_in)
{
out[0] = b64_map[in[0] >> 2];
out[1] = b64_map[((in[0] & 0x03) << 4) | ((in[1] & 0xF0) >> 4)];
@@ -107,7 +107,9 @@ decode_chunk(const uint8_t in[4], uint8_t out[3])
}
void*
-serd_base64_decode(const uint8_t* str, size_t len, size_t* size)
+serd_base64_decode(const uint8_t* const str,
+ const size_t len,
+ size_t* const size)
{
void* buf = malloc((len * 3) / 4 + 2);