summaryrefslogtreecommitdiffstats
path: root/gl/base64.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/base64.h')
-rw-r--r--gl/base64.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/gl/base64.h b/gl/base64.h
index 2be394b..343150c 100644
--- a/gl/base64.h
+++ b/gl/base64.h
@@ -1,5 +1,5 @@
1/* base64.h -- Encode binary data using printable characters. 1/* base64.h -- Encode binary data using printable characters.
2 Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc. 2 Copyright (C) 2004-2006, 2009-2013 Free Software Foundation, Inc.
3 Written by Simon Josefsson. 3 Written by Simon Josefsson.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19#ifndef BASE64_H 18#ifndef BASE64_H
20# define BASE64_H 19# define BASE64_H
@@ -25,6 +24,10 @@
25/* Get bool. */ 24/* Get bool. */
26# include <stdbool.h> 25# include <stdbool.h>
27 26
27# ifdef __cplusplus
28extern "C" {
29# endif
30
28/* This uses that the expression (n+(k-1))/k means the smallest 31/* This uses that the expression (n+(k-1))/k means the smallest
29 integer >= n/k, i.e., the ceiling of n/k. */ 32 integer >= n/k, i.e., the ceiling of n/k. */
30# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4) 33# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
@@ -35,7 +38,7 @@ struct base64_decode_context
35 char buf[4]; 38 char buf[4];
36}; 39};
37 40
38extern bool isbase64 (char ch); 41extern bool isbase64 (char ch) _GL_ATTRIBUTE_CONST;
39 42
40extern void base64_encode (const char *restrict in, size_t inlen, 43extern void base64_encode (const char *restrict in, size_t inlen,
41 char *restrict out, size_t outlen); 44 char *restrict out, size_t outlen);
@@ -58,4 +61,8 @@ extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
58#define base64_decode_alloc(in, inlen, out, outlen) \ 61#define base64_decode_alloc(in, inlen, out, outlen) \
59 base64_decode_alloc_ctx (NULL, in, inlen, out, outlen) 62 base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
60 63
64# ifdef __cplusplus
65}
66# endif
67
61#endif /* BASE64_H */ 68#endif /* BASE64_H */