MCPcopy Create free account
hub / github.com/audacity/audacity / serd_base64_decode

Function serd_base64_decode

lib-src/lv2/serd/src/string.c:187–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void*
188serd_base64_decode(const uint8_t* str, size_t len, size_t* size)
189{
190 void* buf = malloc((len * 3) / 4 + 2);
191 *size = 0;
192 for (size_t i = 0, j = 0; i < len; j += 3) {
193 uint8_t in[] = "====";
194 size_t n_in = 0;
195 for (; i < len && n_in < 4; ++n_in) {
196 for (; i < len && !is_base64(str[i]); ++i) {} // Skip junk
197 in[n_in] = str[i++];
198 }
199 if (n_in > 1) {
200 *size += decode_chunk(in, (uint8_t*)buf + j);
201 }
202 }
203 return buf;
204}

Callers 3

mainFunction · 0.85
read_literalFunction · 0.85
read_objectFunction · 0.85

Calls 2

is_base64Function · 0.85
decode_chunkFunction · 0.85

Tested by 1

mainFunction · 0.68