chttp · Section 3
chttp_base64_encode
NAME
chttp_base64_encode - encode a buffer as base64 (default allocator)
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/chttp.h>
char *chttp_base64_encode(const void *data, size_t len,
size_t *out_len);
DESCRIPTION
This is a static inline wrapper that calls chttp_base64_encode_mp() with NULL memory management procedures, so it allocates with malloc.
PARAMETERS
data The buffer to encode. It can be NULL only if len is 0.
len The number of bytes in data.
out_len Optional. It receives the length of the returned string,
without the terminating NUL. Pass NULL if you don't need
it.
RETURN VALUE
A new NUL-terminated base64 string on success. NULL if the allocation fails, if data is NULL and len is not zero, or if len is so large that the encoded size overflows size_t.