3 void base64_decode_bs(BinarySink
*bs
, ptrlen input
)
6 BinarySource_BARE_INIT_PL(src
, input
);
8 while (get_avail(src
)) {
10 unsigned char binatom
[3];
12 for (size_t i
= 0; i
< 4 ;) {
13 char c
= get_byte(src
);
16 if (c
== '\n' || c
== '\r')
21 put_data(bs
, binatom
, base64_decode_atom(b64atom
, binatom
));
25 void base64_decode_fp(FILE *fp
, ptrlen input
)
28 stdio_sink_init(&ss
, fp
);
29 base64_decode_bs(BinarySink_UPCAST(&ss
), input
);
32 strbuf
*base64_decode_sb(ptrlen input
)
34 strbuf
*sb
= strbuf_new_nm();
35 base64_decode_bs(BinarySink_UPCAST(sb
), input
);