Graphviz 13.0.0~dev.20250210.0415
Loading...
Searching...
No Matches
base64.c File Reference
#include <stddef.h>
#include <util/alloc.h>
#include <util/base64.h>
Include dependency graph for base64.c:

Go to the source code of this file.

Functions

static size_t div_up (size_t dividend, size_t divisor)
 
size_t gv_base64_size (size_t source_size)
 
char * gv_base64 (const unsigned char *source, size_t size)
 

Variables

static const char base64_alphabet []
 

Function Documentation

◆ div_up()

static size_t div_up ( size_t  dividend,
size_t  divisor 
)
static

Definition at line 5 of file base64.c.

Referenced by gv_base64_size().

Here is the caller graph for this function:

◆ gv_base64()

char * gv_base64 ( const unsigned char *  source,
size_t  size 
)

Base64 encode some data

This function does not return on failure, like memory allocation. It calls exit. The caller is expected to free the returned pointer.

Parameters
sourcePointer to the start of data to encode
sizeNumber of bytes in the source
Returns
A buffer of the encoded data

Definition at line 14 of file base64.c.

References base64_alphabet, gv_alloc(), and gv_base64_size().

Referenced by core_loadimage_svg(), and kitty_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gv_base64_size()

size_t gv_base64_size ( size_t  source_size)

how many bytes does it take to encode a given source data length?

Parameters
source_sizeThe number of bytes in the source to encoding
Returns
The number of bytes required in the destination of encoding

Definition at line 12 of file base64.c.

References div_up().

Referenced by core_loadimage_svg(), gv_base64(), and kitty_write().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ base64_alphabet

const char base64_alphabet[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="

Definition at line 9 of file base64.c.

Referenced by gv_base64().