File: base64.h

package info (click to toggle)
graphviz 14.0.5-2
  • links: PTS
  • area: main
  • in suites: forky
  • size: 139,388 kB
  • sloc: ansic: 141,938; cpp: 11,957; python: 7,766; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (30 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/// @file
/// @brief Base64 encoding
#pragma once

#include <stddef.h>
#include <util/api.h>

#ifdef __cplusplus
extern "C" {
#endif

/// how many bytes does it take to encode a given source data length?
///
/// @param source_size The number of bytes in the source to encoding
/// @return The number of bytes required in the destination of encoding
UTIL_API size_t gv_base64_size(size_t source_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.
///
/// @param source Pointer to the start of data to encode
/// @param size Number of bytes in the source
/// @return A buffer of the encoded data
UTIL_API char *gv_base64(const unsigned char *source, size_t size);

#ifdef __cplusplus
}
#endif